mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-14 15:39:06 +00:00
Move reMaterialize() from TargetRegisterInfo to TargetInstrInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48995 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b061c4bc44
commit
ca1267c02b
@ -112,6 +112,13 @@ public:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// reMaterialize - Re-issue the specified 'original' instruction at the
|
||||||
|
/// specific location targeting a new destination register.
|
||||||
|
virtual void reMaterialize(MachineBasicBlock &MBB,
|
||||||
|
MachineBasicBlock::iterator MI,
|
||||||
|
unsigned DestReg,
|
||||||
|
const MachineInstr *Orig) const = 0;
|
||||||
|
|
||||||
/// isInvariantLoad - Return true if the specified instruction (which is
|
/// isInvariantLoad - Return true if the specified instruction (which is
|
||||||
/// marked mayLoad) is loading from a location whose value is invariant across
|
/// marked mayLoad) is loading from a location whose value is invariant across
|
||||||
/// the function. For example, loading a value from the constant pool or from
|
/// the function. For example, loading a value from the constant pool or from
|
||||||
@ -397,7 +404,10 @@ public:
|
|||||||
unsigned &OpIdx) const;
|
unsigned &OpIdx) const;
|
||||||
virtual bool PredicateInstruction(MachineInstr *MI,
|
virtual bool PredicateInstruction(MachineInstr *MI,
|
||||||
const std::vector<MachineOperand> &Pred) const;
|
const std::vector<MachineOperand> &Pred) const;
|
||||||
|
virtual void reMaterialize(MachineBasicBlock &MBB,
|
||||||
|
MachineBasicBlock::iterator MI,
|
||||||
|
unsigned DestReg,
|
||||||
|
const MachineInstr *Orig) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
@ -487,13 +487,6 @@ public:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// reMaterialize - Re-issue the specified 'original' instruction at the
|
|
||||||
/// specific location targeting a new destination register.
|
|
||||||
virtual void reMaterialize(MachineBasicBlock &MBB,
|
|
||||||
MachineBasicBlock::iterator MI,
|
|
||||||
unsigned DestReg,
|
|
||||||
const MachineInstr *Orig) const = 0;
|
|
||||||
|
|
||||||
/// targetHandlesStackFrameRounding - Returns true if the target is
|
/// targetHandlesStackFrameRounding - Returns true if the target is
|
||||||
/// responsible for rounding up the stack frame (probably at emitPrologue
|
/// responsible for rounding up the stack frame (probably at emitPrologue
|
||||||
/// time).
|
/// time).
|
||||||
|
@ -84,3 +84,13 @@ bool TargetInstrInfoImpl::PredicateInstruction(MachineInstr *MI,
|
|||||||
}
|
}
|
||||||
return MadeChange;
|
return MadeChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TargetInstrInfoImpl::reMaterialize(MachineBasicBlock &MBB,
|
||||||
|
MachineBasicBlock::iterator I,
|
||||||
|
unsigned DestReg,
|
||||||
|
const MachineInstr *Orig) const {
|
||||||
|
MachineInstr *MI = Orig->clone();
|
||||||
|
MI->getOperand(0).setReg(DestReg);
|
||||||
|
MBB.insert(I, MI);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -642,9 +642,10 @@ static void UpdateKills(MachineInstr &MI, BitVector &RegKills,
|
|||||||
static void ReMaterialize(MachineBasicBlock &MBB,
|
static void ReMaterialize(MachineBasicBlock &MBB,
|
||||||
MachineBasicBlock::iterator &MII,
|
MachineBasicBlock::iterator &MII,
|
||||||
unsigned DestReg, unsigned Reg,
|
unsigned DestReg, unsigned Reg,
|
||||||
|
const TargetInstrInfo *TII,
|
||||||
const TargetRegisterInfo *TRI,
|
const TargetRegisterInfo *TRI,
|
||||||
VirtRegMap &VRM) {
|
VirtRegMap &VRM) {
|
||||||
TRI->reMaterialize(MBB, MII, DestReg, VRM.getReMaterializedMI(Reg));
|
TII->reMaterialize(MBB, MII, DestReg, VRM.getReMaterializedMI(Reg));
|
||||||
MachineInstr *NewMI = prior(MII);
|
MachineInstr *NewMI = prior(MII);
|
||||||
for (unsigned i = 0, e = NewMI->getNumOperands(); i != e; ++i) {
|
for (unsigned i = 0, e = NewMI->getNumOperands(); i != e; ++i) {
|
||||||
MachineOperand &MO = NewMI->getOperand(i);
|
MachineOperand &MO = NewMI->getOperand(i);
|
||||||
@ -784,7 +785,7 @@ namespace {
|
|||||||
|
|
||||||
MachineBasicBlock::iterator MII = MI;
|
MachineBasicBlock::iterator MII = MI;
|
||||||
if (NewOp.StackSlotOrReMat > VirtRegMap::MAX_STACK_SLOT) {
|
if (NewOp.StackSlotOrReMat > VirtRegMap::MAX_STACK_SLOT) {
|
||||||
ReMaterialize(*MBB, MII, NewPhysReg, NewOp.VirtReg, TRI, VRM);
|
ReMaterialize(*MBB, MII, NewPhysReg, NewOp.VirtReg, TII, TRI,VRM);
|
||||||
} else {
|
} else {
|
||||||
TII->loadRegFromStackSlot(*MBB, MII, NewPhysReg,
|
TII->loadRegFromStackSlot(*MBB, MII, NewPhysReg,
|
||||||
NewOp.StackSlotOrReMat, AliasRC);
|
NewOp.StackSlotOrReMat, AliasRC);
|
||||||
@ -1098,7 +1099,7 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM) {
|
|||||||
unsigned Phys = VRM.getPhys(VirtReg);
|
unsigned Phys = VRM.getPhys(VirtReg);
|
||||||
RegInfo->setPhysRegUsed(Phys);
|
RegInfo->setPhysRegUsed(Phys);
|
||||||
if (VRM.isReMaterialized(VirtReg)) {
|
if (VRM.isReMaterialized(VirtReg)) {
|
||||||
ReMaterialize(MBB, MII, Phys, VirtReg, TRI, VRM);
|
ReMaterialize(MBB, MII, Phys, VirtReg, TII, TRI, VRM);
|
||||||
} else {
|
} else {
|
||||||
const TargetRegisterClass* RC = RegInfo->getRegClass(VirtReg);
|
const TargetRegisterClass* RC = RegInfo->getRegClass(VirtReg);
|
||||||
int SS = VRM.getStackSlot(VirtReg);
|
int SS = VRM.getStackSlot(VirtReg);
|
||||||
@ -1351,7 +1352,7 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM) {
|
|||||||
RegInfo->setPhysRegUsed(PhysReg);
|
RegInfo->setPhysRegUsed(PhysReg);
|
||||||
ReusedOperands.markClobbered(PhysReg);
|
ReusedOperands.markClobbered(PhysReg);
|
||||||
if (DoReMat) {
|
if (DoReMat) {
|
||||||
ReMaterialize(MBB, MII, PhysReg, VirtReg, TRI, VRM);
|
ReMaterialize(MBB, MII, PhysReg, VirtReg, TII, TRI, VRM);
|
||||||
} else {
|
} else {
|
||||||
const TargetRegisterClass* RC = RegInfo->getRegClass(VirtReg);
|
const TargetRegisterClass* RC = RegInfo->getRegClass(VirtReg);
|
||||||
TII->loadRegFromStackSlot(MBB, &MI, PhysReg, SSorRMId, RC);
|
TII->loadRegFromStackSlot(MBB, &MI, PhysReg, SSorRMId, RC);
|
||||||
|
@ -141,6 +141,22 @@ unsigned ARMInstrInfo::isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) con
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ARMInstrInfo::reMaterialize(MachineBasicBlock &MBB,
|
||||||
|
MachineBasicBlock::iterator I,
|
||||||
|
unsigned DestReg,
|
||||||
|
const MachineInstr *Orig) const {
|
||||||
|
if (Orig->getOpcode() == ARM::MOVi2pieces) {
|
||||||
|
RI.emitLoadConstPool(MBB, I, DestReg, Orig->getOperand(1).getImm(),
|
||||||
|
Orig->getOperand(2).getImm(),
|
||||||
|
Orig->getOperand(3).getReg(), this, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MachineInstr *MI = Orig->clone();
|
||||||
|
MI->getOperand(0).setReg(DestReg);
|
||||||
|
MBB.insert(I, MI);
|
||||||
|
}
|
||||||
|
|
||||||
static unsigned getUnindexedOpcode(unsigned Opc) {
|
static unsigned getUnindexedOpcode(unsigned Opc) {
|
||||||
switch (Opc) {
|
switch (Opc) {
|
||||||
default: break;
|
default: break;
|
||||||
@ -934,3 +950,4 @@ unsigned ARM::GetFunctionSize(MachineFunction &MF) {
|
|||||||
}
|
}
|
||||||
return FnSize;
|
return FnSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,6 +148,9 @@ public:
|
|||||||
virtual unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const;
|
virtual unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const;
|
||||||
virtual unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const;
|
virtual unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const;
|
||||||
|
|
||||||
|
void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
||||||
|
unsigned DestReg, const MachineInstr *Orig) const;
|
||||||
|
|
||||||
virtual MachineInstr *convertToThreeAddress(MachineFunction::iterator &MFI,
|
virtual MachineInstr *convertToThreeAddress(MachineFunction::iterator &MFI,
|
||||||
MachineBasicBlock::iterator &MBBI,
|
MachineBasicBlock::iterator &MBBI,
|
||||||
LiveVariables &LV) const;
|
LiveVariables &LV) const;
|
||||||
|
@ -100,38 +100,21 @@ const MachineInstrBuilder &AddDefaultCC(const MachineInstrBuilder &MIB) {
|
|||||||
|
|
||||||
/// emitLoadConstPool - Emits a load from constpool to materialize the
|
/// emitLoadConstPool - Emits a load from constpool to materialize the
|
||||||
/// specified immediate.
|
/// specified immediate.
|
||||||
static void emitLoadConstPool(MachineBasicBlock &MBB,
|
void ARMRegisterInfo::emitLoadConstPool(MachineBasicBlock &MBB,
|
||||||
MachineBasicBlock::iterator &MBBI,
|
MachineBasicBlock::iterator &MBBI,
|
||||||
unsigned DestReg, int Val,
|
unsigned DestReg, int Val,
|
||||||
ARMCC::CondCodes Pred, unsigned PredReg,
|
unsigned Pred, unsigned PredReg,
|
||||||
const TargetInstrInfo &TII, bool isThumb) {
|
const TargetInstrInfo *TII,
|
||||||
|
bool isThumb) const {
|
||||||
MachineFunction &MF = *MBB.getParent();
|
MachineFunction &MF = *MBB.getParent();
|
||||||
MachineConstantPool *ConstantPool = MF.getConstantPool();
|
MachineConstantPool *ConstantPool = MF.getConstantPool();
|
||||||
Constant *C = ConstantInt::get(Type::Int32Ty, Val);
|
Constant *C = ConstantInt::get(Type::Int32Ty, Val);
|
||||||
unsigned Idx = ConstantPool->getConstantPoolIndex(C, 2);
|
unsigned Idx = ConstantPool->getConstantPoolIndex(C, 2);
|
||||||
if (isThumb)
|
if (isThumb)
|
||||||
BuildMI(MBB, MBBI, TII.get(ARM::tLDRcp), DestReg).addConstantPoolIndex(Idx);
|
BuildMI(MBB, MBBI, TII->get(ARM::tLDRcp),DestReg).addConstantPoolIndex(Idx);
|
||||||
else
|
else
|
||||||
BuildMI(MBB, MBBI, TII.get(ARM::LDRcp), DestReg).addConstantPoolIndex(Idx)
|
BuildMI(MBB, MBBI, TII->get(ARM::LDRcp), DestReg).addConstantPoolIndex(Idx)
|
||||||
.addReg(0).addImm(0).addImm((unsigned)Pred).addReg(PredReg);
|
.addReg(0).addImm(0).addImm(Pred).addReg(PredReg);
|
||||||
}
|
|
||||||
|
|
||||||
void ARMRegisterInfo::reMaterialize(MachineBasicBlock &MBB,
|
|
||||||
MachineBasicBlock::iterator I,
|
|
||||||
unsigned DestReg,
|
|
||||||
const MachineInstr *Orig) const {
|
|
||||||
if (Orig->getOpcode() == ARM::MOVi2pieces) {
|
|
||||||
emitLoadConstPool(MBB, I, DestReg,
|
|
||||||
Orig->getOperand(1).getImm(),
|
|
||||||
(ARMCC::CondCodes)Orig->getOperand(2).getImm(),
|
|
||||||
Orig->getOperand(3).getReg(),
|
|
||||||
TII, false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MachineInstr *MI = Orig->clone();
|
|
||||||
MI->getOperand(0).setReg(DestReg);
|
|
||||||
MBB.insert(I, MI);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isLowRegister - Returns true if the register is low register r0-r7.
|
/// isLowRegister - Returns true if the register is low register r0-r7.
|
||||||
@ -344,7 +327,7 @@ void emitThumbRegPlusImmInReg(MachineBasicBlock &MBB,
|
|||||||
BuildMI(MBB, MBBI, TII.get(ARM::tNEG), LdReg)
|
BuildMI(MBB, MBBI, TII.get(ARM::tNEG), LdReg)
|
||||||
.addReg(LdReg, false, false, true);
|
.addReg(LdReg, false, false, true);
|
||||||
} else
|
} else
|
||||||
emitLoadConstPool(MBB, MBBI, LdReg, NumBytes, ARMCC::AL, 0, TII, true);
|
MRI.emitLoadConstPool(MBB, MBBI, LdReg, NumBytes, ARMCC::AL, 0,&TII,true);
|
||||||
|
|
||||||
// Emit add / sub.
|
// Emit add / sub.
|
||||||
int Opc = (isSub) ? ARM::tSUBrr : (isHigh ? ARM::tADDhirr : ARM::tADDrr);
|
int Opc = (isSub) ? ARM::tSUBrr : (isHigh ? ARM::tADDhirr : ARM::tADDrr);
|
||||||
@ -785,7 +768,7 @@ void ARMRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
|||||||
emitThumbRegPlusImmInReg(MBB, II, TmpReg, FrameReg,
|
emitThumbRegPlusImmInReg(MBB, II, TmpReg, FrameReg,
|
||||||
Offset, false, TII, *this);
|
Offset, false, TII, *this);
|
||||||
else {
|
else {
|
||||||
emitLoadConstPool(MBB, II, TmpReg, Offset, ARMCC::AL, 0, TII, true);
|
emitLoadConstPool(MBB, II, TmpReg, Offset, ARMCC::AL, 0, &TII, true);
|
||||||
UseRR = true;
|
UseRR = true;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@ -822,7 +805,7 @@ void ARMRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
|||||||
emitThumbRegPlusImmInReg(MBB, II, TmpReg, FrameReg,
|
emitThumbRegPlusImmInReg(MBB, II, TmpReg, FrameReg,
|
||||||
Offset, false, TII, *this);
|
Offset, false, TII, *this);
|
||||||
else {
|
else {
|
||||||
emitLoadConstPool(MBB, II, TmpReg, Offset, ARMCC::AL, 0, TII, true);
|
emitLoadConstPool(MBB, II, TmpReg, Offset, ARMCC::AL, 0, &TII, true);
|
||||||
UseRR = true;
|
UseRR = true;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
@ -1402,4 +1385,3 @@ int ARMRegisterInfo::getDwarfRegNum(unsigned RegNum, bool isEH) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#include "ARMGenRegisterInfo.inc"
|
#include "ARMGenRegisterInfo.inc"
|
||||||
|
|
||||||
|
@ -32,14 +32,19 @@ private:
|
|||||||
public:
|
public:
|
||||||
ARMRegisterInfo(const TargetInstrInfo &tii, const ARMSubtarget &STI);
|
ARMRegisterInfo(const TargetInstrInfo &tii, const ARMSubtarget &STI);
|
||||||
|
|
||||||
|
/// emitLoadConstPool - Emits a load from constpool to materialize the
|
||||||
|
/// specified immediate.
|
||||||
|
void emitLoadConstPool(MachineBasicBlock &MBB,
|
||||||
|
MachineBasicBlock::iterator &MBBI,
|
||||||
|
unsigned DestReg, int Val,
|
||||||
|
unsigned Pred, unsigned PredReg,
|
||||||
|
const TargetInstrInfo *TII, bool isThumb) const;
|
||||||
|
|
||||||
/// getRegisterNumbering - Given the enum value for some register, e.g.
|
/// getRegisterNumbering - Given the enum value for some register, e.g.
|
||||||
/// ARM::LR, return the number that it corresponds to (e.g. 14).
|
/// ARM::LR, return the number that it corresponds to (e.g. 14).
|
||||||
static unsigned getRegisterNumbering(unsigned RegEnum);
|
static unsigned getRegisterNumbering(unsigned RegEnum);
|
||||||
|
|
||||||
/// Code Generation virtual methods...
|
/// Code Generation virtual methods...
|
||||||
void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
|
||||||
unsigned DestReg, const MachineInstr *Orig) const;
|
|
||||||
|
|
||||||
const unsigned *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
|
const unsigned *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
|
||||||
|
|
||||||
const TargetRegisterClass* const*
|
const TargetRegisterClass* const*
|
||||||
|
@ -58,15 +58,6 @@ AlphaRegisterInfo::AlphaRegisterInfo(const TargetInstrInfo &tii)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlphaRegisterInfo::reMaterialize(MachineBasicBlock &MBB,
|
|
||||||
MachineBasicBlock::iterator I,
|
|
||||||
unsigned DestReg,
|
|
||||||
const MachineInstr *Orig) const {
|
|
||||||
MachineInstr *MI = Orig->clone();
|
|
||||||
MI->getOperand(0).setReg(DestReg);
|
|
||||||
MBB.insert(I, MI);
|
|
||||||
}
|
|
||||||
|
|
||||||
const unsigned* AlphaRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF)
|
const unsigned* AlphaRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF)
|
||||||
const {
|
const {
|
||||||
static const unsigned CalleeSavedRegs[] = {
|
static const unsigned CalleeSavedRegs[] = {
|
||||||
|
@ -28,9 +28,6 @@ struct AlphaRegisterInfo : public AlphaGenRegisterInfo {
|
|||||||
AlphaRegisterInfo(const TargetInstrInfo &tii);
|
AlphaRegisterInfo(const TargetInstrInfo &tii);
|
||||||
|
|
||||||
/// Code Generation virtual methods...
|
/// Code Generation virtual methods...
|
||||||
void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
|
||||||
unsigned DestReg, const MachineInstr *Orig) const;
|
|
||||||
|
|
||||||
const unsigned *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
|
const unsigned *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
|
||||||
|
|
||||||
const TargetRegisterClass* const* getCalleeSavedRegClasses(
|
const TargetRegisterClass* const* getCalleeSavedRegClasses(
|
||||||
|
@ -191,15 +191,6 @@ SPURegisterInfo::SPURegisterInfo(const SPUSubtarget &subtarget,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void SPURegisterInfo::reMaterialize(MachineBasicBlock &MBB,
|
|
||||||
MachineBasicBlock::iterator I,
|
|
||||||
unsigned DestReg,
|
|
||||||
const MachineInstr *Orig) const {
|
|
||||||
MachineInstr *MI = Orig->clone();
|
|
||||||
MI->getOperand(0).setReg(DestReg);
|
|
||||||
MBB.insert(I, MI);
|
|
||||||
}
|
|
||||||
|
|
||||||
// SPU's 128-bit registers used for argument passing:
|
// SPU's 128-bit registers used for argument passing:
|
||||||
static const unsigned SPU_ArgRegs[] = {
|
static const unsigned SPU_ArgRegs[] = {
|
||||||
SPU::R3, SPU::R4, SPU::R5, SPU::R6, SPU::R7, SPU::R8, SPU::R9,
|
SPU::R3, SPU::R4, SPU::R5, SPU::R6, SPU::R7, SPU::R8, SPU::R9,
|
||||||
|
@ -41,9 +41,6 @@ namespace llvm {
|
|||||||
*/
|
*/
|
||||||
static unsigned getRegisterNumbering(unsigned RegEnum);
|
static unsigned getRegisterNumbering(unsigned RegEnum);
|
||||||
|
|
||||||
void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
|
||||||
unsigned DestReg, const MachineInstr *Orig) const;
|
|
||||||
|
|
||||||
//! Return the array of callee-saved registers
|
//! Return the array of callee-saved registers
|
||||||
virtual const unsigned* getCalleeSavedRegs(const MachineFunction *MF) const;
|
virtual const unsigned* getCalleeSavedRegs(const MachineFunction *MF) const;
|
||||||
|
|
||||||
|
@ -37,15 +37,6 @@ IA64RegisterInfo::IA64RegisterInfo(const TargetInstrInfo &tii)
|
|||||||
: IA64GenRegisterInfo(IA64::ADJUSTCALLSTACKDOWN, IA64::ADJUSTCALLSTACKUP),
|
: IA64GenRegisterInfo(IA64::ADJUSTCALLSTACKDOWN, IA64::ADJUSTCALLSTACKUP),
|
||||||
TII(tii) {}
|
TII(tii) {}
|
||||||
|
|
||||||
void IA64RegisterInfo::reMaterialize(MachineBasicBlock &MBB,
|
|
||||||
MachineBasicBlock::iterator I,
|
|
||||||
unsigned DestReg,
|
|
||||||
const MachineInstr *Orig) const {
|
|
||||||
MachineInstr *MI = Orig->clone();
|
|
||||||
MI->getOperand(0).setReg(DestReg);
|
|
||||||
MBB.insert(I, MI);
|
|
||||||
}
|
|
||||||
|
|
||||||
const unsigned* IA64RegisterInfo::getCalleeSavedRegs(const MachineFunction *MF)
|
const unsigned* IA64RegisterInfo::getCalleeSavedRegs(const MachineFunction *MF)
|
||||||
const {
|
const {
|
||||||
static const unsigned CalleeSavedRegs[] = {
|
static const unsigned CalleeSavedRegs[] = {
|
||||||
|
@ -27,9 +27,6 @@ struct IA64RegisterInfo : public IA64GenRegisterInfo {
|
|||||||
IA64RegisterInfo(const TargetInstrInfo &tii);
|
IA64RegisterInfo(const TargetInstrInfo &tii);
|
||||||
|
|
||||||
/// Code Generation virtual methods...
|
/// Code Generation virtual methods...
|
||||||
void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
|
||||||
unsigned DestReg, const MachineInstr *Orig) const;
|
|
||||||
|
|
||||||
const unsigned *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
|
const unsigned *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
|
||||||
|
|
||||||
const TargetRegisterClass* const* getCalleeSavedRegClasses(
|
const TargetRegisterClass* const* getCalleeSavedRegClasses(
|
||||||
|
@ -84,16 +84,6 @@ getRegisterNumbering(unsigned RegEnum)
|
|||||||
return 0; // Not reached
|
return 0; // Not reached
|
||||||
}
|
}
|
||||||
|
|
||||||
void MipsRegisterInfo::reMaterialize(MachineBasicBlock &MBB,
|
|
||||||
MachineBasicBlock::iterator I,
|
|
||||||
unsigned DestReg,
|
|
||||||
const MachineInstr *Orig) const
|
|
||||||
{
|
|
||||||
MachineInstr *MI = Orig->clone();
|
|
||||||
MI->getOperand(0).setReg(DestReg);
|
|
||||||
MBB.insert(I, MI);
|
|
||||||
}
|
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
//
|
//
|
||||||
// Callee Saved Registers methods
|
// Callee Saved Registers methods
|
||||||
|
@ -32,9 +32,6 @@ struct MipsRegisterInfo : public MipsGenRegisterInfo {
|
|||||||
static unsigned getRegisterNumbering(unsigned RegEnum);
|
static unsigned getRegisterNumbering(unsigned RegEnum);
|
||||||
|
|
||||||
/// Code Generation virtual methods...
|
/// Code Generation virtual methods...
|
||||||
void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
|
||||||
unsigned DestReg, const MachineInstr *Orig) const;
|
|
||||||
|
|
||||||
const unsigned *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
|
const unsigned *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
|
||||||
|
|
||||||
const TargetRegisterClass* const*
|
const TargetRegisterClass* const*
|
||||||
|
@ -136,15 +136,6 @@ PPCRegisterInfo::PPCRegisterInfo(const PPCSubtarget &ST,
|
|||||||
ImmToIdxMap[PPC::ADDI8] = PPC::ADD8; ImmToIdxMap[PPC::STD_32] = PPC::STDX_32;
|
ImmToIdxMap[PPC::ADDI8] = PPC::ADD8; ImmToIdxMap[PPC::STD_32] = PPC::STDX_32;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PPCRegisterInfo::reMaterialize(MachineBasicBlock &MBB,
|
|
||||||
MachineBasicBlock::iterator I,
|
|
||||||
unsigned DestReg,
|
|
||||||
const MachineInstr *Orig) const {
|
|
||||||
MachineInstr *MI = Orig->clone();
|
|
||||||
MI->getOperand(0).setReg(DestReg);
|
|
||||||
MBB.insert(I, MI);
|
|
||||||
}
|
|
||||||
|
|
||||||
const unsigned*
|
const unsigned*
|
||||||
PPCRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
|
PPCRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
|
||||||
// 32-bit Darwin calling convention.
|
// 32-bit Darwin calling convention.
|
||||||
|
@ -36,9 +36,6 @@ public:
|
|||||||
static unsigned getRegisterNumbering(unsigned RegEnum);
|
static unsigned getRegisterNumbering(unsigned RegEnum);
|
||||||
|
|
||||||
/// Code Generation virtual methods...
|
/// Code Generation virtual methods...
|
||||||
void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
|
||||||
unsigned DestReg, const MachineInstr *Orig) const;
|
|
||||||
|
|
||||||
const unsigned *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
|
const unsigned *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
|
||||||
|
|
||||||
const TargetRegisterClass* const*
|
const TargetRegisterClass* const*
|
||||||
|
@ -30,15 +30,6 @@ SparcRegisterInfo::SparcRegisterInfo(SparcSubtarget &st,
|
|||||||
Subtarget(st), TII(tii) {
|
Subtarget(st), TII(tii) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SparcRegisterInfo::reMaterialize(MachineBasicBlock &MBB,
|
|
||||||
MachineBasicBlock::iterator I,
|
|
||||||
unsigned DestReg,
|
|
||||||
const MachineInstr *Orig) const {
|
|
||||||
MachineInstr *MI = Orig->clone();
|
|
||||||
MI->getOperand(0).setReg(DestReg);
|
|
||||||
MBB.insert(I, MI);
|
|
||||||
}
|
|
||||||
|
|
||||||
const unsigned* SparcRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF)
|
const unsigned* SparcRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF)
|
||||||
const {
|
const {
|
||||||
static const unsigned CalleeSavedRegs[] = { 0 };
|
static const unsigned CalleeSavedRegs[] = { 0 };
|
||||||
|
@ -30,9 +30,6 @@ struct SparcRegisterInfo : public SparcGenRegisterInfo {
|
|||||||
SparcRegisterInfo(SparcSubtarget &st, const TargetInstrInfo &tii);
|
SparcRegisterInfo(SparcSubtarget &st, const TargetInstrInfo &tii);
|
||||||
|
|
||||||
/// Code Generation virtual methods...
|
/// Code Generation virtual methods...
|
||||||
void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
|
||||||
unsigned DestReg, const MachineInstr *Orig) const;
|
|
||||||
|
|
||||||
const unsigned *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
|
const unsigned *getCalleeSavedRegs(const MachineFunction *MF = 0) const;
|
||||||
|
|
||||||
const TargetRegisterClass* const* getCalleeSavedRegClasses(
|
const TargetRegisterClass* const* getCalleeSavedRegClasses(
|
||||||
|
@ -820,6 +820,34 @@ bool X86InstrInfo::isReallyTriviallyReMaterializable(MachineInstr *MI) const {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void X86InstrInfo::reMaterialize(MachineBasicBlock &MBB,
|
||||||
|
MachineBasicBlock::iterator I,
|
||||||
|
unsigned DestReg,
|
||||||
|
const MachineInstr *Orig) const {
|
||||||
|
// MOV32r0 etc. are implemented with xor which clobbers condition code.
|
||||||
|
// Re-materialize them as movri instructions to avoid side effects.
|
||||||
|
switch (Orig->getOpcode()) {
|
||||||
|
case X86::MOV8r0:
|
||||||
|
BuildMI(MBB, I, get(X86::MOV8ri), DestReg).addImm(0);
|
||||||
|
break;
|
||||||
|
case X86::MOV16r0:
|
||||||
|
BuildMI(MBB, I, get(X86::MOV16ri), DestReg).addImm(0);
|
||||||
|
break;
|
||||||
|
case X86::MOV32r0:
|
||||||
|
BuildMI(MBB, I, get(X86::MOV32ri), DestReg).addImm(0);
|
||||||
|
break;
|
||||||
|
case X86::MOV64r0:
|
||||||
|
BuildMI(MBB, I, get(X86::MOV64ri32), DestReg).addImm(0);
|
||||||
|
break;
|
||||||
|
default: {
|
||||||
|
MachineInstr *MI = Orig->clone();
|
||||||
|
MI->getOperand(0).setReg(DestReg);
|
||||||
|
MBB.insert(I, MI);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// isInvariantLoad - Return true if the specified instruction (which is marked
|
/// isInvariantLoad - Return true if the specified instruction (which is marked
|
||||||
/// mayLoad) is loading from a location whose value is invariant across the
|
/// mayLoad) is loading from a location whose value is invariant across the
|
||||||
/// function. For example, loading a value from the constant pool or from
|
/// function. For example, loading a value from the constant pool or from
|
||||||
|
@ -258,7 +258,11 @@ public:
|
|||||||
unsigned& destReg) const;
|
unsigned& destReg) const;
|
||||||
unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const;
|
unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const;
|
||||||
unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const;
|
unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const;
|
||||||
|
|
||||||
bool isReallyTriviallyReMaterializable(MachineInstr *MI) const;
|
bool isReallyTriviallyReMaterializable(MachineInstr *MI) const;
|
||||||
|
void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
||||||
|
unsigned DestReg, const MachineInstr *Orig) const;
|
||||||
|
|
||||||
bool isInvariantLoad(MachineInstr *MI) const;
|
bool isInvariantLoad(MachineInstr *MI) const;
|
||||||
|
|
||||||
/// convertToThreeAddress - This method must be implemented by targets that
|
/// convertToThreeAddress - This method must be implemented by targets that
|
||||||
|
@ -155,34 +155,6 @@ X86RegisterInfo::getCrossCopyRegClass(const TargetRegisterClass *RC) const {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void X86RegisterInfo::reMaterialize(MachineBasicBlock &MBB,
|
|
||||||
MachineBasicBlock::iterator I,
|
|
||||||
unsigned DestReg,
|
|
||||||
const MachineInstr *Orig) const {
|
|
||||||
// MOV32r0 etc. are implemented with xor which clobbers condition code.
|
|
||||||
// Re-materialize them as movri instructions to avoid side effects.
|
|
||||||
switch (Orig->getOpcode()) {
|
|
||||||
case X86::MOV8r0:
|
|
||||||
BuildMI(MBB, I, TII.get(X86::MOV8ri), DestReg).addImm(0);
|
|
||||||
break;
|
|
||||||
case X86::MOV16r0:
|
|
||||||
BuildMI(MBB, I, TII.get(X86::MOV16ri), DestReg).addImm(0);
|
|
||||||
break;
|
|
||||||
case X86::MOV32r0:
|
|
||||||
BuildMI(MBB, I, TII.get(X86::MOV32ri), DestReg).addImm(0);
|
|
||||||
break;
|
|
||||||
case X86::MOV64r0:
|
|
||||||
BuildMI(MBB, I, TII.get(X86::MOV64ri32), DestReg).addImm(0);
|
|
||||||
break;
|
|
||||||
default: {
|
|
||||||
MachineInstr *MI = Orig->clone();
|
|
||||||
MI->getOperand(0).setReg(DestReg);
|
|
||||||
MBB.insert(I, MI);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const unsigned *
|
const unsigned *
|
||||||
X86RegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
|
X86RegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const {
|
||||||
static const unsigned CalleeSavedRegs32Bit[] = {
|
static const unsigned CalleeSavedRegs32Bit[] = {
|
||||||
|
@ -97,9 +97,6 @@ public:
|
|||||||
const TargetRegisterClass *
|
const TargetRegisterClass *
|
||||||
getCrossCopyRegClass(const TargetRegisterClass *RC) const;
|
getCrossCopyRegClass(const TargetRegisterClass *RC) const;
|
||||||
|
|
||||||
void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI,
|
|
||||||
unsigned DestReg, const MachineInstr *Orig) const;
|
|
||||||
|
|
||||||
/// getCalleeSavedRegs - Return a null-terminated list of all of the
|
/// getCalleeSavedRegs - Return a null-terminated list of all of the
|
||||||
/// callee-save registers on this target.
|
/// callee-save registers on this target.
|
||||||
const unsigned *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
|
const unsigned *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user