mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 20:29:53 +00:00
Simplify eliminateFrameIndex() interface back down now that PEI doesn't need
to try to re-use scavenged frame index reference registers. rdar://8277890 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112241 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6cd467bd0e
commit
fcb4a8ead3
@ -743,14 +743,8 @@ public:
|
||||
/// specified instruction, as long as it keeps the iterator pointing at the
|
||||
/// finished product. SPAdj is the SP adjustment due to call frame setup
|
||||
/// instruction.
|
||||
///
|
||||
/// When -enable-frame-index-scavenging is enabled, the virtual register
|
||||
/// allocated for this frame index is returned and its value is stored in
|
||||
/// *Value.
|
||||
typedef std::pair<unsigned, int> FrameIndexValue;
|
||||
virtual unsigned eliminateFrameIndex(MachineBasicBlock::iterator MI,
|
||||
int SPAdj, FrameIndexValue *Value = NULL,
|
||||
RegScavenger *RS=NULL) const = 0;
|
||||
virtual void eliminateFrameIndex(MachineBasicBlock::iterator MI,
|
||||
int SPAdj, RegScavenger *RS=NULL) const = 0;
|
||||
|
||||
/// emitProlog/emitEpilog - These methods insert prolog and epilog code into
|
||||
/// the function.
|
||||
|
@ -63,7 +63,6 @@ bool PEI::runOnMachineFunction(MachineFunction &Fn) {
|
||||
const TargetRegisterInfo *TRI = Fn.getTarget().getRegisterInfo();
|
||||
RS = TRI->requiresRegisterScavenging(Fn) ? new RegScavenger() : NULL;
|
||||
FrameIndexVirtualScavenging = TRI->requiresFrameIndexScavenging(Fn);
|
||||
FrameConstantRegMap.clear();
|
||||
|
||||
// Calculate the MaxCallFrameSize and AdjustsStack variables for the
|
||||
// function's frame information. Also eliminates call frame pseudo
|
||||
@ -756,16 +755,8 @@ void PEI::replaceFrameIndices(MachineFunction &Fn) {
|
||||
// If this instruction has a FrameIndex operand, we need to
|
||||
// use that target machine register info object to eliminate
|
||||
// it.
|
||||
TargetRegisterInfo::FrameIndexValue Value;
|
||||
unsigned VReg =
|
||||
TRI.eliminateFrameIndex(MI, SPAdj, &Value,
|
||||
TRI.eliminateFrameIndex(MI, SPAdj,
|
||||
FrameIndexVirtualScavenging ? NULL : RS);
|
||||
if (VReg) {
|
||||
assert (FrameIndexVirtualScavenging &&
|
||||
"Not scavenging, but virtual returned from "
|
||||
"eliminateFrameIndex()!");
|
||||
FrameConstantRegMap[VReg] = FrameConstantEntry(Value, SPAdj);
|
||||
}
|
||||
|
||||
// Reset the iterator if we were at the beginning of the BB.
|
||||
if (AtBeginning) {
|
||||
|
@ -99,13 +99,6 @@ namespace llvm {
|
||||
// TRI->requiresFrameIndexScavenging() for the curren function.
|
||||
bool FrameIndexVirtualScavenging;
|
||||
|
||||
// When using the scavenger post-pass to resolve frame reference
|
||||
// materialization registers, maintain a map of the registers to
|
||||
// the constant value and SP adjustment associated with it.
|
||||
typedef std::pair<TargetRegisterInfo::FrameIndexValue, int>
|
||||
FrameConstantEntry;
|
||||
DenseMap<unsigned, FrameConstantEntry> FrameConstantRegMap;
|
||||
|
||||
#ifndef NDEBUG
|
||||
// Machine function handle.
|
||||
MachineFunction* MF;
|
||||
|
@ -366,12 +366,12 @@ unsigned RegScavenger::scavengeRegister(const TargetRegisterClass *RC,
|
||||
"Cannot scavenge register without an emergency spill slot!");
|
||||
TII->storeRegToStackSlot(*MBB, I, SReg, true, ScavengingFrameIndex, RC,TRI);
|
||||
MachineBasicBlock::iterator II = prior(I);
|
||||
TRI->eliminateFrameIndex(II, SPAdj, NULL, this);
|
||||
TRI->eliminateFrameIndex(II, SPAdj, this);
|
||||
|
||||
// Restore the scavenged register before its use (or first terminator).
|
||||
TII->loadRegFromStackSlot(*MBB, UseMI, SReg, ScavengingFrameIndex, RC, TRI);
|
||||
II = prior(UseMI);
|
||||
TRI->eliminateFrameIndex(II, SPAdj, NULL, this);
|
||||
TRI->eliminateFrameIndex(II, SPAdj, this);
|
||||
}
|
||||
|
||||
ScavengeRestore = prior(UseMI);
|
||||
|
@ -40,9 +40,6 @@
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
|
||||
namespace llvm {
|
||||
cl::opt<bool>
|
||||
ReuseFrameIndexVals("arm-reuse-frame-index-vals", cl::Hidden, cl::init(false),
|
||||
cl::desc("Reuse repeated frame index values"));
|
||||
static cl::opt<bool>
|
||||
ForceAllBaseRegAlloc("arm-force-base-reg-alloc", cl::Hidden, cl::init(false),
|
||||
cl::desc("Force use of virtual base registers for stack load/store"));
|
||||
@ -1620,10 +1617,9 @@ bool ARMBaseRegisterInfo::isFrameOffsetLegal(const MachineInstr *MI,
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned
|
||||
void
|
||||
ARMBaseRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, FrameIndexValue *Value,
|
||||
RegScavenger *RS) const {
|
||||
int SPAdj, RegScavenger *RS) const {
|
||||
unsigned i = 0;
|
||||
MachineInstr &MI = *II;
|
||||
MachineBasicBlock &MBB = *MI.getParent();
|
||||
@ -1646,7 +1642,7 @@ ARMBaseRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
if (MI.isDebugValue()) {
|
||||
MI.getOperand(i). ChangeToRegister(FrameReg, false /*isDef*/);
|
||||
MI.getOperand(i+1).ChangeToImmediate(Offset);
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// Modify MI as necessary to handle as much of 'Offset' as possible
|
||||
@ -1658,7 +1654,7 @@ ARMBaseRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
Done = rewriteT2FrameIndex(MI, i, FrameReg, Offset, TII);
|
||||
}
|
||||
if (Done)
|
||||
return 0;
|
||||
return;
|
||||
|
||||
// If we get here, the immediate doesn't fit into the instruction. We folded
|
||||
// as much as possible above, handle the rest, providing a register that is
|
||||
@ -1678,10 +1674,6 @@ ARMBaseRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
MI.getOperand(i).ChangeToRegister(FrameReg, false, false, false);
|
||||
else {
|
||||
ScratchReg = MF.getRegInfo().createVirtualRegister(ARM::GPRRegisterClass);
|
||||
if (Value) {
|
||||
Value->first = FrameReg; // use the frame register as a kind indicator
|
||||
Value->second = Offset;
|
||||
}
|
||||
if (!AFI->isThumbFunction())
|
||||
emitARMRegPlusImmediate(MBB, II, MI.getDebugLoc(), ScratchReg, FrameReg,
|
||||
Offset, Pred, PredReg, TII);
|
||||
@ -1691,10 +1683,7 @@ ARMBaseRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
Offset, Pred, PredReg, TII);
|
||||
}
|
||||
MI.getOperand(i).ChangeToRegister(ScratchReg, false, false, true);
|
||||
if (!ReuseFrameIndexVals)
|
||||
ScratchReg = 0;
|
||||
}
|
||||
return ScratchReg;
|
||||
}
|
||||
|
||||
/// Move iterator past the next bunch of callee save load / store ops for
|
||||
|
@ -163,9 +163,8 @@ public:
|
||||
MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator I) const;
|
||||
|
||||
virtual unsigned eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, FrameIndexValue *Value = NULL,
|
||||
RegScavenger *RS = NULL) const;
|
||||
virtual void eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, RegScavenger *RS = NULL) const;
|
||||
|
||||
virtual void emitPrologue(MachineFunction &MF) const;
|
||||
virtual void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
|
||||
|
@ -576,10 +576,9 @@ Thumb1RegisterInfo::saveScavengerRegister(MachineBasicBlock &MBB,
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned
|
||||
void
|
||||
Thumb1RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, FrameIndexValue *Value,
|
||||
RegScavenger *RS) const{
|
||||
int SPAdj, RegScavenger *RS) const {
|
||||
unsigned VReg = 0;
|
||||
unsigned i = 0;
|
||||
MachineInstr &MI = *II;
|
||||
@ -614,14 +613,14 @@ Thumb1RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
if (MI.isDebugValue()) {
|
||||
MI.getOperand(i). ChangeToRegister(FrameReg, false /*isDef*/);
|
||||
MI.getOperand(i+1).ChangeToImmediate(Offset);
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// Modify MI as necessary to handle as much of 'Offset' as possible
|
||||
assert(AFI->isThumbFunction() &&
|
||||
"This eliminateFrameIndex only supports Thumb1!");
|
||||
if (rewriteFrameIndex(MI, i, FrameReg, Offset, TII))
|
||||
return 0;
|
||||
return;
|
||||
|
||||
// If we get here, the immediate doesn't fit into the instruction. We folded
|
||||
// as much as possible above, handle the rest, providing a register that is
|
||||
@ -662,11 +661,7 @@ Thumb1RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
MI.addOperand(MachineOperand::CreateReg(0, false));
|
||||
} else if (Desc.mayStore()) {
|
||||
VReg = MF.getRegInfo().createVirtualRegister(ARM::tGPRRegisterClass);
|
||||
assert (Value && "Frame index virtual allocated, but Value arg is NULL!");
|
||||
bool UseRR = false;
|
||||
bool TrackVReg = true;
|
||||
Value->first = FrameReg; // use the frame register as a kind indicator
|
||||
Value->second = Offset;
|
||||
|
||||
if (Opcode == ARM::tSpill) {
|
||||
if (FrameReg == ARM::SP)
|
||||
@ -675,7 +670,6 @@ Thumb1RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
else {
|
||||
emitLoadConstPool(MBB, II, dl, VReg, 0, Offset);
|
||||
UseRR = true;
|
||||
TrackVReg = false;
|
||||
}
|
||||
} else
|
||||
emitThumbRegPlusImmediate(MBB, II, VReg, FrameReg, Offset, TII,
|
||||
@ -686,8 +680,6 @@ Thumb1RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
MI.addOperand(MachineOperand::CreateReg(FrameReg, false));
|
||||
else // tSTR has an extra register operand.
|
||||
MI.addOperand(MachineOperand::CreateReg(0, false));
|
||||
if (!ReuseFrameIndexVals || !TrackVReg)
|
||||
VReg = 0;
|
||||
} else
|
||||
assert(false && "Unexpected opcode!");
|
||||
|
||||
@ -696,7 +688,6 @@ Thumb1RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
MachineInstrBuilder MIB(&MI);
|
||||
AddDefaultPred(MIB);
|
||||
}
|
||||
return VReg;
|
||||
}
|
||||
|
||||
void Thumb1RegisterInfo::emitPrologue(MachineFunction &MF) const {
|
||||
|
@ -57,9 +57,8 @@ public:
|
||||
MachineBasicBlock::iterator &UseMI,
|
||||
const TargetRegisterClass *RC,
|
||||
unsigned Reg) const;
|
||||
unsigned eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, FrameIndexValue *Value = NULL,
|
||||
RegScavenger *RS = NULL) const;
|
||||
void eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, RegScavenger *RS = NULL) const;
|
||||
|
||||
void emitPrologue(MachineFunction &MF) const;
|
||||
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
|
||||
|
@ -137,10 +137,9 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
|
||||
//variable locals
|
||||
//<- SP
|
||||
|
||||
unsigned
|
||||
void
|
||||
AlphaRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, FrameIndexValue *Value,
|
||||
RegScavenger *RS) const {
|
||||
int SPAdj, RegScavenger *RS) const {
|
||||
assert(SPAdj == 0 && "Unexpected");
|
||||
|
||||
unsigned i = 0;
|
||||
@ -185,7 +184,6 @@ AlphaRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
} else {
|
||||
MI.getOperand(i).ChangeToImmediate(Offset);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -38,9 +38,8 @@ struct AlphaRegisterInfo : public AlphaGenRegisterInfo {
|
||||
MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator I) const;
|
||||
|
||||
unsigned eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, FrameIndexValue *Value = NULL,
|
||||
RegScavenger *RS = NULL) const;
|
||||
void eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, RegScavenger *RS = NULL) const;
|
||||
|
||||
//void processFunctionBeforeFrameFinalized(MachineFunction &MF) const;
|
||||
|
||||
|
@ -190,10 +190,9 @@ static unsigned findScratchRegister(MachineBasicBlock::iterator II,
|
||||
return Reg;
|
||||
}
|
||||
|
||||
unsigned
|
||||
void
|
||||
BlackfinRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, FrameIndexValue *Value,
|
||||
RegScavenger *RS) const {
|
||||
int SPAdj, RegScavenger *RS) const {
|
||||
MachineInstr &MI = *II;
|
||||
MachineBasicBlock &MBB = *MI.getParent();
|
||||
MachineFunction &MF = *MBB.getParent();
|
||||
@ -230,20 +229,20 @@ BlackfinRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
MI.setDesc(TII.get(isStore
|
||||
? BF::STORE32p_uimm6m4
|
||||
: BF::LOAD32p_uimm6m4));
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
if (BaseReg == BF::FP && isUInt<7>(-Offset)) {
|
||||
MI.setDesc(TII.get(isStore
|
||||
? BF::STORE32fp_nimm7m4
|
||||
: BF::LOAD32fp_nimm7m4));
|
||||
MI.getOperand(FIPos+1).setImm(-Offset);
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
if (isInt<18>(Offset)) {
|
||||
MI.setDesc(TII.get(isStore
|
||||
? BF::STORE32p_imm18m4
|
||||
: BF::LOAD32p_imm18m4));
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
// Use RegScavenger to calculate proper offset...
|
||||
MI.dump();
|
||||
@ -328,7 +327,6 @@ BlackfinRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
llvm_unreachable("Cannot eliminate frame index");
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void BlackfinRegisterInfo::
|
||||
|
@ -51,9 +51,8 @@ namespace llvm {
|
||||
MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator I) const;
|
||||
|
||||
unsigned eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, FrameIndexValue *Value = NULL,
|
||||
RegScavenger *RS = NULL) const;
|
||||
void eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, RegScavenger *RS = NULL) const;
|
||||
|
||||
void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
|
||||
RegScavenger *RS) const;
|
||||
|
@ -270,9 +270,8 @@ SPURegisterInfo::eliminateCallFramePseudoInstr(MachineFunction &MF,
|
||||
MBB.erase(I);
|
||||
}
|
||||
|
||||
unsigned
|
||||
void
|
||||
SPURegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj,
|
||||
FrameIndexValue *Value,
|
||||
RegScavenger *RS) const
|
||||
{
|
||||
unsigned i = 0;
|
||||
@ -328,7 +327,6 @@ SPURegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj,
|
||||
} else {
|
||||
MO.ChangeToImmediate(Offset);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// determineFrameLayout - Determine the size of the frame and maximum call
|
||||
|
@ -63,9 +63,8 @@ namespace llvm {
|
||||
MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator I) const;
|
||||
//! Convert frame indicies into machine operands
|
||||
unsigned eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj,
|
||||
FrameIndexValue *Value = NULL,
|
||||
RegScavenger *RS = NULL) const;
|
||||
void eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj,
|
||||
RegScavenger *RS = NULL) const;
|
||||
//! Determine the frame's layour
|
||||
void determineFrameLayout(MachineFunction &MF) const;
|
||||
|
||||
|
@ -242,9 +242,9 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
|
||||
// FrameIndex represent objects inside a abstract stack.
|
||||
// We must replace FrameIndex with an stack/frame pointer
|
||||
// direct reference.
|
||||
unsigned MBlazeRegisterInfo::
|
||||
void MBlazeRegisterInfo::
|
||||
eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj,
|
||||
FrameIndexValue *Value, RegScavenger *RS) const {
|
||||
RegScavenger *RS) const {
|
||||
MachineInstr &MI = *II;
|
||||
MachineFunction &MF = *MI.getParent()->getParent();
|
||||
|
||||
@ -277,7 +277,6 @@ eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj,
|
||||
|
||||
MI.getOperand(oi).ChangeToImmediate(Offset);
|
||||
MI.getOperand(i).ChangeToRegister(getFrameRegister(MF), false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MBlazeRegisterInfo::
|
||||
|
@ -63,9 +63,8 @@ struct MBlazeRegisterInfo : public MBlazeGenRegisterInfo {
|
||||
MachineBasicBlock::iterator I) const;
|
||||
|
||||
/// Stack Frame Processing Methods
|
||||
unsigned eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, FrameIndexValue *Value = NULL,
|
||||
RegScavenger *RS = NULL) const;
|
||||
void eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, RegScavenger *RS = NULL) const;
|
||||
|
||||
void processFunctionBeforeFrameFinalized(MachineFunction &MF) const;
|
||||
|
||||
|
@ -163,10 +163,9 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
|
||||
MBB.erase(I);
|
||||
}
|
||||
|
||||
unsigned
|
||||
void
|
||||
MSP430RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, FrameIndexValue *Value,
|
||||
RegScavenger *RS) const {
|
||||
int SPAdj, RegScavenger *RS) const {
|
||||
assert(SPAdj == 0 && "Unexpected");
|
||||
|
||||
unsigned i = 0;
|
||||
@ -204,7 +203,7 @@ MSP430RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
MI.getOperand(i).ChangeToRegister(BasePtr, false);
|
||||
|
||||
if (Offset == 0)
|
||||
return 0;
|
||||
return;
|
||||
|
||||
// We need to materialize the offset via add instruction.
|
||||
unsigned DstReg = MI.getOperand(0).getReg();
|
||||
@ -215,12 +214,11 @@ MSP430RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
BuildMI(MBB, llvm::next(II), dl, TII.get(MSP430::ADD16ri), DstReg)
|
||||
.addReg(DstReg).addImm(Offset);
|
||||
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
MI.getOperand(i).ChangeToRegister(BasePtr, false);
|
||||
MI.getOperand(i+1).ChangeToImmediate(Offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -46,9 +46,8 @@ public:
|
||||
MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator I) const;
|
||||
|
||||
unsigned eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, FrameIndexValue *Value = NULL,
|
||||
RegScavenger *RS = NULL) const;
|
||||
void eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, RegScavenger *RS = NULL) const;
|
||||
|
||||
void emitPrologue(MachineFunction &MF) const;
|
||||
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const;
|
||||
|
@ -327,10 +327,9 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
|
||||
// FrameIndex represent objects inside a abstract stack.
|
||||
// We must replace FrameIndex with an stack/frame pointer
|
||||
// direct reference.
|
||||
unsigned MipsRegisterInfo::
|
||||
void MipsRegisterInfo::
|
||||
eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj,
|
||||
FrameIndexValue *Value, RegScavenger *RS) const
|
||||
{
|
||||
RegScavenger *RS) const {
|
||||
MachineInstr &MI = *II;
|
||||
MachineFunction &MF = *MI.getParent()->getParent();
|
||||
|
||||
@ -361,7 +360,6 @@ eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj,
|
||||
|
||||
MI.getOperand(i-1).ChangeToImmediate(Offset);
|
||||
MI.getOperand(i).ChangeToRegister(getFrameRegister(MF), false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MipsRegisterInfo::
|
||||
|
@ -51,9 +51,8 @@ struct MipsRegisterInfo : public MipsGenRegisterInfo {
|
||||
MachineBasicBlock::iterator I) const;
|
||||
|
||||
/// Stack Frame Processing Methods
|
||||
unsigned eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, FrameIndexValue *Value = NULL,
|
||||
RegScavenger *RS = NULL) const;
|
||||
void eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, RegScavenger *RS = NULL) const;
|
||||
|
||||
void processFunctionBeforeFrameFinalized(MachineFunction &MF) const;
|
||||
|
||||
|
@ -44,13 +44,10 @@ bool PIC16RegisterInfo::hasFP(const MachineFunction &MF) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned PIC16RegisterInfo::
|
||||
void PIC16RegisterInfo::
|
||||
eliminateFrameIndex(MachineBasicBlock::iterator II, int SPAdj,
|
||||
FrameIndexValue *Value, RegScavenger *RS) const
|
||||
{
|
||||
/* NOT YET IMPLEMENTED */
|
||||
return 0;
|
||||
}
|
||||
RegScavenger *RS) const
|
||||
{ /* NOT YET IMPLEMENTED */ }
|
||||
|
||||
void PIC16RegisterInfo::emitPrologue(MachineFunction &MF) const
|
||||
{ /* NOT YET IMPLEMENTED */ }
|
||||
|
@ -44,9 +44,8 @@ class PIC16RegisterInfo : public PIC16GenRegisterInfo {
|
||||
virtual BitVector getReservedRegs(const MachineFunction &MF) const;
|
||||
virtual bool hasFP(const MachineFunction &MF) const;
|
||||
|
||||
virtual unsigned eliminateFrameIndex(MachineBasicBlock::iterator MI,
|
||||
int SPAdj, FrameIndexValue *Value = NULL,
|
||||
RegScavenger *RS=NULL) const;
|
||||
virtual void eliminateFrameIndex(MachineBasicBlock::iterator MI,
|
||||
int SPAdj, RegScavenger *RS=NULL) const;
|
||||
|
||||
void eliminateCallFramePseudoInstr(MachineFunction &MF,
|
||||
MachineBasicBlock &MBB,
|
||||
|
@ -580,10 +580,9 @@ void PPCRegisterInfo::lowerCRSpilling(MachineBasicBlock::iterator II,
|
||||
MBB.erase(II);
|
||||
}
|
||||
|
||||
unsigned
|
||||
void
|
||||
PPCRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, FrameIndexValue *Value,
|
||||
RegScavenger *RS) const {
|
||||
int SPAdj, RegScavenger *RS) const {
|
||||
assert(SPAdj == 0 && "Unexpected");
|
||||
|
||||
// Get the instruction.
|
||||
@ -622,14 +621,14 @@ PPCRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
if (FPSI && FrameIndex == FPSI &&
|
||||
(OpC == PPC::DYNALLOC || OpC == PPC::DYNALLOC8)) {
|
||||
lowerDynamicAlloc(II, SPAdj, RS);
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// Special case for pseudo-op SPILL_CR.
|
||||
if (EnableRegisterScavenging) // FIXME (64-bit): Enable by default.
|
||||
if (OpC == PPC::SPILL_CR) {
|
||||
lowerCRSpilling(II, FrameIndex, SPAdj, RS);
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// Replace the FrameIndex with base register with GPR1 (SP) or GPR31 (FP).
|
||||
@ -674,7 +673,7 @@ PPCRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
if (isIXAddr)
|
||||
Offset >>= 2; // The actual encoded value has the low two bits zero.
|
||||
MI.getOperand(OffsetOperandNo).ChangeToImmediate(Offset);
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// The offset doesn't fit into a single register, scavenge one to build the
|
||||
@ -710,11 +709,10 @@ PPCRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
} else {
|
||||
OperandBase = OffsetOperandNo;
|
||||
}
|
||||
|
||||
|
||||
unsigned StackReg = MI.getOperand(FIOperandNo).getReg();
|
||||
MI.getOperand(OperandBase).ChangeToRegister(StackReg, false);
|
||||
MI.getOperand(OperandBase + 1).ChangeToRegister(SReg, false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// VRRegNo - Map from a numbered VR register to its enum value.
|
||||
|
@ -63,9 +63,8 @@ public:
|
||||
int SPAdj, RegScavenger *RS) const;
|
||||
void lowerCRSpilling(MachineBasicBlock::iterator II, unsigned FrameIndex,
|
||||
int SPAdj, RegScavenger *RS) const;
|
||||
unsigned eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, FrameIndexValue *Value = NULL,
|
||||
RegScavenger *RS = NULL) const;
|
||||
void eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, RegScavenger *RS = NULL) const;
|
||||
|
||||
/// determineFrameLayout - Determine the size of the frame and maximum call
|
||||
/// frame size.
|
||||
|
@ -69,10 +69,9 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
|
||||
MBB.erase(I);
|
||||
}
|
||||
|
||||
unsigned
|
||||
void
|
||||
SparcRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, FrameIndexValue *Value,
|
||||
RegScavenger *RS) const {
|
||||
int SPAdj, RegScavenger *RS) const {
|
||||
assert(SPAdj == 0 && "Unexpected");
|
||||
|
||||
unsigned i = 0;
|
||||
@ -108,7 +107,6 @@ SparcRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
MI.getOperand(i).ChangeToRegister(SP::G1, false);
|
||||
MI.getOperand(i+1).ChangeToImmediate(Offset & ((1 << 10)-1));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SparcRegisterInfo::
|
||||
|
@ -40,9 +40,8 @@ struct SparcRegisterInfo : public SparcGenRegisterInfo {
|
||||
MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator I) const;
|
||||
|
||||
unsigned eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, FrameIndexValue *Value = NULL,
|
||||
RegScavenger *RS = NULL) const;
|
||||
void eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, RegScavenger *RS = NULL) const;
|
||||
|
||||
void processFunctionBeforeFrameFinalized(MachineFunction &MF) const;
|
||||
|
||||
|
@ -92,10 +92,9 @@ int SystemZRegisterInfo::getFrameIndexOffset(const MachineFunction &MF,
|
||||
return Offset;
|
||||
}
|
||||
|
||||
unsigned
|
||||
void
|
||||
SystemZRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, FrameIndexValue *Value,
|
||||
RegScavenger *RS) const {
|
||||
int SPAdj, RegScavenger *RS) const {
|
||||
assert(SPAdj == 0 && "Unxpected");
|
||||
|
||||
unsigned i = 0;
|
||||
@ -117,13 +116,13 @@ SystemZRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
|
||||
// Offset is a either 12-bit unsigned or 20-bit signed integer.
|
||||
// FIXME: handle "too long" displacements.
|
||||
int Offset = getFrameIndexOffset(MF, FrameIndex) + MI.getOperand(i+1).getImm();
|
||||
int Offset =
|
||||
getFrameIndexOffset(MF, FrameIndex) + MI.getOperand(i+1).getImm();
|
||||
|
||||
// Check whether displacement is too long to fit into 12 bit zext field.
|
||||
MI.setDesc(TII.getMemoryInstr(MI.getOpcode(), Offset));
|
||||
|
||||
MI.getOperand(i+1).ChangeToImmediate(Offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -43,9 +43,8 @@ struct SystemZRegisterInfo : public SystemZGenRegisterInfo {
|
||||
MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator I) const;
|
||||
|
||||
unsigned eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, FrameIndexValue *Value = NULL,
|
||||
RegScavenger *RS = NULL) const;
|
||||
void eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, RegScavenger *RS = NULL) const;
|
||||
|
||||
|
||||
void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
|
||||
|
@ -626,10 +626,9 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
|
||||
MBB.erase(I);
|
||||
}
|
||||
|
||||
unsigned
|
||||
void
|
||||
X86RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, FrameIndexValue *Value,
|
||||
RegScavenger *RS) const{
|
||||
int SPAdj, RegScavenger *RS) const{
|
||||
assert(SPAdj == 0 && "Unexpected");
|
||||
|
||||
unsigned i = 0;
|
||||
@ -676,7 +675,6 @@ X86RegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
uint64_t Offset = FIOffset + (uint64_t)MI.getOperand(i+3).getOffset();
|
||||
MI.getOperand(i+3).setOffset(Offset);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -126,9 +126,8 @@ public:
|
||||
MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI) const;
|
||||
|
||||
unsigned eliminateFrameIndex(MachineBasicBlock::iterator MI,
|
||||
int SPAdj, FrameIndexValue *Value = NULL,
|
||||
RegScavenger *RS = NULL) const;
|
||||
void eliminateFrameIndex(MachineBasicBlock::iterator MI,
|
||||
int SPAdj, RegScavenger *RS = NULL) const;
|
||||
|
||||
void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
|
||||
RegScavenger *RS = NULL) const;
|
||||
|
@ -155,10 +155,9 @@ eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
|
||||
MBB.erase(I);
|
||||
}
|
||||
|
||||
unsigned
|
||||
void
|
||||
XCoreRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, FrameIndexValue *Value,
|
||||
RegScavenger *RS) const {
|
||||
int SPAdj, RegScavenger *RS) const {
|
||||
assert(SPAdj == 0 && "Unexpected");
|
||||
MachineInstr &MI = *II;
|
||||
DebugLoc dl = MI.getDebugLoc();
|
||||
@ -291,7 +290,6 @@ XCoreRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
}
|
||||
// Erase old instruction.
|
||||
MBB.erase(II);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -54,9 +54,8 @@ public:
|
||||
MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator I) const;
|
||||
|
||||
unsigned eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, FrameIndexValue *Value = NULL,
|
||||
RegScavenger *RS = NULL) const;
|
||||
void eliminateFrameIndex(MachineBasicBlock::iterator II,
|
||||
int SPAdj, RegScavenger *RS = NULL) const;
|
||||
|
||||
void processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
|
||||
RegScavenger *RS = NULL) const;
|
||||
|
Loading…
Reference in New Issue
Block a user