2

I'm trying to optimize my Solana program to minimize stack accesses.

How do the C/Rust compilers arrange function call arguments on an assembly level?

Specifically, what registers get used for transferring arguments, what registers are preserved, and how does a stack frame on SBFv2 typically look?

uint64_t call (
    uint64_t v1,
    uint64_t v2,
    uint64_t v3,
    uint64_t v4,
    uint64_t v5,
    uint64_t v6,
    ...
);

1 Answer 1

2

From what I could find, the GPRs r1, r2, r3, r4 are used for 64-bit arguments. r5 is set to the frame pointer. The other GPRs are preserved. (Except r11, the stack pointer)

The rest is placed on the stack with 8 byte alignment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.