SPARC Assembly/Subroutines

From Wikibooks, open books for an open world
Jump to navigation Jump to search

This page is going to discuss the use of subroutines in SPARC Assembly.

Saving Registers[edit]

Subroutine Linkage[edit]

A typical (non-leaf) subroutine has a procedure prologue and epilogue something like this:[1][2]

    ; prologue:
    save %sp, -16, %sp

    ; main body
    ; ... perform function ...

    ; leave return value, if any, in register %i0

    ; epilogue:

Return Values[edit]

Further reading[edit]