aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineFunction.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2010-07-04 18:52:05 +0000
committerEvan Cheng <evan.cheng@apple.com>2010-07-04 18:52:05 +0000
commitf3aeb2c22c9e898955450f38bd0d128ac9ce8809 (patch)
tree26a1347514cadb1502f5625f1f02a00675eb2e60 /llvm/lib/CodeGen/MachineFunction.cpp
parent238bc001ca934cbbb059614ec8b358c68859c639 (diff)
downloadllvm-f3aeb2c22c9e898955450f38bd0d128ac9ce8809.zip
llvm-f3aeb2c22c9e898955450f38bd0d128ac9ce8809.tar.gz
llvm-f3aeb2c22c9e898955450f38bd0d128ac9ce8809.tar.bz2
Infer alignments of fixed frame objects when they are constructed. This ensures remat'ed loads from fixed slots have the right alignments.
llvm-svn: 107591
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineFunction.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp
index 5b03156..31c3d0f 100644
--- a/llvm/lib/CodeGen/MachineFunction.cpp
+++ b/llvm/lib/CodeGen/MachineFunction.cpp
@@ -440,7 +440,13 @@ MCSymbol *MachineFunction::getJTISymbol(unsigned JTI, MCContext &Ctx,
int MachineFrameInfo::CreateFixedObject(uint64_t Size, int64_t SPOffset,
bool Immutable) {
assert(Size != 0 && "Cannot allocate zero size fixed stack objects!");
- Objects.insert(Objects.begin(), StackObject(Size, 1, SPOffset, Immutable,
+ // The alignment of the frame index can be determined from its offset from
+ // the incoming frame position. If the frame object is at offset 32 and
+ // the stack is guaranteed to be 16-byte aligned, then we know that the
+ // object is 16-byte aligned.
+ unsigned StackAlign = TFI.getStackAlignment();
+ unsigned Align = MinAlign(SPOffset, StackAlign);
+ Objects.insert(Objects.begin(), StackObject(Size, Align, SPOffset, Immutable,
/*isSS*/false));
return -++NumFixedObjects;
}