[llvm-dev] Stackmap offset computation on AArch64

Loïc Ottet via llvm-dev llvm-dev at lists.llvm.org
Fri Jul 26 02:55:42 PDT 2019


Hi all,

I am trying to implement statepoints for the AArch64 target and I’m running into the issue where the following bitcode:

define i32 addrspace(1)* @test(i32 addrspace(1)* %ptr) gc "statepoint-example" {
entry:
  call token (i64, i32, i1 ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_i1f(i64 0, i32 0, i1 ()* @foo, i32 0, i32 0, i32 0, i32 0, i32 addrspace(1)* %ptr)
  ret i32 addrspace(1)* %ptr
}

This gets emitted as the following assembly code:

test:                                   // @test
	.cfi_startproc
// %bb.0:                               // %entry
	str	x30, [sp, #-16]!        // 8-byte Folded Spill
	.cfi_def_cfa_offset 16
	.cfi_offset w30, -16
	str	x0, [sp, #8]
	bl	return_i1
.Ltmp0:
	ldr	x0, [sp, #8]
	ldr	x30, [sp], #16          // 8-byte Folded Reload
	ret
.Lfunc_end0:
	.size	test, .Lfunc_end0-test
	.cfi_endproc

The generated stackmap indicates that %ptr is located at offset -8 from the stack pointer, instead of the expected 8. After trying a few other configurations it happens that the offsets are computed relative to the stack pointer of the parent frame instead of the current one.

Can someone point me to the place where the stackmap offsets get computed so I can try to debug this?

Thanks,

Loïc Ottet


More information about the llvm-dev mailing list