summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2018-04-13 15:09:39 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2018-04-13 15:09:39 +0000
commita3a9d8123180808770599410e4220a448637f82b (patch)
tree7d4f0ec1c7a4b4682bf3de01380fd91def179ed3 /llvm/lib/Target
parent5b63803d1f4b184e2e90a4b23e42fe1bf76c1b15 (diff)
downloadbcm5719-llvm-a3a9d8123180808770599410e4220a448637f82b.tar.gz
bcm5719-llvm-a3a9d8123180808770599410e4220a448637f82b.zip
[X86] Generalize X86FixupLEAs to work with TargetSchedModel
Similar to rL329834, don't rely on itinerary scheduler model to determine latencies for LEA thresholds, use the generic TargetSchedModel::computeInstrLatency call. llvm-svn: 330030
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/X86/X86FixupLEAs.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Target/X86/X86FixupLEAs.cpp b/llvm/lib/Target/X86/X86FixupLEAs.cpp
index 64678c062ee..d635c1e8574 100644
--- a/llvm/lib/Target/X86/X86FixupLEAs.cpp
+++ b/llvm/lib/Target/X86/X86FixupLEAs.cpp
@@ -20,7 +20,7 @@
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/Passes.h"
-#include "llvm/CodeGen/TargetInstrInfo.h"
+#include "llvm/CodeGen/TargetSchedule.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
@@ -125,6 +125,7 @@ public:
}
private:
+ TargetSchedModel TSM;
MachineFunction *MF;
const X86InstrInfo *TII; // Machine instruction info.
bool OptIncDec;
@@ -202,6 +203,7 @@ bool FixupLEAPass::runOnMachineFunction(MachineFunction &Func) {
if (!OptLEA && !OptIncDec)
return false;
+ TSM.init(&Func.getSubtarget());
TII = ST.getInstrInfo();
DEBUG(dbgs() << "Start X86FixupLEAs\n";);
@@ -264,8 +266,7 @@ FixupLEAPass::searchBackwards(MachineOperand &p, MachineBasicBlock::iterator &I,
if (usesRegister(p, CurInst) == RU_Write) {
return CurInst;
}
- InstrDistance += TII->getInstrLatency(
- MF->getSubtarget().getInstrItineraryData(), *CurInst);
+ InstrDistance += TSM.computeInstrLatency(&*CurInst);
Found = getPreviousInstr(CurInst, MFI);
}
return MachineBasicBlock::iterator();
OpenPOWER on IntegriCloud