mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-18 22:38:56 +00:00
When allocating space on stack for writing a register,
use the size of the register, not the size of the Value type, to get the right alignment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1284 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e492c9d4d1
commit
00521d79bf
@ -528,8 +528,10 @@ void PhyRegAlloc::insertCode4SpilledLR(const LiveRange *LR,
|
|||||||
int SpillOff = LR->getSpillOffFromFP();
|
int SpillOff = LR->getSpillOffFromFP();
|
||||||
RegClass *RC = LR->getRegClass();
|
RegClass *RC = LR->getRegClass();
|
||||||
const LiveVarSet *LVSetBef = LVI->getLiveVarSetBeforeMInst(MInst, BB);
|
const LiveVarSet *LVSetBef = LVI->getLiveVarSetBeforeMInst(MInst, BB);
|
||||||
|
|
||||||
|
/**** NOTE: THIS SHOULD USE THE RIGHT SIZE FOR THE REG BEING PUSHED ****/
|
||||||
int TmpOff =
|
int TmpOff =
|
||||||
mcInfo.pushTempValue(TM, TM.findOptimalStorageSize(LR->getType()));
|
mcInfo.pushTempValue(TM, 8 /* TM.findOptimalStorageSize(LR->getType()) */);
|
||||||
|
|
||||||
MachineInstr *MIBef=NULL, *AdIMid=NULL, *MIAft=NULL;
|
MachineInstr *MIBef=NULL, *AdIMid=NULL, *MIAft=NULL;
|
||||||
int TmpReg;
|
int TmpReg;
|
||||||
|
@ -528,8 +528,10 @@ void PhyRegAlloc::insertCode4SpilledLR(const LiveRange *LR,
|
|||||||
int SpillOff = LR->getSpillOffFromFP();
|
int SpillOff = LR->getSpillOffFromFP();
|
||||||
RegClass *RC = LR->getRegClass();
|
RegClass *RC = LR->getRegClass();
|
||||||
const LiveVarSet *LVSetBef = LVI->getLiveVarSetBeforeMInst(MInst, BB);
|
const LiveVarSet *LVSetBef = LVI->getLiveVarSetBeforeMInst(MInst, BB);
|
||||||
|
|
||||||
|
/**** NOTE: THIS SHOULD USE THE RIGHT SIZE FOR THE REG BEING PUSHED ****/
|
||||||
int TmpOff =
|
int TmpOff =
|
||||||
mcInfo.pushTempValue(TM, TM.findOptimalStorageSize(LR->getType()));
|
mcInfo.pushTempValue(TM, 8 /* TM.findOptimalStorageSize(LR->getType()) */);
|
||||||
|
|
||||||
MachineInstr *MIBef=NULL, *AdIMid=NULL, *MIAft=NULL;
|
MachineInstr *MIBef=NULL, *AdIMid=NULL, *MIAft=NULL;
|
||||||
int TmpReg;
|
int TmpReg;
|
||||||
|
@ -1211,6 +1211,8 @@ protected:
|
|||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
// Interface to stack frame layout info for the UltraSPARC.
|
// Interface to stack frame layout info for the UltraSPARC.
|
||||||
|
// Starting offsets for each area of the stack frame are aligned at
|
||||||
|
// a multiple of getStackFrameSizeAlignment().
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
class UltraSparcFrameInfo: public MachineFrameInfo {
|
class UltraSparcFrameInfo: public MachineFrameInfo {
|
||||||
|
@ -709,9 +709,9 @@ void UltraSparcRegInfo::colorCallArgs(const MachineInstr *const CallMI,
|
|||||||
|
|
||||||
int TReg = PRA.getRegNotUsedByThisInst( LR->getRegClass(), CallMI );
|
int TReg = PRA.getRegNotUsedByThisInst( LR->getRegClass(), CallMI );
|
||||||
|
|
||||||
int TmpOff = PRA.mcInfo.pushTempValue(target,
|
/**** NOTE: THIS SHOULD USE THE RIGHT SIZE FOR THE REG BEING PUSHED ****/
|
||||||
target.findOptimalStorageSize(LR->getType()));
|
int TmpOff = PRA.mcInfo.pushTempValue(target, 8);
|
||||||
// getStackOffsets().getNewTmpPosOffFromFP();
|
// target.findOptimalStorageSize(LR->getType()));
|
||||||
|
|
||||||
int argOffset = PRA.mcInfo.allocateOptionalArg(target, LR->getType());
|
int argOffset = PRA.mcInfo.allocateOptionalArg(target, LR->getType());
|
||||||
|
|
||||||
@ -1174,8 +1174,9 @@ void UltraSparcRegInfo::insertCallerSavingCode(const MachineInstr *MInst,
|
|||||||
// and add them to InstrnsBefore and InstrnsAfter of the
|
// and add them to InstrnsBefore and InstrnsAfter of the
|
||||||
// call instruction
|
// call instruction
|
||||||
|
|
||||||
int StackOff = PRA.mcInfo.pushTempValue(target,
|
/**** NOTE: THIS SHOULD USE THE RIGHT SIZE FOR THE REG BEING PUSHED ****/
|
||||||
target.findOptimalStorageSize(LR->getType()));
|
int StackOff = PRA.mcInfo.pushTempValue(target, 8);
|
||||||
|
// target.findOptimalStorageSize(LR->getType()));
|
||||||
|
|
||||||
MachineInstr *AdIBefCC, *AdIAftCC, *AdICpCC;
|
MachineInstr *AdIBefCC, *AdIAftCC, *AdICpCC;
|
||||||
MachineInstr *AdIBef, *AdIAft;
|
MachineInstr *AdIBef, *AdIAft;
|
||||||
@ -1548,6 +1549,7 @@ void UltraSparcRegInfo::moveInst2OrdVec(vector<MachineInstr *> &OrdVec,
|
|||||||
MachineInstr *AdIBef, *AdIAft;
|
MachineInstr *AdIBef, *AdIAft;
|
||||||
|
|
||||||
// TODO: Change 8 below
|
// TODO: Change 8 below
|
||||||
|
/**** NOTE: THIS SHOULD USE THE RIGHT SIZE FOR THE REG BEING PUSHED ****/
|
||||||
const int StackOff = PRA.mcInfo.pushTempValue(target, 8);
|
const int StackOff = PRA.mcInfo.pushTempValue(target, 8);
|
||||||
|
|
||||||
// Save the UReg (%ox) on stack before it's destroyed
|
// Save the UReg (%ox) on stack before it's destroyed
|
||||||
|
@ -193,7 +193,8 @@ UltraSparcSchedInfo::initializeResources()
|
|||||||
//
|
//
|
||||||
// Purpose:
|
// Purpose:
|
||||||
// Interface to stack frame layout info for the UltraSPARC.
|
// Interface to stack frame layout info for the UltraSPARC.
|
||||||
// Note that there is no machine-independent interface to this information
|
// Starting offsets for each area of the stack frame are aligned at
|
||||||
|
// a multiple of getStackFrameSizeAlignment().
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -210,6 +211,8 @@ UltraSparcFrameInfo::getRegSpillAreaOffset(MachineCodeForMethod& mcInfo,
|
|||||||
{
|
{
|
||||||
pos = false; // static stack area grows downwards
|
pos = false; // static stack area grows downwards
|
||||||
unsigned int autoVarsSize = mcInfo.getAutomaticVarsSize();
|
unsigned int autoVarsSize = mcInfo.getAutomaticVarsSize();
|
||||||
|
if (int mod = autoVarsSize % getStackFrameSizeAlignment())
|
||||||
|
autoVarsSize += (getStackFrameSizeAlignment() - mod);
|
||||||
return StaticAreaOffsetFromFP - autoVarsSize;
|
return StaticAreaOffsetFromFP - autoVarsSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,7 +223,10 @@ UltraSparcFrameInfo::getTmpAreaOffset(MachineCodeForMethod& mcInfo,
|
|||||||
pos = false; // static stack area grows downwards
|
pos = false; // static stack area grows downwards
|
||||||
unsigned int autoVarsSize = mcInfo.getAutomaticVarsSize();
|
unsigned int autoVarsSize = mcInfo.getAutomaticVarsSize();
|
||||||
unsigned int spillAreaSize = mcInfo.getRegSpillsSize();
|
unsigned int spillAreaSize = mcInfo.getRegSpillsSize();
|
||||||
return StaticAreaOffsetFromFP - (autoVarsSize + spillAreaSize);
|
int offset = autoVarsSize + spillAreaSize;
|
||||||
|
if (int mod = offset % getStackFrameSizeAlignment())
|
||||||
|
offset += (getStackFrameSizeAlignment() - mod);
|
||||||
|
return StaticAreaOffsetFromFP - offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -229,7 +235,9 @@ UltraSparcFrameInfo::getDynamicAreaOffset(MachineCodeForMethod& mcInfo,
|
|||||||
{
|
{
|
||||||
// dynamic stack area grows downwards starting at top of opt-args area
|
// dynamic stack area grows downwards starting at top of opt-args area
|
||||||
unsigned int optArgsSize = mcInfo.getMaxOptionalArgsSize();
|
unsigned int optArgsSize = mcInfo.getMaxOptionalArgsSize();
|
||||||
return optArgsSize + FirstOptionalOutgoingArgOffsetFromSP;
|
int offset = optArgsSize + FirstOptionalOutgoingArgOffsetFromSP;
|
||||||
|
assert(offset % getStackFrameSizeAlignment() == 0);
|
||||||
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user