Don't pad spills and temp. stack areas for alignment.
Freeze auto vars and spill areas when their sizes are used
for computing other offsets.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2317 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/SparcV9/SparcV9TargetMachine.cpp b/lib/Target/SparcV9/SparcV9TargetMachine.cpp
index 0fe8f1e..de778e2 100644
--- a/lib/Target/SparcV9/SparcV9TargetMachine.cpp
+++ b/lib/Target/SparcV9/SparcV9TargetMachine.cpp
@@ -57,10 +57,10 @@
UltraSparcFrameInfo::getRegSpillAreaOffset(MachineCodeForMethod& mcInfo,
bool& pos) const
{
+ mcInfo.freezeAutomaticVarsArea(); // ensure no more auto vars are added
+
pos = false; // static stack area grows downwards
unsigned int autoVarsSize = mcInfo.getAutomaticVarsSize();
- if (int mod = autoVarsSize % getStackFrameSizeAlignment())
- autoVarsSize += (getStackFrameSizeAlignment() - mod);
return StaticAreaOffsetFromFP - autoVarsSize;
}
@@ -68,12 +68,13 @@
UltraSparcFrameInfo::getTmpAreaOffset(MachineCodeForMethod& mcInfo,
bool& pos) const
{
+ mcInfo.freezeAutomaticVarsArea(); // ensure no more auto vars are added
+ mcInfo.freezeSpillsArea(); // ensure no more spill slots are added
+
pos = false; // static stack area grows downwards
unsigned int autoVarsSize = mcInfo.getAutomaticVarsSize();
unsigned int spillAreaSize = mcInfo.getRegSpillsSize();
int offset = autoVarsSize + spillAreaSize;
- if (int mod = offset % getStackFrameSizeAlignment())
- offset += (getStackFrameSizeAlignment() - mod);
return StaticAreaOffsetFromFP - offset;
}