[LLVMdev] stack alignment and backend

JP corniceresearch.com-jpbonn-keyword-llvm.7c175e at corniceresearch.com
Thu Oct 27 14:19:27 PDT 2011


I'm running into the same problem mentioned here:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-February/038027.html
but I think the underlying problem is different from what he mentions.

The stack on the processor I'm working on is aligned to 4 bytes per the 
ABI but stack objects can be created with higher alignments (datalayout 
of i64:32:32). As an example, I'm running into a test case where an i64 
is aligned to 8 bytes but the stack pointer is only 4 byte aligned.  I 
see that the offsets of the frame index is being aligned to the proper 8 
byte alignment but generated code seems to assume the stack pointer is 8 
byte aligned - I don't see any code to force the alignment to the 8 byte 
boundry.  I seem to be missing some step in the backend to maintain the 
alignment.

Am I missing something when I'm eliminating the frame indices? Is the 
stack pointer supposed to get adjusted to the higher alignment in the 
prologue?  Is the i64 store (which is aligned to 8 bytes) supposed to 
truncate the lower address bits?



More information about the llvm-dev mailing list