blob: 5efaf20e61645cdd6c1307f2bb9789819f073db1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef RCC_CODEGEN_MACHINELICM_H
#define RCC_CODEGEN_MACHINELICM_H
#include "rcc/CodeGen/MachinePassManager.h"
#include <cstddef>
#include <cstdint>
namespace rcc {
enum class MachineCodeMotionStage : std::uint8_t {
SelectedSSA,
PostRegisterAllocation,
};
struct MachineLICMOptions final {
std::size_t MaximumHoistedInstructions = 10'000;
std::size_t MaximumHoistedDefinitionsPerLoop = 256;
};
class MachineLICMPass final : public MachineFunctionPass {
public:
explicit MachineLICMPass(MachineLICMOptions Options = {}) : Options(Options) {}
MachineLICMPass(MachineCodeMotionStage Stage, MachineLICMOptions Options = {})
: Stage(Stage), Options(Options) {}
[[nodiscard]] const MachinePassContract &contract() const noexcept override;
[[nodiscard]] Expected<MachinePassResult> run(MachineFunction &Function,
const TargetDescription &Target,
MachineFunctionAnalysisManager &Analyses) override;
private:
[[nodiscard]] Expected<MachinePassResult>
runImplementation(MachineFunction &Function, const TargetDescription &Target,
MachineFunctionAnalysisManager &Analyses);
MachineCodeMotionStage Stage = MachineCodeMotionStage::SelectedSSA;
MachineLICMOptions Options;
};
} // namespace rcc
#endif // RCC_CODEGEN_MACHINELICM_H
|