File indexing completed on 2026-05-10 08:43:24
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #ifndef LLVM_CODEGEN_GLOBALISEL_LEGALIZER_H
0021 #define LLVM_CODEGEN_GLOBALISEL_LEGALIZER_H
0022
0023 #include "llvm/ADT/ArrayRef.h"
0024 #include "llvm/ADT/StringRef.h"
0025 #include "llvm/CodeGen/GlobalISel/GISelKnownBits.h"
0026 #include "llvm/CodeGen/MachineFunction.h"
0027 #include "llvm/CodeGen/MachineFunctionPass.h"
0028
0029 namespace llvm {
0030
0031 class LegalizerInfo;
0032 class MachineIRBuilder;
0033 class MachineInstr;
0034 class GISelChangeObserver;
0035 class LostDebugLocObserver;
0036
0037 class Legalizer : public MachineFunctionPass {
0038 public:
0039 static char ID;
0040
0041 struct MFResult {
0042 bool Changed;
0043 const MachineInstr *FailedOn;
0044 };
0045
0046 private:
0047
0048 void init(MachineFunction &MF);
0049
0050 public:
0051
0052 Legalizer();
0053
0054 StringRef getPassName() const override { return "Legalizer"; }
0055
0056 void getAnalysisUsage(AnalysisUsage &AU) const override;
0057
0058 MachineFunctionProperties getRequiredProperties() const override {
0059 return MachineFunctionProperties().set(
0060 MachineFunctionProperties::Property::IsSSA);
0061 }
0062
0063 MachineFunctionProperties getSetProperties() const override {
0064 return MachineFunctionProperties().set(
0065 MachineFunctionProperties::Property::Legalized);
0066 }
0067
0068 MachineFunctionProperties getClearedProperties() const override {
0069 return MachineFunctionProperties()
0070 .set(MachineFunctionProperties::Property::NoPHIs)
0071 .set(MachineFunctionProperties::Property::NoVRegs);
0072 }
0073
0074 bool runOnMachineFunction(MachineFunction &MF) override;
0075
0076 static MFResult
0077 legalizeMachineFunction(MachineFunction &MF, const LegalizerInfo &LI,
0078 ArrayRef<GISelChangeObserver *> AuxObservers,
0079 LostDebugLocObserver &LocObserver,
0080 MachineIRBuilder &MIRBuilder, GISelKnownBits *KB);
0081 };
0082 }
0083
0084 #endif