Go to the documentation of this file.
24 #define DEBUG_TYPE "delay-slot-filler"
26 STATISTIC(FilledSlots,
"Number of delay slots filled");
30 cl::desc(
"Fill Lanai delay slots with NOPs."),
44 StringRef getPassName()
const override {
return "Lanai Delay Slot Filler"; }
55 Changed |= runOnMachineBasicBlock(
MBB);
96 if (
I->getDesc().hasDelaySlot()) {
107 assert(RI->getOpcode() == Lanai::LDW_RI && RI->getOperand(0).isReg() &&
108 RI->getOperand(0).getReg() == Lanai::FP &&
109 RI->getOperand(1).isReg() &&
110 RI->getOperand(1).getReg() == Lanai::FP &&
111 RI->getOperand(2).isImm() && RI->getOperand(2).getImm() == -8);
113 assert(RI->getOpcode() == Lanai::ADD_I_LO &&
114 RI->getOperand(0).isReg() &&
115 RI->getOperand(0).getReg() == Lanai::SP &&
116 RI->getOperand(1).isReg() &&
117 RI->getOperand(1).getReg() == Lanai::FP);
149 insertDefsUses(Slot, RegDefs, RegUses);
151 bool SawLoad =
false;
152 bool SawStore =
false;
157 if (
I->isDebugInstr())
163 if (
I->hasUnmodeledSideEffects() ||
I->isInlineAsm() ||
I->isLabel() ||
164 FI == LastFiller ||
I->isPseudo())
167 if (delayHasHazard(FI, SawLoad, SawStore, RegDefs, RegUses)) {
168 insertDefsUses(FI, RegDefs, RegUses);
180 if (
MI->isImplicitDef() ||
MI->isKill())
191 if (
MI->mayStore()) {
200 "Cannot put calls or returns in delay slot.");
205 if (!MO.isReg() || !(
Reg = MO.getReg()))
210 if (isRegInSet(RegDefs,
Reg) || isRegInSet(RegUses,
Reg))
215 if (isRegInSet(RegDefs,
Reg))
229 :
MI->getNumOperands();
230 for (
unsigned I = 0;
I !=
E; ++
I) {
248 if (
MI->isCall() ||
MI->isReturn())
249 RegDefs.
insert(Lanai::SP);
256 if (RegSet.
count(*AI))
FunctionPass * createLanaiDelaySlotFillerPass(const LanaiTargetMachine &TM)
This is an optimization pass for GlobalISel generic memory operations.
static cl::opt< bool > NopDelaySlotFiller("lanai-nop-delay-filler", cl::init(false), cl::desc("Fill Lanai delay slots with NOPs."), cl::Hidden)
Reg
All possible values of the reg field in the ModR/M byte.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
Properties which a MachineFunction may have at a given point in time.
unsigned const TargetRegisterInfo * TRI
TargetInstrInfo - Interface to description of machine instruction set.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
const HexagonInstrInfo * TII
Describe properties that are true of each instruction in the target description file.
MachineOperand class - Representation of each machine instruction operand.
MachineFunctionProperties & set(Property P)
STATISTIC(NumFunctions, "Total number of functions")
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
size_type count(const T &V) const
count - Return 1 if the element is in the set, 0 otherwise.
reverse_instr_iterator instr_rend()
bool isReg() const
isReg - Tests if this is a MO_Register operand.
initializer< Ty > init(const Ty &Val)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Register getReg() const
getReg - Returns the register number.
instr_iterator instr_begin()
instr_iterator instr_end()
StringRef - Represent a constant reference to a string, i.e.
void splice(iterator Where, MachineBasicBlock *Other, iterator From)
Take an instruction from MBB 'Other' at the position From, and insert it into this MBB right before '...
Helper class for constructing bundles of MachineInstrs.
std::pair< NoneType, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
const LanaiRegisterInfo * getRegisterInfo() const override
Iterator for intrusive lists based on ilist_node.
const LanaiInstrInfo * getInstrInfo() const override
ilist_iterator< OptionsT, !IsReverse, IsConst > getReverse() const
Get a reverse iterator to the same node.
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
FunctionPass class - This class is used to implement most global optimizations.
unsigned getNumOperands() const
Return the number of declared MachineOperands for this MachineInstruction.
MCRegAliasIterator enumerates all registers aliasing Reg.