26 #define DEBUG_TYPE "aarch64-stp-suppress"
41 const char *getPassName()
const override {
42 return "AArch64 Store Pair Suppression";
63 return new AArch64StorePairSuppress();
81 unsigned SCIdx =
TII->get(AArch64::STPDi).getSchedClass();
83 SchedModel.getMCSchedModel()->getSchedClassDesc(SCIdx);
88 if (ResLenWithSTP > ResLength) {
90 <<
" resources " << ResLength <<
" -> " << ResLenWithSTP
105 bool AArch64StorePairSuppress::isNarrowFPStore(
const MachineInstr &
MI) {
109 case AArch64::STRSui:
110 case AArch64::STRDui:
111 case AArch64::STURSi:
112 case AArch64::STURDi:
117 bool AArch64StorePairSuppress::runOnMachineFunction(
MachineFunction &MF) {
123 Traces = &getAnalysis<MachineTraceMetrics>();
128 if (!SchedModel.hasInstrSchedModel()) {
129 DEBUG(
dbgs() <<
" Skipping pass: no machine model present.\n");
137 for (
auto &MBB : MF) {
138 bool SuppressSTP =
false;
139 unsigned PrevBaseReg = 0;
140 for (
auto &MI : MBB) {
141 if (!isNarrowFPStore(MI))
145 if (
TII->getMemOpBaseRegImmOfs(&MI, BaseReg, Offset, TRI)) {
146 if (PrevBaseReg == BaseReg) {
148 if (!SuppressSTP && shouldAddSTPToBlock(MI.
getParent()))
151 DEBUG(
dbgs() <<
"Unpairing store " << MI <<
"\n");
153 TII->suppressLdStPair(&MI);
155 PrevBaseReg = BaseReg;
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
int getNumber() const
getNumber - MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a M...
A trace ensemble is a collection of traces selected using the same strategy, for example 'minimum res...
AnalysisUsage & addRequired()
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...
Provide an instruction scheduling machine model to CodeGen passes.
const HexagonInstrInfo * TII
const MCSchedModel & getSchedModel() const
Get the machine model for this subtarget's CPU.
Select the trace through a block that has the fewest instructions.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
const MachineBasicBlock * getParent() const
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...
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.
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...
void setPreservesCFG()
This function should be called by the pass, iff they do not:
FunctionPass * createAArch64StorePairSuppressPass()
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
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.
virtual const TargetInstrInfo * getInstrInfo() const
virtual const TargetRegisterInfo * getRegisterInfo() const
getRegisterInfo - If register information is available, return it.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.