Advertisement. is a user-supported site.
As a bonus, site members have access to a banner-ad-free version of the site, with print-friendly pages.
Click here to learn more.

(Already a member? Click here.)

SPARC Integer Registers

For more, see: SPARC at Enchanted Learning

There are 32 integer registers available in the SPARC architecture. Each of these registers holds one word (32 bits) of data. All integer calculations are carried out on these 32-bit quantities.

The 32 registers are divided into four groups, with eight registers in each group. Each of the registers has two or three different names that you can call it by; the names are synonymous, so code for clarity. The name that is usually preferred is in boldface in the table below.

Table of Integer Registers
Group Register names Comments
Global registers %g0, %r0 Always contains the value 0. (It is legal to use an instruction which ostensibly stores a value in %g0; it just won't actually change %g0's value.)
%g1, %r1 Registers %g1 through %g7 are accessible globally, throughout your entire program, in all its routines.
%g2, %r2
%g3, %r3
%g4, %r4
%g5, %r5
%g6, %r6
%g7, %r7
Output registers %o0, %r8 Output registers are used to communicate with a called routine. Parameters are passed by placing them in registers %o0 through %o5 before jumping to the routine. If a called function returns a value, that value will be found in %o0 after the function returns.
%o1, %r9
%o2, %r10
%o3, %r11
%o4, %r12
%o5, %r13
%o6, %r14, %sp Stack pointer. Do not use for data.
%o7, %r15 Address for a called routine to return to. Do not use for data.
Local registers %l0, %r16 Local registers are used to store data local to a routine. Normally when a routine is called, the current local registers are saved, and a new set of local registers is allocated for the routine. When the routine returns, the old set of local registers is restored.
%l1, %r17
%l2, %r18
%l3, %r19
%l4, %r20
%l5, %r21
%l6, %r22
%l7, %r23
Input registers %i0, %r24 Input registers are used for communication with the calling routine (the routine that called the current routine). Parameters that are passed in can be read from registers %i0 through %i5. If a value is to be returned, that value should be stored in %i0 before returning.
%i1, %r25
%i2, %r26
%i3, %r27
%i4, %r28
%i5, %r29
%i6, %r30, %fp Frame pointer. Do not use for data.
%i7, %r31 Return address. Do not use for data.

Copyright 1998-1999 Enchanted Learning Software.

Enchanted Learning Search

Search the Enchanted Learning website for: