Last modified on 3 January 2015, at 06:08

SPARC Assembly/Subroutines

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

Saving RegistersEdit

Subroutine LinkageEdit

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

do_something_useful:
    ; prologue:
    save %sp, -16, %sp
 
    ; main body
    ; ... perform function ...
 
    ; leave return value, if any, in register %i0
 
    ; epilogue:
    ret
    restore

Return ValuesEdit

Further readingEdit