X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTarget%2FAArch64%2FAArch64StorePairSuppress.cpp;h=1c6b15790ea98515e9c7caa5c98ce24fad6dfeeb;hb=1af10ebe4d42672a5ef8cb2e8c7af16589ffc0b5;hp=b09ecb74a71cc7f4c440daed1f546cbee5bfc2db;hpb=9f85dccfc64b5f0b0c63ddfa0a42d8615aa1fcb3;p=oota-llvm.git diff --git a/lib/Target/AArch64/AArch64StorePairSuppress.cpp b/lib/Target/AArch64/AArch64StorePairSuppress.cpp index b09ecb74a71..1c6b15790ea 100644 --- a/lib/Target/AArch64/AArch64StorePairSuppress.cpp +++ b/lib/Target/AArch64/AArch64StorePairSuppress.cpp @@ -30,7 +30,6 @@ class AArch64StorePairSuppress : public MachineFunctionPass { const AArch64InstrInfo *TII; const TargetRegisterInfo *TRI; const MachineRegisterInfo *MRI; - MachineFunction *MF; TargetSchedModel SchedModel; MachineTraceMetrics *Traces; MachineTraceMetrics::Ensemble *MinInstr; @@ -39,7 +38,7 @@ public: static char ID; AArch64StorePairSuppress() : MachineFunctionPass(ID) {} - virtual const char *getPassName() const override { + const char *getPassName() const override { return "AArch64 Store Pair Suppression"; } @@ -50,7 +49,7 @@ private: bool isNarrowFPStore(const MachineInstr &MI); - virtual void getAnalysisUsage(AnalysisUsage &AU) const override { + void getAnalysisUsage(AnalysisUsage &AU) const override { AU.setPreservesCFG(); AU.addRequired(); AU.addPreserved(); @@ -85,8 +84,7 @@ bool AArch64StorePairSuppress::shouldAddSTPToBlock(const MachineBasicBlock *BB) // If a subtarget does not define resources for STPQi, bail here. if (SCDesc->isValid() && !SCDesc->isVariant()) { - unsigned ResLenWithSTP = BBTrace.getResourceLength( - ArrayRef(), SCDesc); + unsigned ResLenWithSTP = BBTrace.getResourceLength(None, SCDesc); if (ResLenWithSTP > ResLength) { DEBUG(dbgs() << " Suppress STP in BB: " << BB->getNumber() << " resources " << ResLength << " -> " << ResLenWithSTP @@ -116,20 +114,16 @@ bool AArch64StorePairSuppress::isNarrowFPStore(const MachineInstr &MI) { } } -bool AArch64StorePairSuppress::runOnMachineFunction(MachineFunction &mf) { - MF = &mf; - TII = static_cast( - MF->getTarget().getSubtargetImpl()->getInstrInfo()); - TRI = MF->getTarget().getSubtargetImpl()->getRegisterInfo(); - MRI = &MF->getRegInfo(); - const TargetSubtargetInfo &ST = - MF->getTarget().getSubtarget(); - SchedModel.init(*ST.getSchedModel(), &ST, TII); - +bool AArch64StorePairSuppress::runOnMachineFunction(MachineFunction &MF) { + const TargetSubtargetInfo &ST = MF.getSubtarget(); + TII = static_cast(ST.getInstrInfo()); + TRI = ST.getRegisterInfo(); + MRI = &MF.getRegInfo(); + SchedModel.init(ST.getSchedModel(), &ST, TII); Traces = &getAnalysis(); MinInstr = nullptr; - DEBUG(dbgs() << "*** " << getPassName() << ": " << MF->getName() << '\n'); + DEBUG(dbgs() << "*** " << getPassName() << ": " << MF.getName() << '\n'); if (!SchedModel.hasInstrSchedModel()) { DEBUG(dbgs() << " Skipping pass: no machine model present.\n"); @@ -140,7 +134,7 @@ bool AArch64StorePairSuppress::runOnMachineFunction(MachineFunction &mf) { // precisely determine whether a store pair can be formed. But we do want to // filter out most situations where we can't form store pairs to avoid // computing trace metrics in those cases. - for (auto &MBB : *MF) { + for (auto &MBB : MF) { bool SuppressSTP = false; unsigned PrevBaseReg = 0; for (auto &MI : MBB) { @@ -148,7 +142,7 @@ bool AArch64StorePairSuppress::runOnMachineFunction(MachineFunction &mf) { continue; unsigned BaseReg; unsigned Offset; - if (TII->getLdStBaseRegImmOfs(&MI, BaseReg, Offset, TRI)) { + if (TII->getMemOpBaseRegImmOfs(&MI, BaseReg, Offset, TRI)) { if (PrevBaseReg == BaseReg) { // If this block can take STPs, skip ahead to the next block. if (!SuppressSTP && shouldAddSTPToBlock(MI.getParent()))