Steps in the execution of a procedure/function call:

image.png

Transfer control to the procedure: jump and link instruction

Frame: 函数在stack上分配的一块空间,用来存放局部变量、保存的寄存器等;recursive → every instance create its own frame → keep pushing frames

Save register: 防止return时lost data

image.png

image.png

Why? Easy to read!

image.png

1. RISC-V 依赖于软件调用约定:

2. 软件约定的好处:

3. 不需要遵守约定的情况:

Calling Convention

image.png