File indexing completed on 2026-05-10 08:43:24
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef LLVM_CODEGEN_GLOBALISEL_INSTRUCTIONSELECT_H
0014 #define LLVM_CODEGEN_GLOBALISEL_INSTRUCTIONSELECT_H
0015
0016 #include "llvm/ADT/StringRef.h"
0017 #include "llvm/CodeGen/MachineFunction.h"
0018 #include "llvm/CodeGen/MachineFunctionPass.h"
0019 #include "llvm/Support/CodeGen.h"
0020
0021 namespace llvm {
0022
0023 class InstructionSelector;
0024 class GISelKnownBits;
0025 class BlockFrequencyInfo;
0026 class ProfileSummaryInfo;
0027
0028
0029
0030
0031
0032
0033
0034
0035 class InstructionSelect : public MachineFunctionPass {
0036 public:
0037 static char ID;
0038 StringRef getPassName() const override { return "InstructionSelect"; }
0039
0040 void getAnalysisUsage(AnalysisUsage &AU) const override;
0041
0042 MachineFunctionProperties getRequiredProperties() const override {
0043 return MachineFunctionProperties()
0044 .set(MachineFunctionProperties::Property::IsSSA)
0045 .set(MachineFunctionProperties::Property::Legalized)
0046 .set(MachineFunctionProperties::Property::RegBankSelected);
0047 }
0048
0049 MachineFunctionProperties getSetProperties() const override {
0050 return MachineFunctionProperties().set(
0051 MachineFunctionProperties::Property::Selected);
0052 }
0053
0054 InstructionSelect(CodeGenOptLevel OL = CodeGenOptLevel::Default,
0055 char &PassID = ID);
0056
0057 bool runOnMachineFunction(MachineFunction &MF) override;
0058 bool selectMachineFunction(MachineFunction &MF);
0059 void setInstructionSelector(InstructionSelector *NewISel) { ISel = NewISel; }
0060
0061 protected:
0062 class MIIteratorMaintainer;
0063
0064 InstructionSelector *ISel = nullptr;
0065 GISelKnownBits *KB = nullptr;
0066 BlockFrequencyInfo *BFI = nullptr;
0067 ProfileSummaryInfo *PSI = nullptr;
0068
0069 CodeGenOptLevel OptLevel = CodeGenOptLevel::None;
0070
0071 bool selectInstr(MachineInstr &MI);
0072 };
0073 }
0074
0075 #endif