30#define DEBUG_TYPE "postrapseudos"
60 if (!ExpandPostRA().
run(MF))
66char ExpandPostRALegacy::ID = 0;
70 "Post-RA pseudo instruction expansion pass",
false,
false)
74 assert(
MI->getOperand(0).isReg() &&
MI->getOperand(0).isDef() &&
75 MI->getOperand(1).isReg() &&
MI->getOperand(1).isUse() &&
76 MI->getOperand(2).isImm() &&
"Invalid subreg_to_reg");
80 assert(!
MI->getOperand(1).getSubReg() &&
"SubIdx on physreg?");
81 unsigned SubIdx =
MI->getOperand(2).getImm();
83 assert(SubIdx != 0 &&
"Invalid index for insert_subreg");
84 Register DstSubReg =
TRI->getSubReg(DstReg, SubIdx);
87 "Insert destination must be in a physical register");
89 "Inserted value must be in a physical register");
93 if (
MI->allDefsAreDead() || DstSubReg == InsReg) {
98 MI->setDesc(
TII->get(TargetOpcode::KILL));
104 TII->copyPhysReg(*
MBB,
MI,
MI->getDebugLoc(), DstSubReg, InsReg,
105 MI->getOperand(1).isKill());
110 CopyMI->addRegisterDefined(DstReg);
118 return ExpandPostRA().run(MF);
126 <<
"********** EXPANDING POST-RA PSEUDO INSTRS **********\n"
127 <<
"********** Function: " << MF.
getName() <<
'\n');
131 bool MadeChange =
false;
146 switch (
MI.getOpcode()) {
147 case TargetOpcode::SUBREG_TO_REG:
148 MadeChange |= LowerSubregToReg(&
MI);
150 case TargetOpcode::COPY:
154 case TargetOpcode::DBG_VALUE:
156 case TargetOpcode::INSERT_SUBREG:
157 case TargetOpcode::EXTRACT_SUBREG:
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
const HexagonInstrInfo * TII
Register const TargetRegisterInfo * TRI
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Represent the analysis usage information of a pass.
LLVM_ABI void setPreservesCFG()
This function should be called by the pass, iff they do not:
Represents analyses that only rely on functions' control flow.
LLVM_ABI PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
bool expandPostRAPseudo(MachineInstr &MI) const override
This function is called for all pseudo instructions that remain after register allocation.
MachineInstrBundleIterator< MachineInstr > iterator
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
Representation of each machine instruction.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalyses & preserveSet()
Mark an analysis set as preserved.
Wrapper class representing virtual and physical registers.
constexpr bool isPhysical() const
Return true if the specified register number is in the physical register namespace.
TargetInstrInfo - Interface to description of machine instruction set.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
virtual const TargetInstrInfo * getInstrInfo() const
virtual const TargetRegisterInfo * getRegisterInfo() const =0
Return the target's register information.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI char & ExpandPostRAPseudosID
ExpandPostRAPseudos - This pass expands pseudo instructions after register allocation.
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
LLVM_ABI PreservedAnalyses getMachineFunctionPassPreservedAnalyses()
Returns the minimum set of Analyses that all machine function passes must preserve.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.