aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/SparcV9/SparcV9TargetMachine.cpp
diff options
context:
space:
mode:
authorVikram S. Adve <vadve@cs.uiuc.edu>2001-11-12 23:26:35 +0000
committerVikram S. Adve <vadve@cs.uiuc.edu>2001-11-12 23:26:35 +0000
commit00521d79bf4ee009f59e726a5eb227e04075f5c8 (patch)
treec0067df4fa3325297553e3dd0d1845327d76e326 /lib/Target/SparcV9/SparcV9TargetMachine.cpp
parente492c9d4d1a161cd0972bfb8bab33f073fb018b4 (diff)
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
Diffstat (limited to 'lib/Target/SparcV9/SparcV9TargetMachine.cpp')
-rw-r--r--lib/Target/SparcV9/SparcV9TargetMachine.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/Target/SparcV9/SparcV9TargetMachine.cpp b/lib/Target/SparcV9/SparcV9TargetMachine.cpp
index b6bf94f81e..20bad83dfc 100644
--- a/lib/Target/SparcV9/SparcV9TargetMachine.cpp
+++ b/lib/Target/SparcV9/SparcV9TargetMachine.cpp
@@ -193,7 +193,8 @@ UltraSparcSchedInfo::initializeResources()
//
// Purpose:
// 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
@@ -210,7 +211,9 @@ UltraSparcFrameInfo::getRegSpillAreaOffset(MachineCodeForMethod& mcInfo,
{
pos = false; // static stack area grows downwards
unsigned int autoVarsSize = mcInfo.getAutomaticVarsSize();
- return StaticAreaOffsetFromFP - autoVarsSize;
+ if (int mod = autoVarsSize % getStackFrameSizeAlignment())
+ autoVarsSize += (getStackFrameSizeAlignment() - mod);
+ return StaticAreaOffsetFromFP - autoVarsSize;
}
int
@@ -220,7 +223,10 @@ UltraSparcFrameInfo::getTmpAreaOffset(MachineCodeForMethod& mcInfo,
pos = false; // static stack area grows downwards
unsigned int autoVarsSize = mcInfo.getAutomaticVarsSize();
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
@@ -229,7 +235,9 @@ UltraSparcFrameInfo::getDynamicAreaOffset(MachineCodeForMethod& mcInfo,
{
// dynamic stack area grows downwards starting at top of opt-args area
unsigned int optArgsSize = mcInfo.getMaxOptionalArgsSize();
- return optArgsSize + FirstOptionalOutgoingArgOffsetFromSP;
+ int offset = optArgsSize + FirstOptionalOutgoingArgOffsetFromSP;
+ assert(offset % getStackFrameSizeAlignment() == 0);
+ return offset;
}