FrameLowering depends only upon the Subtarget, so only take a subtarget

during initialization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213429 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher 2014-07-18 23:33:47 +00:00
parent d644d17dd4
commit 0ce4f580bc
3 changed files with 6 additions and 8 deletions

View File

@ -82,9 +82,8 @@ using namespace llvm;
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
const MipsFrameLowering *MipsFrameLowering::create(MipsTargetMachine &TM, const MipsFrameLowering *MipsFrameLowering::create(const MipsSubtarget &ST) {
const MipsSubtarget &ST) { if (ST.inMips16Mode())
if (TM.getSubtargetImpl()->inMips16Mode())
return llvm::createMips16FrameLowering(ST); return llvm::createMips16FrameLowering(ST);
return llvm::createMipsSEFrameLowering(ST); return llvm::createMipsSEFrameLowering(ST);

View File

@ -28,8 +28,7 @@ public:
explicit MipsFrameLowering(const MipsSubtarget &sti, unsigned Alignment) explicit MipsFrameLowering(const MipsSubtarget &sti, unsigned Alignment)
: TargetFrameLowering(StackGrowsDown, Alignment, 0, Alignment), STI(sti) {} : TargetFrameLowering(StackGrowsDown, Alignment, 0, Alignment), STI(sti) {}
static const MipsFrameLowering *create(MipsTargetMachine &TM, static const MipsFrameLowering *create(const MipsSubtarget &ST);
const MipsSubtarget &ST);
bool hasFP(const MachineFunction &MF) const override; bool hasFP(const MachineFunction &MF) const override;

View File

@ -116,7 +116,7 @@ MipsSubtarget::MipsSubtarget(const std::string &TT, const std::string &CPU,
HasMSA(false), OverrideMode(NoOverride), TM(_TM), TargetTriple(TT), HasMSA(false), OverrideMode(NoOverride), TM(_TM), TargetTriple(TT),
DL(computeDataLayout(initializeSubtargetDependencies(CPU, FS, TM))), DL(computeDataLayout(initializeSubtargetDependencies(CPU, FS, TM))),
TSInfo(DL), JITInfo(), InstrInfo(MipsInstrInfo::create(*this)), TSInfo(DL), JITInfo(), InstrInfo(MipsInstrInfo::create(*this)),
FrameLowering(MipsFrameLowering::create(*TM, *this)), FrameLowering(MipsFrameLowering::create(*this)),
TLInfo(MipsTargetLowering::create(*TM, *this)) { TLInfo(MipsTargetLowering::create(*TM, *this)) {
PreviousInMips16Mode = InMips16Mode; PreviousInMips16Mode = InMips16Mode;
@ -255,7 +255,7 @@ void MipsSubtarget::setHelperClassesMips16() {
TLInfoSE.swap(TLInfo); TLInfoSE.swap(TLInfo);
if (!InstrInfo16) { if (!InstrInfo16) {
InstrInfo.reset(MipsInstrInfo::create(*this)); InstrInfo.reset(MipsInstrInfo::create(*this));
FrameLowering.reset(MipsFrameLowering::create(*TM, *this)); FrameLowering.reset(MipsFrameLowering::create(*this));
TLInfo.reset(MipsTargetLowering::create(*TM, *this)); TLInfo.reset(MipsTargetLowering::create(*TM, *this));
} else { } else {
InstrInfo16.swap(InstrInfo); InstrInfo16.swap(InstrInfo);
@ -273,7 +273,7 @@ void MipsSubtarget::setHelperClassesMipsSE() {
TLInfo16.swap(TLInfo); TLInfo16.swap(TLInfo);
if (!InstrInfoSE) { if (!InstrInfoSE) {
InstrInfo.reset(MipsInstrInfo::create(*this)); InstrInfo.reset(MipsInstrInfo::create(*this));
FrameLowering.reset(MipsFrameLowering::create(*TM, *this)); FrameLowering.reset(MipsFrameLowering::create(*this));
TLInfo.reset(MipsTargetLowering::create(*TM, *this)); TLInfo.reset(MipsTargetLowering::create(*TM, *this));
} else { } else {
InstrInfoSE.swap(InstrInfo); InstrInfoSE.swap(InstrInfo);