[llvm-dev] best way to represent function call with new stack in LLVM IR?

whitequark via llvm-dev llvm-dev at lists.llvm.org
Thu May 10 21:27:32 PDT 2018


On 2018-05-11 03:23, Andrew Kelley wrote:
> Thanks,I'll try this:
> 
> %0 = @llvm.stacksave
> @llvm.write_register ; set the new stack pointer
> 
> call ; hopefully this uses the new stack pointer for stack arguments
> 
> @llvm.stackrestore %0

This should work.

> 
> Looks like `llvm.write_register` only works on ARM, AArch64, PowerPC
> and x86_64. This is concerning - do the other architectures not allow
> modification of the stack register? Or is this a TODO item in LLVM?

This is just not implemented. It should be a simple backend change
and applicable to most backends (excluding e.g. WASM and GPU ones).

-- 
whitequark


More information about the llvm-dev mailing list