26#define DEBUG_TYPE "aarch64-stp-suppress"
28#define STPSUPPRESS_PASS_NAME "AArch64 Store Pair Suppression"
59char AArch64StorePairSuppress::ID = 0;
66 return new AArch64StorePairSuppress();
77 MinInstr = Traces->
getEnsemble(MachineTraceStrategy::TS_MinInstrCount);
84 unsigned SCIdx =
TII->get(AArch64::STPDi).getSchedClass();
85 const MCSchedClassDesc *PairSCDesc =
88 unsigned SCIdx2 =
TII->get(AArch64::STRDui).getSchedClass();
89 const MCSchedClassDesc *SingleSCDesc =
97 unsigned ResLenWithSTP =
99 if (ResLenWithSTP > ResLength) {
101 <<
" resources " << ResLength <<
" -> " << ResLenWithSTP
116bool AArch64StorePairSuppress::isNarrowFPStore(
const MachineInstr &
MI) {
117 switch (
MI.getOpcode()) {
120 case AArch64::STRSui:
121 case AArch64::STRDui:
122 case AArch64::STURSi:
123 case AArch64::STURDi:
128bool AArch64StorePairSuppress::runOnMachineFunction(MachineFunction &MF) {
133 if (!
ST.enableStorePairSuppress())
136 TII =
ST.getInstrInfo();
137 TRI =
ST.getRegisterInfo();
139 SchedModel.
init(&ST);
140 Traces = &getAnalysis<MachineTraceMetricsWrapperPass>().getMTM();
146 LLVM_DEBUG(
dbgs() <<
" Skipping pass: no machine model present.\n");
154 for (
auto &
MBB : MF) {
155 bool SuppressSTP =
false;
156 unsigned PrevBaseReg = 0;
157 for (
auto &
MI :
MBB) {
158 if (!isNarrowFPStore(
MI))
160 const MachineOperand *BaseOp;
162 bool OffsetIsScalable;
163 if (
TII->getMemOperandWithOffset(
MI, BaseOp,
Offset, OffsetIsScalable,
167 if (PrevBaseReg == BaseReg) {
169 if (!SuppressSTP && shouldAddSTPToBlock(
MI.getParent()))
174 TII->suppressLdStPair(
MI);
unsigned const MachineRegisterInfo * MRI
#define STPSUPPRESS_PASS_NAME
const HexagonInstrInfo * TII
Register const TargetRegisterInfo * TRI
Promote Memory to Register
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Represent the analysis usage information of a pass.
AnalysisUsage & addRequired()
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
LLVM_ABI void setPreservesCFG()
This function should be called by the pass, iff they do not:
FunctionPass class - This class is used to implement most global optimizations.
bool hasOptSize() const
Optimize this function for size (-Os) or minimum size (-Oz).
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
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.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Function & getFunction()
Return the LLVM function that this machine code represents.
Representation of each machine instruction.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
Register getReg() const
getReg - Returns the register number.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
A trace ensemble is a collection of traces selected using the same strategy, for example 'minimum res...
Trace getTrace(const MachineBasicBlock *MBB)
Get the trace that passes through MBB.
unsigned getResourceLength(ArrayRef< const MachineBasicBlock * > Extrablocks={}, ArrayRef< const MCSchedClassDesc * > ExtraInstrs={}, ArrayRef< const MCSchedClassDesc * > RemoveInstrs={}) const
Return the resource length of the trace.
Ensemble * getEnsemble(MachineTraceStrategy)
Get the trace ensemble representing the given trace selection strategy.
StringRef - Represent a constant reference to a string, i.e.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Provide an instruction scheduling machine model to CodeGen passes.
const MCSchedModel * getMCSchedModel() const
LLVM_ABI bool hasInstrSchedModel() const
Return true if this machine model includes an instruction-level scheduling model.
LLVM_ABI void init(const TargetSubtargetInfo *TSInfo, bool EnableSModel=true, bool EnableSItins=true)
Initialize the machine model for instruction scheduling.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
BaseReg
Stack frame base register. Bit 0 of FREInfo.Info.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
FunctionPass * createAArch64StorePairSuppressPass()
const MCSchedClassDesc * getSchedClassDesc(unsigned SchedClassIdx) const