Remove the use and initialization of the target machine and subtarget

from SystemZFrameLowering.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212123 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Christopher
2014-07-01 20:18:59 +00:00
parent f652ec594e
commit 389c2dd3ac
3 changed files with 19 additions and 29 deletions

View File

@@ -10,8 +10,9 @@
#include "SystemZFrameLowering.h" #include "SystemZFrameLowering.h"
#include "SystemZCallingConv.h" #include "SystemZCallingConv.h"
#include "SystemZInstrBuilder.h" #include "SystemZInstrBuilder.h"
#include "SystemZInstrInfo.h"
#include "SystemZMachineFunctionInfo.h" #include "SystemZMachineFunctionInfo.h"
#include "SystemZTargetMachine.h" #include "SystemZRegisterInfo.h"
#include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/RegisterScavenging.h" #include "llvm/CodeGen/RegisterScavenging.h"
@@ -44,11 +45,9 @@ static const TargetFrameLowering::SpillSlot SpillOffsetTable[] = {
}; };
} // end anonymous namespace } // end anonymous namespace
SystemZFrameLowering::SystemZFrameLowering(const SystemZTargetMachine &tm, SystemZFrameLowering::SystemZFrameLowering()
const SystemZSubtarget &sti) : TargetFrameLowering(TargetFrameLowering::StackGrowsDown, 8,
: TargetFrameLowering(TargetFrameLowering::StackGrowsDown, 8, -SystemZMC::CallFrameSize, 8) {
-SystemZMC::CallFrameSize, 8),
TM(tm), STI(sti) {
// Create a mapping from register number to save slot offset. // Create a mapping from register number to save slot offset.
RegSpillOffsets.grow(SystemZ::NUM_TARGET_REGS); RegSpillOffsets.grow(SystemZ::NUM_TARGET_REGS);
for (unsigned I = 0, E = array_lengthof(SpillOffsetTable); I != E; ++I) for (unsigned I = 0, E = array_lengthof(SpillOffsetTable); I != E; ++I)
@@ -108,9 +107,8 @@ processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
// instruction, or an implicit one that comes between the explicit start // instruction, or an implicit one that comes between the explicit start
// and end registers. // and end registers.
static void addSavedGPR(MachineBasicBlock &MBB, MachineInstrBuilder &MIB, static void addSavedGPR(MachineBasicBlock &MBB, MachineInstrBuilder &MIB,
const SystemZTargetMachine &TM,
unsigned GPR64, bool IsImplicit) { unsigned GPR64, bool IsImplicit) {
const SystemZRegisterInfo *RI = TM.getRegisterInfo(); const TargetRegisterInfo *RI = MBB.getParent()->getTarget().getRegisterInfo();
unsigned GPR32 = RI->getSubReg(GPR64, SystemZ::subreg_l32); unsigned GPR32 = RI->getSubReg(GPR64, SystemZ::subreg_l32);
bool IsLive = MBB.isLiveIn(GPR64) || MBB.isLiveIn(GPR32); bool IsLive = MBB.isLiveIn(GPR64) || MBB.isLiveIn(GPR32);
if (!IsLive || !IsImplicit) { if (!IsLive || !IsImplicit) {
@@ -176,8 +174,8 @@ spillCalleeSavedRegisters(MachineBasicBlock &MBB,
MachineInstrBuilder MIB = BuildMI(MBB, MBBI, DL, TII->get(SystemZ::STMG)); MachineInstrBuilder MIB = BuildMI(MBB, MBBI, DL, TII->get(SystemZ::STMG));
// Add the explicit register operands. // Add the explicit register operands.
addSavedGPR(MBB, MIB, TM, LowGPR, false); addSavedGPR(MBB, MIB, LowGPR, false);
addSavedGPR(MBB, MIB, TM, HighGPR, false); addSavedGPR(MBB, MIB, HighGPR, false);
// Add the address. // Add the address.
MIB.addReg(SystemZ::R15D).addImm(StartOffset); MIB.addReg(SystemZ::R15D).addImm(StartOffset);
@@ -187,13 +185,13 @@ spillCalleeSavedRegisters(MachineBasicBlock &MBB,
for (unsigned I = 0, E = CSI.size(); I != E; ++I) { for (unsigned I = 0, E = CSI.size(); I != E; ++I) {
unsigned Reg = CSI[I].getReg(); unsigned Reg = CSI[I].getReg();
if (SystemZ::GR64BitRegClass.contains(Reg)) if (SystemZ::GR64BitRegClass.contains(Reg))
addSavedGPR(MBB, MIB, TM, Reg, true); addSavedGPR(MBB, MIB, Reg, true);
} }
// ...likewise GPR varargs. // ...likewise GPR varargs.
if (IsVarArg) if (IsVarArg)
for (unsigned I = ZFI->getVarArgsFirstGPR(); I < SystemZ::NumArgGPRs; ++I) for (unsigned I = ZFI->getVarArgsFirstGPR(); I < SystemZ::NumArgGPRs; ++I)
addSavedGPR(MBB, MIB, TM, SystemZ::ArgGPRs[I], true); addSavedGPR(MBB, MIB, SystemZ::ArgGPRs[I], true);
} }
// Save FPRs in the normal TargetInstrInfo way. // Save FPRs in the normal TargetInstrInfo way.

View File

@@ -10,7 +10,6 @@
#ifndef SYSTEMZFRAMELOWERING_H #ifndef SYSTEMZFRAMELOWERING_H
#define SYSTEMZFRAMELOWERING_H #define SYSTEMZFRAMELOWERING_H
#include "SystemZSubtarget.h"
#include "llvm/ADT/IndexedMap.h" #include "llvm/ADT/IndexedMap.h"
#include "llvm/Target/TargetFrameLowering.h" #include "llvm/Target/TargetFrameLowering.h"
@@ -21,13 +20,8 @@ class SystemZSubtarget;
class SystemZFrameLowering : public TargetFrameLowering { class SystemZFrameLowering : public TargetFrameLowering {
IndexedMap<unsigned> RegSpillOffsets; IndexedMap<unsigned> RegSpillOffsets;
protected:
const SystemZTargetMachine &TM;
const SystemZSubtarget &STI;
public: public:
SystemZFrameLowering(const SystemZTargetMachine &tm, SystemZFrameLowering();
const SystemZSubtarget &sti);
// Override TargetFrameLowering. // Override TargetFrameLowering.
bool isFPCloseToIncomingSP() const override { return false; } bool isFPCloseToIncomingSP() const override { return false; }

View File

@@ -22,17 +22,15 @@ extern "C" void LLVMInitializeSystemZTarget() {
SystemZTargetMachine::SystemZTargetMachine(const Target &T, StringRef TT, SystemZTargetMachine::SystemZTargetMachine(const Target &T, StringRef TT,
StringRef CPU, StringRef FS, StringRef CPU, StringRef FS,
const TargetOptions &Options, const TargetOptions &Options,
Reloc::Model RM, Reloc::Model RM, CodeModel::Model CM,
CodeModel::Model CM,
CodeGenOpt::Level OL) CodeGenOpt::Level OL)
: LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL), : LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL),
Subtarget(TT, CPU, FS), Subtarget(TT, CPU, FS),
// Make sure that global data has at least 16 bits of alignment by default, // Make sure that global data has at least 16 bits of alignment by
// so that we can refer to it using LARL. We don't have any special // default, so that we can refer to it using LARL. We don't have any
// requirements for stack variables though. // special requirements for stack variables though.
DL("E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64"), DL("E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64"),
InstrInfo(Subtarget), TLInfo(*this), TSInfo(DL), InstrInfo(Subtarget), TLInfo(*this), TSInfo(DL), FrameLowering() {
FrameLowering(*this, Subtarget) {
initAsmInfo(); initAsmInfo();
} }