summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2001-11-11 21:23:33 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2001-11-11 21:23:33 +0000
commit1d5c6e0939a4e48911591e691a70015e8e0de6ad (patch)
treebbf3a830b0b09de2359a4ef6d6212184237945b9 /llvm/lib/CodeGen/MachineInstr.cpp
parentb3b55ae4b14b1702d443288aa9d6cd1f85a35e84 (diff)
downloadbcm5719-llvm-1d5c6e0939a4e48911591e691a70015e8e0de6ad.tar.gz
bcm5719-llvm-1d5c6e0939a4e48911591e691a70015e8e0de6ad.zip
Fix errors in computing downgrowing offsets, and in
computing size of extra outgoing args. llvm-svn: 1256
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineInstr.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index 46a80298403..b6e88059558 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -191,8 +191,9 @@ ComputeMaxOptionalArgsSize(const TargetMachine& target, const Method* method)
{
CallInst* callInst = cast<CallInst>(*I);
unsigned int numOperands = callInst->getNumOperands() - 1;
- unsigned int numExtra = numOperands
- - frameInfo.getNumFixedOutgoingArgs();
+ int numExtra = (int) numOperands - frameInfo.getNumFixedOutgoingArgs();
+ if (numExtra <= 0)
+ continue;
unsigned int sizeForThisCall;
if (frameInfo.argsOnStackHaveFixedSize())
@@ -243,11 +244,12 @@ MachineCodeForMethod::allocateLocalVar(const TargetMachine& target,
bool growUp;
int firstOffset =target.getFrameInfo().getFirstAutomaticVarOffset(*this,
growUp);
+ unsigned int size = target.findOptimalStorageSize(val->getType());
+
offset = growUp? firstOffset + getAutomaticVarsSize()
- : firstOffset - getAutomaticVarsSize();
+ : firstOffset - getAutomaticVarsSize() - size;
offsets[val] = offset;
- unsigned int size = target.findOptimalStorageSize(val->getType());
incrementAutomaticVarsSize(size);
}
return offset;
@@ -259,10 +261,11 @@ MachineCodeForMethod::allocateSpilledValue(const TargetMachine& target,
{
bool growUp;
int firstOffset = target.getFrameInfo().getRegSpillAreaOffset(*this, growUp);
+ unsigned int size = target.findOptimalStorageSize(type);
+
int offset = growUp? firstOffset + getRegSpillsSize()
- : firstOffset - getRegSpillsSize();
+ : firstOffset - getRegSpillsSize() - size;
- unsigned int size = target.findOptimalStorageSize(type);
incrementRegSpillsSize(size);
return offset;
@@ -275,18 +278,18 @@ MachineCodeForMethod::allocateOptionalArg(const TargetMachine& target,
const MachineFrameInfo& frameInfo = target.getFrameInfo();
bool growUp;
int firstOffset = frameInfo.getFirstOptionalOutgoingArgOffset(*this, growUp);
- int offset = growUp? firstOffset + getCurrentOptionalArgsSize()
- : firstOffset - getCurrentOptionalArgsSize();
-
+
int size = MAXINT;
if (frameInfo.argsOnStackHaveFixedSize())
size = frameInfo.getSizeOfEachArgOnStack();
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);
+ 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);
return offset;
@@ -305,7 +308,7 @@ MachineCodeForMethod::pushTempValue(const TargetMachine& target,
bool growUp;
int firstTmpOffset = target.getFrameInfo().getTmpAreaOffset(*this, growUp);
int offset = growUp? firstTmpOffset + currentTmpValuesSize
- : firstTmpOffset - currentTmpValuesSize;
+ : firstTmpOffset - currentTmpValuesSize - size;
currentTmpValuesSize += size;
return offset;
}
OpenPOWER on IntegriCloud