Stream: cranelift

Topic: Nominal SP question


view this post on Zulip Théo Degioanni (Nov 12 2022 at 17:51):

Hey! Here is a small question: I am having trouble understanding what nominal SP is, is there a good place I could read about it? I can't find where it's used and its purpose is not very clear to me.

view this post on Zulip bjorn3 (Nov 14 2022 at 12:20):

Probably the value stack pointer outside of the prologue and epilogue.

view this post on Zulip Jamey Sharp (Nov 14 2022 at 16:50):

I see comments like the following in some of Cranelift's backends; does that help?

    ;; Offset from the "nominal stack pointer", which is where the real SP is
    ;; just after stack and spill slots are allocated in the function prologue.
    ;; At emission time, this is converted to `SPOffset` with a fixup added to
    ;; the offset constant. The fixup is a running value that is tracked as
    ;; emission iterates through instructions in linear order, and can be
    ;; adjusted up and down with [Inst::VirtualSPOffsetAdj].
    ;;
    ;; The standard ABI is in charge of handling this (by emitting the
    ;; adjustment meta-instructions). It maintains the invariant that "nominal
    ;; SP" is where the actual SP is after the function prologue and before
    ;; clobber pushes. See the diagram in the documentation for
    ;; [crate::isa::aarch64::abi](the ABI module) for more details.

Last updated: Dec 23 2024 at 12:05 UTC