Reserved call frame

Hello,

i am trying to disable reserved call frame from the x86 backend, by setting hasReservedCallFrame function, in
lib/Target/X86/X86RegisterInfo.cpp to always return false. When doing this i get the correct frame size,
and the sub/add rsp instructions around the call correctly, but it seems that the offsets from rsp are not
correctly updated between the sub instruction and the call.

Is this some kind of a bug, or i should make more changes to disable reserved call frame ?

Here is a piece of the output of the testcase with the reservedCallFrame enabled:

BB#26: # %L51

movq 536(%rsp), %rbp
movq $-5, 536(%rsp)
movq 552(%rsp), %rsi
movq 560(%rsp), %rdx
movq 544(%rsp), %rcx
movq %rdi, (%rsp)
movq $2, 8(%rsp)
sarq $4, %rbp
leaq 128(%rsp), %rdi
movq %rbp, %r8
movq 40(%rsp), %r9 # 8-byte Reload
callq bs_put_big_integer # a function call with 5 arguments
movq 128(%rsp), %rax
movq 136(%rsp), %rcx
cmpq $0, 144(%rsp)
movq %rcx, 560(%rsp)
movq %rax, 552(%rsp)
jne .LBB0_30

And the same piece of code with reservedCallFrame disabled:

BB#26: # %L51

movq 520(%rsp), %rbp
movq $-5, 520(%rsp)
movq 536(%rsp), %rsi
movq 544(%rsp), %rdx
movq 528(%rsp), %rcx
subq $16, %rsp
movq %rdi, (%rsp)
movq $2, 8(%rsp)
sarq $4, %rbp
leaq 112(%rsp), %rdi
movq %rbp, %r8
movq 24(%rsp), %r9 # 8-byte Reload
callq bs_put_big_integer # a function call with 5 arguments
addq $16, %rsp
movq 112(%rsp), %rax
movq 120(%rsp), %rcx
cmpq $0, 128(%rsp)
movq %rcx, 544(%rsp)
movq %rax, 536(%rsp)
jne .LBB0_30

Thanks
Chris Stavrakakis

gen2_3-no_reserved_cf.s (10.5 KB)

gen2_3-vanilla.s (10.5 KB)

gen2_3.ll (18.1 KB)

Hello

Is this some kind of a bug, or i should make more changes to disable
reserved call frame ?

I believe that the prologue / epilogue emission code and callframe
setup / destroy node elimination code assumes the particular "type" of
call frame and simple not implemented for other type. So, you have to
implement it by yourself.