25 #define DEBUG_TYPE "legalizer"
31 "Legalize the Machine IR a function's Machine IR",
false,
53 if (MI.
getOpcode() != TargetOpcode::G_EXTRACT)
59 if (SeqI.
getOpcode() != TargetOpcode::G_SEQUENCE)
63 bool AllDefsReplaced =
true;
67 for (
unsigned Idx = 0, SeqIdx = 0; Idx < NumDefs; ++Idx) {
70 "unexpected extract operand");
72 unsigned ExtractReg = ExtractMO.
getReg();
75 while (SeqIdx < NumSeqSrcs &&
79 if (SeqIdx == NumSeqSrcs) {
80 AllDefsReplaced =
false;
87 AllDefsReplaced =
false;
92 "unexpected physical register in G_SEQUENCE");
101 if (AllDefsReplaced) {
105 "G_SEQUENCE does not dominate G_EXTRACT");
133 bool Changed =
false;
139 NextMI = std::next(
MI);
152 MF.getProperties().set(
158 OS <<
"unable to legalize instruction: ";
169 for (
auto &
MBB : MF) {
173 NextMI = std::next(
MI);
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
LLT getType(unsigned VReg) const
Get the low-level type of VReg or LLT{} if VReg is not a generic (target independent) virtual registe...
LegalizeResult legalizeInstr(MachineInstr &MI, const LegalizerInfo &LegalizerInfo)
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
bool hasProperty(Property P) const
iterator_range< use_iterator > use_operands(unsigned Reg) const
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const HexagonInstrInfo * TII
A Use represents the edge between a Value definition and its users.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
Legalize the Machine IR a function s Machine false
const MachineFunctionProperties & getProperties() const
Get the function properties.
virtual bool isGlobalISelAbortEnabled() const
Check whether or not GlobalISel should abort on error.
Target-Independent Code Generator Pass Configuration Options.
unsigned getNumOperands() const
Access to explicit operands of the instruction.
INITIALIZE_PASS_BEGIN(Legalizer, DEBUG_TYPE,"Legalize the Machine IR a function's Machine IR", false, false) INITIALIZE_PASS_END(Legalizer
COFF::MachineTypes Machine
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
TargetInstrInfo - Interface to description of machine instruction set.
unsigned const MachineRegisterInfo * MRI
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
const MachineOperand & getOperand(unsigned i) const
Represent the analysis usage information of a pass.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE,"Assign register bank of generic virtual registers", false, false) RegBankSelect
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.
bool combineExtracts(MachineInstr &MI, MachineRegisterInfo &MRI, const TargetInstrInfo &TII)
Legalize the Machine IR a function s Machine IR
std::string & str()
Flushes the stream contents to the target string and returns the string's reference.
MachineOperand class - Representation of each machine instruction operand.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
static bool isPreISelGenericOpcode(unsigned Opcode)
Check whether the given Opcode is a generic opcode that is not supposed to appear after ISel...
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
Representation of each machine instruction.
static bool isPhysicalRegister(unsigned Reg)
Return true if the specified register number is in the physical register namespace.
Instruction has been legalized and the MachineFunction changed.
def_instr_iterator def_instr_begin(unsigned RegNo) const
void initializeLegalizerPass(PassRegistry &)
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
unsigned getReg() const
getReg - Returns the register number.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A raw_ostream that writes to an std::string.
virtual const LegalizerInfo * getLegalizerInfo() const
print Print MemDeps of function
virtual void print(raw_ostream &O, const Module *M) const
print - Print out the internal state of the pass.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
bool use_empty(unsigned RegNo) const
use_empty - Return true if there are no instructions using the specified register.