26 #define DEBUG_TYPE "aarch64-stp-suppress" 28 #define STPSUPPRESS_PASS_NAME "AArch64 Store Pair Suppression" 68 return new AArch64StorePairSuppress();
86 unsigned SCIdx =
TII->get(AArch64::STPDi).getSchedClass();
88 SchedModel.getMCSchedModel()->getSchedClassDesc(SCIdx);
93 if (ResLenWithSTP > ResLength) {
95 <<
" resources " << ResLength <<
" -> " << ResLenWithSTP
110 bool AArch64StorePairSuppress::isNarrowFPStore(
const MachineInstr &
MI) {
114 case AArch64::STRSui:
115 case AArch64::STRDui:
116 case AArch64::STURSi:
117 case AArch64::STURDi:
122 bool AArch64StorePairSuppress::runOnMachineFunction(
MachineFunction &MF) {
130 SchedModel.init(&ST);
131 Traces = &getAnalysis<MachineTraceMetrics>();
136 if (!SchedModel.hasInstrSchedModel()) {
137 LLVM_DEBUG(
dbgs() <<
" Skipping pass: no machine model present.\n");
145 for (
auto &MBB : MF) {
146 bool SuppressSTP =
false;
147 unsigned PrevBaseReg = 0;
148 for (
auto &MI : MBB) {
149 if (!isNarrowFPStore(MI))
155 unsigned BaseReg = BaseOp->
getReg();
156 if (PrevBaseReg == BaseReg) {
158 if (!SuppressSTP && shouldAddSTPToBlock(MI.
getParent()))
163 TII->suppressLdStPair(MI);
165 PrevBaseReg = BaseReg;
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
This class represents lattice values for constants.
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
unsigned getReg() const
getReg - Returns the register number.
unsigned const TargetRegisterInfo * TRI
A trace ensemble is a collection of traces selected using the same strategy, for example 'minimum res...
AnalysisUsage & addRequired()
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
Provide an instruction scheduling machine model to CodeGen passes.
const HexagonInstrInfo * TII
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
Select the trace through a block that has the fewest instructions.
#define STPSUPPRESS_PASS_NAME
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
virtual const TargetInstrInfo * getInstrInfo() const
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
INITIALIZE_PASS(AArch64StorePairSuppress, "aarch64-stp-suppress", STPSUPPRESS_PASS_NAME, false, false) FunctionPass *llvm
unsigned const MachineRegisterInfo * MRI
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
Summarize the scheduling resources required for an instruction of a particular scheduling class...
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
A trace represents a plausible sequence of executed basic blocks that passes through the current basi...
MachineOperand class - Representation of each machine instruction operand.
void setPreservesCFG()
This function should be called by the pass, iff they do not:
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.
bool getMemOperandWithOffset(MachineInstr &LdSt, MachineOperand *&BaseOp, int64_t &Offset, const TargetRegisterInfo *TRI) const override
Get the base register and byte offset of a load/store instr.
const MachineBasicBlock * getParent() const
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
TargetSubtargetInfo - Generic base class for all target subtargets.
Representation of each machine instruction.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
FunctionPass * createAArch64StorePairSuppressPass()
bool isReg() const
isReg - Tests if this is a MO_Register operand.
unsigned getResourceLength(ArrayRef< const MachineBasicBlock *> Extrablocks=None, ArrayRef< const MCSchedClassDesc *> ExtraInstrs=None, ArrayRef< const MCSchedClassDesc *> RemoveInstrs=None) const
Return the resource length of the trace.
StringRef - Represent a constant reference to a string, i.e.
void initializeAArch64StorePairSuppressPass(PassRegistry &)