mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-02 09:33:59 +00:00
Fix errors in computing downgrowing offsets, and in
computing size of extra outgoing args. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1256 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5a81692f47
commit
f1a0a10813
@ -191,8 +191,9 @@ ComputeMaxOptionalArgsSize(const TargetMachine& target, const Method* method)
|
|||||||
{
|
{
|
||||||
CallInst* callInst = cast<CallInst>(*I);
|
CallInst* callInst = cast<CallInst>(*I);
|
||||||
unsigned int numOperands = callInst->getNumOperands() - 1;
|
unsigned int numOperands = callInst->getNumOperands() - 1;
|
||||||
unsigned int numExtra = numOperands
|
int numExtra = (int) numOperands - frameInfo.getNumFixedOutgoingArgs();
|
||||||
- frameInfo.getNumFixedOutgoingArgs();
|
if (numExtra <= 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
unsigned int sizeForThisCall;
|
unsigned int sizeForThisCall;
|
||||||
if (frameInfo.argsOnStackHaveFixedSize())
|
if (frameInfo.argsOnStackHaveFixedSize())
|
||||||
@ -243,11 +244,12 @@ MachineCodeForMethod::allocateLocalVar(const TargetMachine& target,
|
|||||||
bool growUp;
|
bool growUp;
|
||||||
int firstOffset =target.getFrameInfo().getFirstAutomaticVarOffset(*this,
|
int firstOffset =target.getFrameInfo().getFirstAutomaticVarOffset(*this,
|
||||||
growUp);
|
growUp);
|
||||||
|
unsigned int size = target.findOptimalStorageSize(val->getType());
|
||||||
|
|
||||||
offset = growUp? firstOffset + getAutomaticVarsSize()
|
offset = growUp? firstOffset + getAutomaticVarsSize()
|
||||||
: firstOffset - getAutomaticVarsSize();
|
: firstOffset - getAutomaticVarsSize() - size;
|
||||||
offsets[val] = offset;
|
offsets[val] = offset;
|
||||||
|
|
||||||
unsigned int size = target.findOptimalStorageSize(val->getType());
|
|
||||||
incrementAutomaticVarsSize(size);
|
incrementAutomaticVarsSize(size);
|
||||||
}
|
}
|
||||||
return offset;
|
return offset;
|
||||||
@ -259,10 +261,11 @@ MachineCodeForMethod::allocateSpilledValue(const TargetMachine& target,
|
|||||||
{
|
{
|
||||||
bool growUp;
|
bool growUp;
|
||||||
int firstOffset = target.getFrameInfo().getRegSpillAreaOffset(*this, growUp);
|
int firstOffset = target.getFrameInfo().getRegSpillAreaOffset(*this, growUp);
|
||||||
int offset = growUp? firstOffset + getRegSpillsSize()
|
|
||||||
: firstOffset - getRegSpillsSize();
|
|
||||||
|
|
||||||
unsigned int size = target.findOptimalStorageSize(type);
|
unsigned int size = target.findOptimalStorageSize(type);
|
||||||
|
|
||||||
|
int offset = growUp? firstOffset + getRegSpillsSize()
|
||||||
|
: firstOffset - getRegSpillsSize() - size;
|
||||||
|
|
||||||
incrementRegSpillsSize(size);
|
incrementRegSpillsSize(size);
|
||||||
|
|
||||||
return offset;
|
return offset;
|
||||||
@ -275,18 +278,18 @@ MachineCodeForMethod::allocateOptionalArg(const TargetMachine& target,
|
|||||||
const MachineFrameInfo& frameInfo = target.getFrameInfo();
|
const MachineFrameInfo& frameInfo = target.getFrameInfo();
|
||||||
bool growUp;
|
bool growUp;
|
||||||
int firstOffset = frameInfo.getFirstOptionalOutgoingArgOffset(*this, growUp);
|
int firstOffset = frameInfo.getFirstOptionalOutgoingArgOffset(*this, growUp);
|
||||||
int offset = growUp? firstOffset + getCurrentOptionalArgsSize()
|
|
||||||
: firstOffset - getCurrentOptionalArgsSize();
|
|
||||||
|
|
||||||
int size = MAXINT;
|
int size = MAXINT;
|
||||||
if (frameInfo.argsOnStackHaveFixedSize())
|
if (frameInfo.argsOnStackHaveFixedSize())
|
||||||
size = frameInfo.getSizeOfEachArgOnStack();
|
size = frameInfo.getSizeOfEachArgOnStack();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert(0 && "UNTESTED CODE: Size per stack argument is not fixed on this architecture: use actual argument sizes for computing optional arg offsets");
|
|
||||||
size = target.findOptimalStorageSize(type);
|
size = target.findOptimalStorageSize(type);
|
||||||
|
assert(0 && "UNTESTED CODE: Size per stack argument is not fixed on this architecture: use actual argument sizes for computing optional arg offsets");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int offset = growUp? firstOffset + getCurrentOptionalArgsSize()
|
||||||
|
: firstOffset - getCurrentOptionalArgsSize() - size;
|
||||||
incrementCurrentOptionalArgsSize(size);
|
incrementCurrentOptionalArgsSize(size);
|
||||||
|
|
||||||
return offset;
|
return offset;
|
||||||
@ -305,7 +308,7 @@ MachineCodeForMethod::pushTempValue(const TargetMachine& target,
|
|||||||
bool growUp;
|
bool growUp;
|
||||||
int firstTmpOffset = target.getFrameInfo().getTmpAreaOffset(*this, growUp);
|
int firstTmpOffset = target.getFrameInfo().getTmpAreaOffset(*this, growUp);
|
||||||
int offset = growUp? firstTmpOffset + currentTmpValuesSize
|
int offset = growUp? firstTmpOffset + currentTmpValuesSize
|
||||||
: firstTmpOffset - currentTmpValuesSize;
|
: firstTmpOffset - currentTmpValuesSize - size;
|
||||||
currentTmpValuesSize += size;
|
currentTmpValuesSize += size;
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user