diff options
author | Sanjay Patel <spatel@rotateright.com> | 2018-04-08 19:56:04 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2018-04-08 19:56:04 +0000 |
commit | e599ceafb83f5b0f01840471d023b616fd8b6de8 (patch) | |
tree | 1bfd3ea2320ec88586ec7bca05e3ba7a5d5a8a65 | |
parent | 50cdfb85b9ab12e6684c9d581ab4b7619a4d6d16 (diff) |
[TargetSchedule] shrink interface for init(); NFCI
The TargetSchedModel is always initialized using the TargetSubtargetInfo's
MCSchedModel and TargetInstrInfo, so we don't need to extract those and
pass 3 parameters to init().
Differential Revision: https://reviews.llvm.org/D44789
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@329540 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/CodeGen/TargetSchedule.h | 3 | ||||
-rw-r--r-- | lib/CodeGen/IfConversion.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/MachineCombiner.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/MachineLICM.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/MachineTraceMetrics.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/ScheduleDAGInstrs.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/TargetSchedule.cpp | 10 | ||||
-rw-r--r-- | lib/CodeGen/TargetSubtargetInfo.cpp | 4 | ||||
-rw-r--r-- | lib/Target/AArch64/AArch64SIMDInstrOpt.cpp | 2 | ||||
-rw-r--r-- | lib/Target/AArch64/AArch64StorePairSuppress.cpp | 2 | ||||
-rw-r--r-- | lib/Target/SystemZ/SystemZMachineScheduler.cpp | 2 | ||||
-rw-r--r-- | lib/Target/X86/X86CmovConversion.cpp | 2 |
12 files changed, 16 insertions, 19 deletions
diff --git a/include/llvm/CodeGen/TargetSchedule.h b/include/llvm/CodeGen/TargetSchedule.h index 1044f0bd27e..dfff34a0f72 100644 --- a/include/llvm/CodeGen/TargetSchedule.h +++ b/include/llvm/CodeGen/TargetSchedule.h @@ -50,8 +50,7 @@ public: /// The machine model API keeps a copy of the top-level MCSchedModel table /// indices and may query TargetSubtargetInfo and TargetInstrInfo to resolve /// dynamic properties. - void init(const MCSchedModel &sm, const TargetSubtargetInfo *sti, - const TargetInstrInfo *tii); + void init(const TargetSubtargetInfo *TSInfo); /// Return the MCSchedClassDesc for this instruction. const MCSchedClassDesc *resolveSchedClass(const MachineInstr *MI) const; diff --git a/lib/CodeGen/IfConversion.cpp b/lib/CodeGen/IfConversion.cpp index a22ce0dab9c..5d9ec3708ea 100644 --- a/lib/CodeGen/IfConversion.cpp +++ b/lib/CodeGen/IfConversion.cpp @@ -347,7 +347,7 @@ bool IfConverter::runOnMachineFunction(MachineFunction &MF) { BranchFolder::MBFIWrapper MBFI(getAnalysis<MachineBlockFrequencyInfo>()); MBPI = &getAnalysis<MachineBranchProbabilityInfo>(); MRI = &MF.getRegInfo(); - SchedModel.init(ST.getSchedModel(), &ST, TII); + SchedModel.init(&ST); if (!TII) return false; diff --git a/lib/CodeGen/MachineCombiner.cpp b/lib/CodeGen/MachineCombiner.cpp index efb463f8810..498b4cb836f 100644 --- a/lib/CodeGen/MachineCombiner.cpp +++ b/lib/CodeGen/MachineCombiner.cpp @@ -633,7 +633,7 @@ bool MachineCombiner::runOnMachineFunction(MachineFunction &MF) { TII = STI->getInstrInfo(); TRI = STI->getRegisterInfo(); SchedModel = STI->getSchedModel(); - TSchedModel.init(SchedModel, STI, TII); + TSchedModel.init(STI); MRI = &MF.getRegInfo(); MLI = &getAnalysis<MachineLoopInfo>(); Traces = &getAnalysis<MachineTraceMetrics>(); diff --git a/lib/CodeGen/MachineLICM.cpp b/lib/CodeGen/MachineLICM.cpp index f5b673d89a5..ce0a1b41cc0 100644 --- a/lib/CodeGen/MachineLICM.cpp +++ b/lib/CodeGen/MachineLICM.cpp @@ -314,7 +314,7 @@ bool MachineLICMBase::runOnMachineFunction(MachineFunction &MF) { TRI = ST.getRegisterInfo(); MFI = &MF.getFrameInfo(); MRI = &MF.getRegInfo(); - SchedModel.init(ST.getSchedModel(), &ST, TII); + SchedModel.init(&ST); PreRegAlloc = MRI->isSSA(); diff --git a/lib/CodeGen/MachineTraceMetrics.cpp b/lib/CodeGen/MachineTraceMetrics.cpp index d81c6f8a31e..1de06727325 100644 --- a/lib/CodeGen/MachineTraceMetrics.cpp +++ b/lib/CodeGen/MachineTraceMetrics.cpp @@ -70,7 +70,7 @@ bool MachineTraceMetrics::runOnMachineFunction(MachineFunction &Func) { TRI = ST.getRegisterInfo(); MRI = &MF->getRegInfo(); Loops = &getAnalysis<MachineLoopInfo>(); - SchedModel.init(ST.getSchedModel(), &ST, TII); + SchedModel.init(&ST); BlockInfo.resize(MF->getNumBlockIDs()); ProcResourceCycles.resize(MF->getNumBlockIDs() * SchedModel.getNumProcResourceKinds()); diff --git a/lib/CodeGen/ScheduleDAGInstrs.cpp b/lib/CodeGen/ScheduleDAGInstrs.cpp index 0a13bc4bf98..3950bb156a4 100644 --- a/lib/CodeGen/ScheduleDAGInstrs.cpp +++ b/lib/CodeGen/ScheduleDAGInstrs.cpp @@ -118,7 +118,7 @@ ScheduleDAGInstrs::ScheduleDAGInstrs(MachineFunction &mf, DbgValues.clear(); const TargetSubtargetInfo &ST = mf.getSubtarget(); - SchedModel.init(ST.getSchedModel(), &ST, TII); + SchedModel.init(&ST); } /// If this machine instr has memory reference information and it can be diff --git a/lib/CodeGen/TargetSchedule.cpp b/lib/CodeGen/TargetSchedule.cpp index a811450c2ae..b8f284880af 100644 --- a/lib/CodeGen/TargetSchedule.cpp +++ b/lib/CodeGen/TargetSchedule.cpp @@ -61,12 +61,10 @@ static unsigned lcm(unsigned A, unsigned B) { return LCM; } -void TargetSchedModel::init(const MCSchedModel &sm, - const TargetSubtargetInfo *sti, - const TargetInstrInfo *tii) { - SchedModel = sm; - STI = sti; - TII = tii; +void TargetSchedModel::init(const TargetSubtargetInfo *TSInfo) { + STI = TSInfo; + SchedModel = TSInfo->getSchedModel(); + TII = TSInfo->getInstrInfo(); STI->initInstrItins(InstrItins); unsigned NumRes = SchedModel.getNumProcResourceKinds(); diff --git a/lib/CodeGen/TargetSubtargetInfo.cpp b/lib/CodeGen/TargetSubtargetInfo.cpp index 0d7940d767c..2b9cc64143d 100644 --- a/lib/CodeGen/TargetSubtargetInfo.cpp +++ b/lib/CodeGen/TargetSubtargetInfo.cpp @@ -88,7 +88,7 @@ std::string TargetSubtargetInfo::getSchedInfoStr(const MachineInstr &MI) const { // We don't cache TSchedModel because it depends on TargetInstrInfo // that could be changed during the compilation TargetSchedModel TSchedModel; - TSchedModel.init(getSchedModel(), this, getInstrInfo()); + TSchedModel.init(this); unsigned Latency = TSchedModel.computeInstrLatency(&MI); Optional<double> RThroughput = TSchedModel.computeInstrRThroughput(&MI); return createSchedInfoStr(Latency, RThroughput); @@ -99,7 +99,7 @@ std::string TargetSubtargetInfo::getSchedInfoStr(MCInst const &MCI) const { // We don't cache TSchedModel because it depends on TargetInstrInfo // that could be changed during the compilation TargetSchedModel TSchedModel; - TSchedModel.init(getSchedModel(), this, getInstrInfo()); + TSchedModel.init(this); unsigned Latency; if (TSchedModel.hasInstrSchedModel()) Latency = TSchedModel.computeInstrLatency(MCI.getOpcode()); diff --git a/lib/Target/AArch64/AArch64SIMDInstrOpt.cpp b/lib/Target/AArch64/AArch64SIMDInstrOpt.cpp index e1851875abc..af555f6d226 100644 --- a/lib/Target/AArch64/AArch64SIMDInstrOpt.cpp +++ b/lib/Target/AArch64/AArch64SIMDInstrOpt.cpp @@ -700,7 +700,7 @@ bool AArch64SIMDInstrOpt::runOnMachineFunction(MachineFunction &MF) { static_cast<const AArch64InstrInfo *>(ST.getInstrInfo()); if (!AAII) return false; - SchedModel.init(ST.getSchedModel(), &ST, AAII); + SchedModel.init(&ST); if (!SchedModel.hasInstrSchedModel()) return false; diff --git a/lib/Target/AArch64/AArch64StorePairSuppress.cpp b/lib/Target/AArch64/AArch64StorePairSuppress.cpp index 571e61d7083..2f7a597f3bf 100644 --- a/lib/Target/AArch64/AArch64StorePairSuppress.cpp +++ b/lib/Target/AArch64/AArch64StorePairSuppress.cpp @@ -127,7 +127,7 @@ bool AArch64StorePairSuppress::runOnMachineFunction(MachineFunction &MF) { TII = static_cast<const AArch64InstrInfo *>(ST.getInstrInfo()); TRI = ST.getRegisterInfo(); MRI = &MF.getRegInfo(); - SchedModel.init(ST.getSchedModel(), &ST, TII); + SchedModel.init(&ST); Traces = &getAnalysis<MachineTraceMetrics>(); MinInstr = nullptr; diff --git a/lib/Target/SystemZ/SystemZMachineScheduler.cpp b/lib/Target/SystemZ/SystemZMachineScheduler.cpp index cee9d8cf5f9..51e8beb085a 100644 --- a/lib/Target/SystemZ/SystemZMachineScheduler.cpp +++ b/lib/Target/SystemZ/SystemZMachineScheduler.cpp @@ -133,7 +133,7 @@ SystemZPostRASchedStrategy(const MachineSchedContext *C) (C->MF->getSubtarget().getInstrInfo())), MBB(nullptr), HazardRec(nullptr) { const TargetSubtargetInfo *ST = &C->MF->getSubtarget(); - SchedModel.init(ST->getSchedModel(), ST, TII); + SchedModel.init(ST); } SystemZPostRASchedStrategy::~SystemZPostRASchedStrategy() { diff --git a/lib/Target/X86/X86CmovConversion.cpp b/lib/Target/X86/X86CmovConversion.cpp index 489d9d86e25..493d42c85b4 100644 --- a/lib/Target/X86/X86CmovConversion.cpp +++ b/lib/Target/X86/X86CmovConversion.cpp @@ -178,7 +178,7 @@ bool X86CmovConverterPass::runOnMachineFunction(MachineFunction &MF) { MRI = &MF.getRegInfo(); TII = STI.getInstrInfo(); TRI = STI.getRegisterInfo(); - TSchedModel.init(STI.getSchedModel(), &STI, TII); + TSchedModel.init(&STI); // Before we handle the more subtle cases of register-register CMOVs inside // of potentially hot loops, we want to quickly remove all CMOVs with |