Open kv-sc opened 5 months ago
reproduce on 1.0
snippy invocation line:
./llvm-snippy layout-stack.yaml -march=riscv64-linux-gnu -function-number=3 -function-layers=2 -num-instrs=100 -stack-size=10240 -num-instr-ancil=50 -model-plugin=None
layout-stack.yaml looks like this:
sections: - no: 1 VMA: 0x210000 SIZE: 0x100000 LMA: 0x210000 ACCESS: rx - no: 2 VMA: 0x100000 SIZE: 0x100000 LMA: 0x100000 ACCESS: rw histogram: - [ADD, 1.0] - [ADDI, 1.0] - [SUB, 1.0] - [JAL, 0.1] - [JALR, 0.1]
You will see in generated binary:
000000000000043c <fun1>: 43c: ff010113 addi sp,sp,-16 440: 01813023 sd s8,0(sp) 444: ff010113 addi sp,sp,-16 448: 01f13023 sd t6,0(sp) 44c: ff010113 addi sp,sp,-16 450: 00c13023 sd a2,0(sp) 454: ff010113 addi sp,sp,-16 458: 01a13023 sd s10,0(sp) 45c: ff010113 addi sp,sp,-16 460: 00713023 sd t2,0(sp) 464: ff010113 addi sp,sp,-16 468: 00e13023 sd a4,0(sp) ....
Granted that there is only 2 layers of functions in call graph it is possible to statically assign space for each function on stack and calculate it from scratch in the prologue.
reproduce on 1.0
snippy invocation line:
layout-stack.yaml looks like this:
You will see in generated binary:
Granted that there is only 2 layers of functions in call graph it is possible to statically assign space for each function on stack and calculate it from scratch in the prologue.