Remove the storage and use of the subtarget out of the sparc frame

lowering code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211809 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher 2014-06-26 22:33:50 +00:00
parent 3259c25b3a
commit d66d1a66c4
2 changed files with 11 additions and 9 deletions

View File

@ -14,6 +14,7 @@
#include "SparcFrameLowering.h" #include "SparcFrameLowering.h"
#include "SparcInstrInfo.h" #include "SparcInstrInfo.h"
#include "SparcMachineFunctionInfo.h" #include "SparcMachineFunctionInfo.h"
#include "SparcSubtarget.h"
#include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineInstrBuilder.h"
@ -32,6 +33,9 @@ DisableLeafProc("disable-sparc-leaf-proc",
cl::desc("Disable Sparc leaf procedure optimization."), cl::desc("Disable Sparc leaf procedure optimization."),
cl::Hidden); cl::Hidden);
SparcFrameLowering::SparcFrameLowering(const SparcSubtarget &ST)
: TargetFrameLowering(TargetFrameLowering::StackGrowsDown,
ST.is64Bit() ? 16 : 8, 0, ST.is64Bit() ? 16 : 8) {}
void SparcFrameLowering::emitSPAdjustment(MachineFunction &MF, void SparcFrameLowering::emitSPAdjustment(MachineFunction &MF,
MachineBasicBlock &MBB, MachineBasicBlock &MBB,
@ -99,7 +103,9 @@ void SparcFrameLowering::emitPrologue(MachineFunction &MF) const {
SAVEri = SP::ADDri; SAVEri = SP::ADDri;
SAVErr = SP::ADDrr; SAVErr = SP::ADDrr;
} }
NumBytes = - SubTarget.getAdjustedFrameSize(NumBytes); NumBytes =
-MF.getTarget().getSubtarget<SparcSubtarget>().getAdjustedFrameSize(
NumBytes);
emitSPAdjustment(MF, MBB, MBBI, NumBytes, SAVErr, SAVEri); emitSPAdjustment(MF, MBB, MBBI, NumBytes, SAVErr, SAVEri);
MachineModuleInfo &MMI = MF.getMMI(); MachineModuleInfo &MMI = MF.getMMI();
@ -162,7 +168,8 @@ void SparcFrameLowering::emitEpilogue(MachineFunction &MF,
if (NumBytes == 0) if (NumBytes == 0)
return; return;
NumBytes = SubTarget.getAdjustedFrameSize(NumBytes); NumBytes = MF.getTarget().getSubtarget<SparcSubtarget>().getAdjustedFrameSize(
NumBytes);
emitSPAdjustment(MF, MBB, MBBI, NumBytes, SP::ADDrr, SP::ADDri); emitSPAdjustment(MF, MBB, MBBI, NumBytes, SP::ADDrr, SP::ADDri);
} }

View File

@ -15,19 +15,14 @@
#define SPARC_FRAMEINFO_H #define SPARC_FRAMEINFO_H
#include "Sparc.h" #include "Sparc.h"
#include "SparcSubtarget.h"
#include "llvm/Target/TargetFrameLowering.h" #include "llvm/Target/TargetFrameLowering.h"
namespace llvm { namespace llvm {
class SparcSubtarget;
class SparcSubtarget;
class SparcFrameLowering : public TargetFrameLowering { class SparcFrameLowering : public TargetFrameLowering {
const SparcSubtarget &SubTarget;
public: public:
explicit SparcFrameLowering(const SparcSubtarget &ST) explicit SparcFrameLowering(const SparcSubtarget &ST);
: TargetFrameLowering(TargetFrameLowering::StackGrowsDown,
ST.is64Bit() ? 16 : 8, 0, ST.is64Bit() ? 16 : 8),
SubTarget(ST) {}
/// emitProlog/emitEpilog - These methods insert prolog and epilog code into /// emitProlog/emitEpilog - These methods insert prolog and epilog code into
/// the function. /// the function.