X86: Align the stack on word boundaries in LowerFormalArguments()
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 20 Aug 2014 19:40:59 +0000 (19:40 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 20 Aug 2014 19:40:59 +0000 (19:40 +0000)
commit5012f1db20d583a1fc36a334200842eb0b945902
tree648cb8b90f8354f16c3a87f0c996c06972f426c0
parentada5f2a2c751a11f771cfbca690a769ca1f219c1
X86: Align the stack on word boundaries in LowerFormalArguments()

The goal of the patch is to implement section 3.2.3 of the AMD64 ABI
correctly.  The controlling sentence is, "The size of each argument gets
rounded up to eightbytes.  Therefore the stack will always be eightbyte
aligned." The equivalent sentence in the i386 ABI page 37 says, "At all
times, the stack pointer should point to a word-aligned area."  For both
architectures, the stack pointer is not being rounded up to the nearest
eightbyte or word between the last normal argument and the first
variadic argument.

Patch by Thomas Jablin!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216119 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/CallingConvLower.h
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/aligned-variadic.ll [new file with mode: 0644]