Re: SPARC code generation for compiler course (Daniel J. Salomon)
Mon, 13 Dec 1993 18:10:53 GMT

          From comp.compilers

Related articles
SPARC code generation for compiler course (1993-12-10)
Re: SPARC code generation for compiler course (1993-12-13)
Re: SPARC code generation for compiler course chase@Think.COM (1993-12-13)
Re: SPARC code generation for compiler course (1993-12-14)
Sparc Architecture (1993-12-14)
Summary of Information Available on Sparc-family processors (1993-12-14)
Re: SPARC code generation for compiler course (1993-12-15)
Re: SPARC code generation for compiler course (1993-12-16)
[3 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers,comp.arch
From: (Daniel J. Salomon)
Keywords: architecture, courses, sparc
Organization: Computer Science, University of Manitoba, Winnipeg, Canada
References: 93-12-040
Date: Mon, 13 Dec 1993 18:10:53 GMT (Wesley Mackey ) writes:
> I'm teaching a course in code generation next quarter and am looking for
> SPARC documention which is more student oriented than the hardware
> manuals. I need a more cookbook approach along with an architectural
> description that can be passed out to students without expecting them to
> read for hours and hours.

I have used the SPARC architecture manual in my course without too much
trouble. I give them an introduction to the SPARC architecture and some
sample programs so they don't have to read "for hours and hours." They
just use the architecture manual as a reference. They also need the
assembler language reference manual available in the online "answerbook".
Let me know if you do find a briefer introduction, though, if it is less
expensive than the architecture manual.

> Also, is there any documentation about %global and %floating register
> conventions? I've seen a reference to a SPARC ABI, but nothing complete.

The SPARC ABI is available as:
"AT&T System V Application Binary Interface: SPARC Processor Supplement"
published by UNIX Press (a special sales division of Prentice-Hall)
ISBN 0-13-877630-X
Do not have the students buy this manual because it is quite expensive,
and there are only a few sentences of information that are not available
in other manuals.

> Specifically, are [the registers] caller-preserved or callee-preserved?
> Use of the %o, %l, %i regs are obvious from the architecture.

The floating registers are caller-preserved. The %o, %l, and %i registers
are rotated by the callee to obtain a new window in the register bank, and
so are not saved explicitly by either the caller or the callee. If the
register bank is full, the reused window is saved on the stack
automatically by the hardware. The global registers have the following
        %g0 always contains zero
        %g1 very volatile, a general purpose short term temporary register.
        %g2, %g3, and %g4 for use by the programmer
        %g5, %g6, and %g7 reserved for the operating system.

Inspecting the code generated by the C compiler can also answer some
other questions although sometimes it can get pretty mysterious.

> Any detailed description of the memory stack frame conventions?

The stack frame conventions are given in the SPARC Architecture Manual
Appendix D, and again in the ABI. One important point is not to use the
program stack for temporaries. The SPARC expects the stack structure to
be consistent at all times so it can save overflow register windows

It does take quite a while to get this information nailed down properly.
I was teaching the course for three years before I finally got the
majority of the class to hand in completed compiler projects that include
user defined procedures with parameters.
Daniel J. Salomon -- salomon@cs.UManitoba.CA
              Dept. of Computer Science / University of Manitoba
              Winnipeg, Manitoba, Canada R3T 2N2 / (204) 474-8687

Post a followup to this message

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