Re: SPARC code generation for compiler course

pardo@cs.washington.edu (David Keppel)
Fri, 17 Dec 1993 00:04:38 GMT

          From comp.compilers

Related articles
[2 earlier articles]
Re: SPARC code generation for compiler course chase@Think.COM (1993-12-13)
Re: SPARC code generation for compiler course markt@harlequin.co.uk (1993-12-14)
Re: SPARC code generation for compiler course salomon@silver.cs.umanitoba.ca (1993-12-15)
Re: SPARC code generation for compiler course pardo@cs.washington.edu (1993-12-16)
Re: SPARC code generation for compiler course nickh@harlequin.co.uk (1993-12-16)
Re: SPARC code generation for compiler course chase@Think.COM (1993-12-16)
Re: SPARC code generation for compiler course pardo@cs.washington.edu (1993-12-17)
| List of all articles for this month |
Newsgroups: comp.compilers,comp.arch
From: pardo@cs.washington.edu (David Keppel)
Keywords: sparc, architecture
Organization: Computer Science & Engineering, U. of Washington, Seattle
References: 93-12-040 93-12-072
Date: Fri, 17 Dec 1993 00:04:38 GMT

nickh@harlequin.co.uk (Nick Haines) writes:
>[Which SPARC %g registers are caller-save?]


My reading of page 192 of


%T The SPARC\s-2\uTM\d\s+2 Architecture Manual, Version 8
%Q SPARC International
%I Prentice Hall
%D 1992


is that


%g0 is always zero
%g1 is caller-save
%g2-%g4 are reserved for application use
%g5-%g7 are reserved for OS use


The application can use any protocol for %g2-%g4. Most applications today
ignore them. However, %g2-%g4 may, for example, contain values that are
changed in the callee, and used in the caller. Or, they could be used as
caller-save or as callee-save registers. Or, they might have values used
asynchronously and, therefore, could never otherwise be modified by the
application. Finally, the registers could be used one way in one part of
the application and a different way in another part of the application.
However, any such use is assumed to be per-application and the usage
conventions are assumed to be pervasive throughout the application.


%g5-%g7 are used by the ABI. They have arbitrary values that are changed
at arbitrary times (e.g., by asynchronous signal handlers) and must not be
modified by an application. Any application that writes these registers
is noncompliant.


That's my reading of it, anyway.




>[How does the ABI cope with non-conforming code?]


It promises nothing; it likewise promises nothing if you read a register
without first writing it.




You might also want to read


%Q AT&T
%T System V Application Binary Interface SPARC Processor Supplement
%D 1990
%I Prentice-Hall


I don't have a copy of it, so I don't know it has more to say about
register conventions.


;-D on ( It finally registered... ) Pardo
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.