31 #define DEBUG_TYPE "legalizer" 37 "Legalize the Machine IR a function's Machine IR",
false,
61 case TargetOpcode::G_TRUNC:
62 case TargetOpcode::G_ZEXT:
63 case TargetOpcode::G_ANYEXT:
64 case TargetOpcode::G_SEXT:
65 case TargetOpcode::G_MERGE_VALUES:
66 case TargetOpcode::G_UNMERGE_VALUES:
82 const size_t NumBlocks = MF.
size();
92 for (
auto *MBB : RPOT) {
120 auto RemoveDeadInstFromLists = [&InstList,
123 ArtifactList.
remove(DeadMI);
125 bool Changed =
false;
127 while (!InstList.
empty()) {
143 "unable to legalize instruction", MI);
148 while (!ArtifactList.
empty()) {
153 RemoveDeadInstFromLists(&MI);
158 if (ArtCombiner.tryCombineInstruction(MI, DeadInstructions)) {
159 for (
auto *DeadMI : DeadInstructions) {
161 RemoveDeadInstFromLists(DeadMI);
162 DeadMI->eraseFromParentAndMarkDBGValuesForRemoval();
173 }
while (!InstList.
empty());
177 if (MF.
size() != NumBlocks) {
181 R <<
"inserting blocks is not supported yet";
const LegalizerInfo & getLegalizerInfo() const
Expose LegalizerInfo so the clients can re-use.
MachineIRBuilder MIRBuilder
Expose MIRBuilder so clients can set their own RecordInsertInstruction functions. ...
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
Compute iterated dominance frontiers using a linear time algorithm.
void getSelectionDAGFallbackAnalysisUsage(AnalysisUsage &AU)
Modify analysis usage so it preserves passes required for the SelectionDAG fallback.
const MachineFunctionProperties & getProperties() const
Get the function properties.
void remove(MachineInstr *I)
Remove - remove I from the worklist if it exists.
INITIALIZE_PASS_BEGIN(Legalizer, DEBUG_TYPE, "Legalize the Machine IR a function's Machine IR", false, false) INITIALIZE_PASS_END(Legalizer
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
Target-Independent Code Generator Pass Configuration Options.
void eraseFromParentAndMarkDBGValuesForRemoval()
Unlink 'this' from the containing basic block and delete it.
COFF::MachineTypes Machine
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
void stopRecordingInsertions()
unsigned const MachineRegisterInfo * MRI
LegalizeResult legalizeInstrStep(MachineInstr &MI)
Replace MI by a sequence of legal instructions that can implement the same operation.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
DISubprogram * getSubprogram() const
Get the attached subprogram.
Represent the analysis usage information of a pass.
bool runOnMachineFunction(MachineFunction &MF) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
Some kind of error has occurred and we could not legalize this instruction.
Legalize the Machine IR a function s Machine IR
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
MachineInstr * pop_back_val()
void insert(MachineInstr *I)
Add - Add the specified instruction to the worklist if it isn't already in it.
const Function & getFunction() const
Return the LLVM function that this machine code represents.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void recordInsertions(std::function< void(MachineInstr *)> InsertedInstr)
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
bool isTriviallyDead(const MachineInstr &MI, const MachineRegisterInfo &MRI)
Check whether an instruction MI is dead: it only defines dead virtual registers, and doesn't have oth...
Representation of each machine instruction.
Instruction has been legalized and the MachineFunction changed.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
static bool isArtifact(const MachineInstr &MI)
void initializeLegalizerPass(PassRegistry &)
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool hasProperty(Property P) const
bool isPreISelGenericOpcode(unsigned Opcode)
Check whether the given Opcode is a generic opcode that is not supposed to appear after ISel...
print Print MemDeps of function
void reportGISelFailure(MachineFunction &MF, const TargetPassConfig &TPC, MachineOptimizationRemarkEmitter &MORE, MachineOptimizationRemarkMissed &R)
Report an ISel error as a missed optimization remark to the LLVMContext's diagnostic stream...