Previously we used the number of registers needed saved and pushable as the
number of pushed registers. We also use pushed register number to caculate
the stack size. It is not correct because Zcmp pushes registers from $ra to the
max register needed saved and there is no gurantee that the needed saved
registers are a sequenced list from $ra.
There is an example about that. PushPopRegs should be 6 (ra,s0 - s4)= instead of 1.
; llc -mtriple=riscv32 -mattr=+zcmp define void @foo() { entry: ; Old: .cfi_def_cfa_offset 16 ; New: .cfi_def_cfa_offset 32 tail call void asm sideeffect "li s4, 0", "~{s4}"() ret void }
Should we ues PushPopNumRegs?