| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
#ifndef LLVM_CODEGEN_GLOBALISEL_LEGALIZER_H |
| 21 |
#define LLVM_CODEGEN_GLOBALISEL_LEGALIZER_H |
| 22 |
|
| 23 |
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h" |
| 24 |
#include "llvm/CodeGen/MachineFunctionPass.h" |
| 25 |
|
| 26 |
namespace llvm { |
| 27 |
|
| 28 |
class LostDebugLocObserver; |
| 29 |
|
| 30 |
class Legalizer : public MachineFunctionPass { |
| 31 |
public: |
| 32 |
static char ID; |
| 33 |
|
| 34 |
struct MFResult { |
| 35 |
bool Changed; |
| 36 |
const MachineInstr *FailedOn; |
| 37 |
}; |
| 38 |
|
| 39 |
private: |
| 40 |
|
| 41 |
void init(MachineFunction &MF); |
| 42 |
|
| 43 |
public: |
| 44 |
|
| 45 |
Legalizer(); |
| 46 |
|
| 47 |
StringRef getPassName() const override { return "Legalizer"; } |
| 48 |
|
| 49 |
void getAnalysisUsage(AnalysisUsage &AU) const override; |
| 50 |
|
| 51 |
MachineFunctionProperties getRequiredProperties() const override { |
| 52 |
return MachineFunctionProperties().set( |
| 53 |
MachineFunctionProperties::Property::IsSSA); |
| 54 |
} |
| 55 |
|
| 56 |
MachineFunctionProperties getSetProperties() const override { |
| 57 |
return MachineFunctionProperties().set( |
| 58 |
MachineFunctionProperties::Property::Legalized); |
| 59 |
} |
| 60 |
|
| 61 |
MachineFunctionProperties getClearedProperties() const override { |
| 62 |
return MachineFunctionProperties().set( |
| 63 |
MachineFunctionProperties::Property::NoPHIs); |
| 64 |
} |
| 65 |
|
| 66 |
bool runOnMachineFunction(MachineFunction &MF) override; |
| 67 |
|
| 68 |
static MFResult |
| 69 |
legalizeMachineFunction(MachineFunction &MF, const LegalizerInfo &LI, |
| 70 |
ArrayRef<GISelChangeObserver *> AuxObservers, |
| 71 |
LostDebugLocObserver &LocObserver, |
| 72 |
MachineIRBuilder &MIRBuilder); |
| 73 |
}; |
| 74 |
} |
| 75 |
|
| 76 |
#endif |