[LLVMdev] x86-64 large stack offsets

Jakob Stoklund Olesen stoklund at 2pi.dk
Mon Sep 26 13:34:58 PDT 2011


On Sep 26, 2011, at 12:02 PM, Cameron McInally wrote:
> 
> Here's one of the offending instructions produced by 2.9:
> 
> movsd   -2147482472(%rsp), %xmm0
> 
> Fixing the displacement overflow is pretty easy. It's just a matter of changing a few variable types in LLVM from unsigned to uint64_t in the functions that calculate the stack offsets. The real trouble I'm having
> is finding a good place to break up the displacements during lowering. I would like the offset to be calculated similar to gcc:
> 
> movabsq $-4294969640, %rdx
> movsd     0(%rbp,%rdx), %xmm0
> 
> Any suggestions on the correct lowering pass to do a transformation like this? I'm an LLVM noob, so I'm not sure where it should go.

Hi Cameron,

As you have noticed, the x86 backend only supports stack frames up to 2GB.

Fixing that would require the x86 backend to use the register scavenger during prolog epilog insertion like the ARM backend does.  That particular code was very difficult to get right, and no one has thought it was worth the trouble to get it working for x86.

Your life will be a whole lot easier if you just use malloc().

/jakob




More information about the llvm-dev mailing list