Index: llvm/trunk/include/llvm/CodeGen/TargetSchedule.h =================================================================== --- llvm/trunk/include/llvm/CodeGen/TargetSchedule.h +++ llvm/trunk/include/llvm/CodeGen/TargetSchedule.h @@ -50,8 +50,7 @@ /// 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; Index: llvm/trunk/lib/CodeGen/IfConversion.cpp =================================================================== --- llvm/trunk/lib/CodeGen/IfConversion.cpp +++ llvm/trunk/lib/CodeGen/IfConversion.cpp @@ -347,7 +347,7 @@ BranchFolder::MBFIWrapper MBFI(getAnalysis()); MBPI = &getAnalysis(); MRI = &MF.getRegInfo(); - SchedModel.init(ST.getSchedModel(), &ST, TII); + SchedModel.init(&ST); if (!TII) return false; Index: llvm/trunk/lib/CodeGen/MachineCombiner.cpp =================================================================== --- llvm/trunk/lib/CodeGen/MachineCombiner.cpp +++ llvm/trunk/lib/CodeGen/MachineCombiner.cpp @@ -633,7 +633,7 @@ TII = STI->getInstrInfo(); TRI = STI->getRegisterInfo(); SchedModel = STI->getSchedModel(); - TSchedModel.init(SchedModel, STI, TII); + TSchedModel.init(STI); MRI = &MF.getRegInfo(); MLI = &getAnalysis(); Traces = &getAnalysis(); Index: llvm/trunk/lib/CodeGen/MachineLICM.cpp =================================================================== --- llvm/trunk/lib/CodeGen/MachineLICM.cpp +++ llvm/trunk/lib/CodeGen/MachineLICM.cpp @@ -314,7 +314,7 @@ TRI = ST.getRegisterInfo(); MFI = &MF.getFrameInfo(); MRI = &MF.getRegInfo(); - SchedModel.init(ST.getSchedModel(), &ST, TII); + SchedModel.init(&ST); PreRegAlloc = MRI->isSSA(); Index: llvm/trunk/lib/CodeGen/MachineTraceMetrics.cpp =================================================================== --- llvm/trunk/lib/CodeGen/MachineTraceMetrics.cpp +++ llvm/trunk/lib/CodeGen/MachineTraceMetrics.cpp @@ -70,7 +70,7 @@ TRI = ST.getRegisterInfo(); MRI = &MF->getRegInfo(); Loops = &getAnalysis(); - SchedModel.init(ST.getSchedModel(), &ST, TII); + SchedModel.init(&ST); BlockInfo.resize(MF->getNumBlockIDs()); ProcResourceCycles.resize(MF->getNumBlockIDs() * SchedModel.getNumProcResourceKinds()); Index: llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp =================================================================== --- llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp +++ llvm/trunk/lib/CodeGen/ScheduleDAGInstrs.cpp @@ -118,7 +118,7 @@ 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 Index: llvm/trunk/lib/CodeGen/TargetSchedule.cpp =================================================================== --- llvm/trunk/lib/CodeGen/TargetSchedule.cpp +++ llvm/trunk/lib/CodeGen/TargetSchedule.cpp @@ -61,12 +61,10 @@ 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(); Index: llvm/trunk/lib/CodeGen/TargetSubtargetInfo.cpp =================================================================== --- llvm/trunk/lib/CodeGen/TargetSubtargetInfo.cpp +++ llvm/trunk/lib/CodeGen/TargetSubtargetInfo.cpp @@ -88,7 +88,7 @@ // 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 RThroughput = TSchedModel.computeInstrRThroughput(&MI); return createSchedInfoStr(Latency, RThroughput); @@ -99,7 +99,7 @@ // 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()); Index: llvm/trunk/lib/Target/AArch64/AArch64SIMDInstrOpt.cpp =================================================================== --- llvm/trunk/lib/Target/AArch64/AArch64SIMDInstrOpt.cpp +++ llvm/trunk/lib/Target/AArch64/AArch64SIMDInstrOpt.cpp @@ -700,7 +700,7 @@ static_cast(ST.getInstrInfo()); if (!AAII) return false; - SchedModel.init(ST.getSchedModel(), &ST, AAII); + SchedModel.init(&ST); if (!SchedModel.hasInstrSchedModel()) return false; Index: llvm/trunk/lib/Target/AArch64/AArch64StorePairSuppress.cpp =================================================================== --- llvm/trunk/lib/Target/AArch64/AArch64StorePairSuppress.cpp +++ llvm/trunk/lib/Target/AArch64/AArch64StorePairSuppress.cpp @@ -127,7 +127,7 @@ TII = static_cast(ST.getInstrInfo()); TRI = ST.getRegisterInfo(); MRI = &MF.getRegInfo(); - SchedModel.init(ST.getSchedModel(), &ST, TII); + SchedModel.init(&ST); Traces = &getAnalysis(); MinInstr = nullptr; Index: llvm/trunk/lib/Target/SystemZ/SystemZMachineScheduler.cpp =================================================================== --- llvm/trunk/lib/Target/SystemZ/SystemZMachineScheduler.cpp +++ llvm/trunk/lib/Target/SystemZ/SystemZMachineScheduler.cpp @@ -133,7 +133,7 @@ (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() { Index: llvm/trunk/lib/Target/X86/X86CmovConversion.cpp =================================================================== --- llvm/trunk/lib/Target/X86/X86CmovConversion.cpp +++ llvm/trunk/lib/Target/X86/X86CmovConversion.cpp @@ -178,7 +178,7 @@ 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