mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Remove the need to cache the subtarget in the Mips TargetRegisterInfo
classes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232012 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a56999c5de
commit
ae02704ac7
@ -1,4 +1,3 @@
|
||||
|
||||
//===-- Mips16InstrInfo.cpp - Mips16 Instruction Information --------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
@ -32,7 +31,7 @@ using namespace llvm;
|
||||
#define DEBUG_TYPE "mips16-instrinfo"
|
||||
|
||||
Mips16InstrInfo::Mips16InstrInfo(const MipsSubtarget &STI)
|
||||
: MipsInstrInfo(STI, Mips::Bimm16), RI(STI) {}
|
||||
: MipsInstrInfo(STI, Mips::Bimm16), RI() {}
|
||||
|
||||
const MipsRegisterInfo &Mips16InstrInfo::getRegisterInfo() const {
|
||||
return RI;
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "MipsInstrInfo.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class MipsSubtarget;
|
||||
class Mips16InstrInfo : public MipsInstrInfo {
|
||||
const Mips16RegisterInfo RI;
|
||||
|
||||
|
@ -41,8 +41,7 @@ using namespace llvm;
|
||||
|
||||
#define DEBUG_TYPE "mips16-registerinfo"
|
||||
|
||||
Mips16RegisterInfo::Mips16RegisterInfo(const MipsSubtarget &ST)
|
||||
: MipsRegisterInfo(ST) {}
|
||||
Mips16RegisterInfo::Mips16RegisterInfo() : MipsRegisterInfo() {}
|
||||
|
||||
bool Mips16RegisterInfo::requiresRegisterScavenging
|
||||
(const MachineFunction &MF) const {
|
||||
@ -65,7 +64,7 @@ bool Mips16RegisterInfo::saveScavengerRegister
|
||||
const TargetRegisterClass *RC,
|
||||
unsigned Reg) const {
|
||||
DebugLoc DL;
|
||||
const TargetInstrInfo &TII = *Subtarget.getInstrInfo();
|
||||
const TargetInstrInfo &TII = *MBB.getParent()->getSubtarget().getInstrInfo();
|
||||
TII.copyPhysReg(MBB, I, DL, Mips::T0, Reg, true);
|
||||
TII.copyPhysReg(MBB, UseMI, DL, Reg, Mips::T0, true);
|
||||
return true;
|
||||
@ -106,7 +105,7 @@ void Mips16RegisterInfo::eliminateFI(MachineBasicBlock::iterator II,
|
||||
if (FrameIndex >= MinCSFI && FrameIndex <= MaxCSFI)
|
||||
FrameReg = Mips::SP;
|
||||
else {
|
||||
const TargetFrameLowering *TFI = Subtarget.getFrameLowering();
|
||||
const TargetFrameLowering *TFI = MF.getSubtarget().getFrameLowering();
|
||||
if (TFI->hasFP(MF)) {
|
||||
FrameReg = Mips::S0;
|
||||
}
|
||||
@ -140,7 +139,7 @@ void Mips16RegisterInfo::eliminateFI(MachineBasicBlock::iterator II,
|
||||
DebugLoc DL = II->getDebugLoc();
|
||||
unsigned NewImm;
|
||||
const Mips16InstrInfo &TII =
|
||||
*static_cast<const Mips16InstrInfo *>(Subtarget.getInstrInfo());
|
||||
*static_cast<const Mips16InstrInfo *>(MF.getSubtarget().getInstrInfo());
|
||||
FrameReg = TII.loadImmediate(FrameReg, Offset, MBB, II, DL, NewImm);
|
||||
Offset = SignExtend64<16>(NewImm);
|
||||
IsKill = true;
|
||||
|
@ -21,7 +21,7 @@ class Mips16InstrInfo;
|
||||
|
||||
class Mips16RegisterInfo : public MipsRegisterInfo {
|
||||
public:
|
||||
Mips16RegisterInfo(const MipsSubtarget &Subtarget);
|
||||
Mips16RegisterInfo();
|
||||
|
||||
bool requiresRegisterScavenging(const MachineFunction &MF) const override;
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "MipsGenInstrInfo.inc"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
class MipsSubtarget;
|
||||
class MipsInstrInfo : public MipsGenInstrInfo {
|
||||
virtual void anchor();
|
||||
protected:
|
||||
|
@ -43,14 +43,14 @@ using namespace llvm;
|
||||
#define GET_REGINFO_TARGET_DESC
|
||||
#include "MipsGenRegisterInfo.inc"
|
||||
|
||||
MipsRegisterInfo::MipsRegisterInfo(const MipsSubtarget &ST)
|
||||
: MipsGenRegisterInfo(Mips::RA), Subtarget(ST) {}
|
||||
MipsRegisterInfo::MipsRegisterInfo() : MipsGenRegisterInfo(Mips::RA) {}
|
||||
|
||||
unsigned MipsRegisterInfo::getPICCallReg() { return Mips::T9; }
|
||||
|
||||
const TargetRegisterClass *
|
||||
MipsRegisterInfo::getPointerRegClass(const MachineFunction &MF,
|
||||
unsigned Kind) const {
|
||||
const MipsSubtarget &Subtarget = MF.getSubtarget<MipsSubtarget>();
|
||||
return Subtarget.isABI_N64() ? &Mips::GPR64RegClass : &Mips::GPR32RegClass;
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ MipsRegisterInfo::getRegPressureLimit(const TargetRegisterClass *RC,
|
||||
case Mips::GPR32RegClassID:
|
||||
case Mips::GPR64RegClassID:
|
||||
case Mips::DSPRRegClassID: {
|
||||
const TargetFrameLowering *TFI = Subtarget.getFrameLowering();
|
||||
const TargetFrameLowering *TFI = MF.getSubtarget().getFrameLowering();
|
||||
return 28 - TFI->hasFP(MF);
|
||||
}
|
||||
case Mips::FGR32RegClassID:
|
||||
@ -82,6 +82,7 @@ MipsRegisterInfo::getRegPressureLimit(const TargetRegisterClass *RC,
|
||||
/// Mips Callee Saved Registers
|
||||
const MCPhysReg *
|
||||
MipsRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
|
||||
const MipsSubtarget &Subtarget = MF->getSubtarget<MipsSubtarget>();
|
||||
if (Subtarget.isSingleFloat())
|
||||
return CSR_SingleFloatOnly_SaveList;
|
||||
|
||||
@ -103,6 +104,7 @@ MipsRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
|
||||
const uint32_t *
|
||||
MipsRegisterInfo::getCallPreservedMask(const MachineFunction &MF,
|
||||
CallingConv::ID) const {
|
||||
const MipsSubtarget &Subtarget = MF.getSubtarget<MipsSubtarget>();
|
||||
if (Subtarget.isSingleFloat())
|
||||
return CSR_SingleFloatOnly_RegMask;
|
||||
|
||||
@ -136,6 +138,7 @@ getReservedRegs(const MachineFunction &MF) const {
|
||||
};
|
||||
|
||||
BitVector Reserved(getNumRegs());
|
||||
const MipsSubtarget &Subtarget = MF.getSubtarget<MipsSubtarget>();
|
||||
typedef TargetRegisterClass::const_iterator RegIter;
|
||||
|
||||
for (unsigned I = 0; I < array_lengthof(ReservedGPR32); ++I)
|
||||
@ -258,6 +261,7 @@ eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj,
|
||||
|
||||
unsigned MipsRegisterInfo::
|
||||
getFrameRegister(const MachineFunction &MF) const {
|
||||
const MipsSubtarget &Subtarget = MF.getSubtarget<MipsSubtarget>();
|
||||
const TargetFrameLowering *TFI = Subtarget.getFrameLowering();
|
||||
bool IsN64 =
|
||||
static_cast<const MipsTargetMachine &>(MF.getTarget()).getABI().IsN64();
|
||||
|
@ -21,15 +21,11 @@
|
||||
#include "MipsGenRegisterInfo.inc"
|
||||
|
||||
namespace llvm {
|
||||
class MipsSubtarget;
|
||||
class Type;
|
||||
|
||||
class MipsRegisterInfo : public MipsGenRegisterInfo {
|
||||
protected:
|
||||
const MipsSubtarget &Subtarget;
|
||||
|
||||
public:
|
||||
MipsRegisterInfo(const MipsSubtarget &Subtarget);
|
||||
MipsRegisterInfo();
|
||||
|
||||
/// getRegisterNumbering - Given the enum value for some register, e.g.
|
||||
/// Mips::RA, return the number that it corresponds to (e.g. 31).
|
||||
|
@ -27,7 +27,7 @@ using namespace llvm;
|
||||
MipsSEInstrInfo::MipsSEInstrInfo(const MipsSubtarget &STI)
|
||||
: MipsInstrInfo(STI, STI.getRelocationModel() == Reloc::PIC_ ? Mips::B
|
||||
: Mips::J),
|
||||
RI(STI) {}
|
||||
RI() {}
|
||||
|
||||
const MipsRegisterInfo &MipsSEInstrInfo::getRegisterInfo() const {
|
||||
return RI;
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "MipsMachineFunction.h"
|
||||
#include "MipsSEInstrInfo.h"
|
||||
#include "MipsSubtarget.h"
|
||||
#include "MipsTargetMachine.h"
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/CodeGen/MachineFrameInfo.h"
|
||||
@ -41,8 +42,7 @@ using namespace llvm;
|
||||
|
||||
#define DEBUG_TYPE "mips-reg-info"
|
||||
|
||||
MipsSERegisterInfo::MipsSERegisterInfo(const MipsSubtarget &ST)
|
||||
: MipsRegisterInfo(ST) {}
|
||||
MipsSERegisterInfo::MipsSERegisterInfo() : MipsRegisterInfo() {}
|
||||
|
||||
bool MipsSERegisterInfo::
|
||||
requiresRegisterScavenging(const MachineFunction &MF) const {
|
||||
@ -110,6 +110,8 @@ void MipsSERegisterInfo::eliminateFI(MachineBasicBlock::iterator II,
|
||||
MachineFunction &MF = *MI.getParent()->getParent();
|
||||
MachineFrameInfo *MFI = MF.getFrameInfo();
|
||||
MipsFunctionInfo *MipsFI = MF.getInfo<MipsFunctionInfo>();
|
||||
bool isN64 =
|
||||
static_cast<const MipsTargetMachine &>(MF.getTarget()).getABI().IsN64();
|
||||
|
||||
const std::vector<CalleeSavedInfo> &CSI = MFI->getCalleeSavedInfo();
|
||||
int MinCSFI = 0;
|
||||
@ -132,7 +134,7 @@ void MipsSERegisterInfo::eliminateFI(MachineBasicBlock::iterator II,
|
||||
unsigned FrameReg;
|
||||
|
||||
if ((FrameIndex >= MinCSFI && FrameIndex <= MaxCSFI) || EhDataRegFI)
|
||||
FrameReg = Subtarget.isABI_N64() ? Mips::SP_64 : Mips::SP;
|
||||
FrameReg = isN64 ? Mips::SP_64 : Mips::SP;
|
||||
else
|
||||
FrameReg = getFrameRegister(MF);
|
||||
|
||||
@ -165,9 +167,9 @@ void MipsSERegisterInfo::eliminateFI(MachineBasicBlock::iterator II,
|
||||
// (where n < 16) and doesn't, but does fit into 16-bits then use an ADDiu
|
||||
MachineBasicBlock &MBB = *MI.getParent();
|
||||
DebugLoc DL = II->getDebugLoc();
|
||||
unsigned ADDiu = Subtarget.isABI_N64() ? Mips::DADDiu : Mips::ADDiu;
|
||||
unsigned ADDiu = isN64 ? Mips::DADDiu : Mips::ADDiu;
|
||||
const TargetRegisterClass *RC =
|
||||
Subtarget.isABI_N64() ? &Mips::GPR64RegClass : &Mips::GPR32RegClass;
|
||||
isN64 ? &Mips::GPR64RegClass : &Mips::GPR32RegClass;
|
||||
MachineRegisterInfo &RegInfo = MBB.getParent()->getRegInfo();
|
||||
unsigned Reg = RegInfo.createVirtualRegister(RC);
|
||||
const MipsSEInstrInfo &TII =
|
||||
@ -183,7 +185,7 @@ void MipsSERegisterInfo::eliminateFI(MachineBasicBlock::iterator II,
|
||||
// instructions.
|
||||
MachineBasicBlock &MBB = *MI.getParent();
|
||||
DebugLoc DL = II->getDebugLoc();
|
||||
unsigned ADDu = Subtarget.isABI_N64() ? Mips::DADDu : Mips::ADDu;
|
||||
unsigned ADDu = isN64 ? Mips::DADDu : Mips::ADDu;
|
||||
unsigned NewImm = 0;
|
||||
const MipsSEInstrInfo &TII =
|
||||
*static_cast<const MipsSEInstrInfo *>(
|
||||
|
@ -22,7 +22,7 @@ class MipsSEInstrInfo;
|
||||
|
||||
class MipsSERegisterInfo : public MipsRegisterInfo {
|
||||
public:
|
||||
MipsSERegisterInfo(const MipsSubtarget &Subtarget);
|
||||
MipsSERegisterInfo();
|
||||
|
||||
bool requiresRegisterScavenging(const MachineFunction &MF) const override;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user