Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!world!iecc!compilers-sender From: salomon@ccu.umanitoba.ca (Dan Salomon) Newsgroups: comp.compilers Subject: Re: SPARC references Keywords: SPARC, optimize, code Message-ID: <1991Mar29.214751.3045@ccu.umanitoba.ca> Date: 29 Mar 91 21:47:51 GMT References: <1991Mar20.222801.11711@cs.cornell.edu> <1991Mar24.222923.10183@ccu.umanitoba.ca> <1991Mar28.115715.3545@maths.bath.ac.uk> Sender: compilers-sender@iecc.cambridge.ma.us Reply-To: salomon@ccu.umanitoba.ca (Dan Salomon) Organization: University of Manitoba, Winnipeg, Canada Lines: 49 Approved: compilers@iecc.cambridge.ma.us In article <1991Mar28.115715.3545@maths.bath.ac.uk> John ffitch writes: >There was reference to a book by Dewar and Smosna which compared SPARC and >MIPS. Does anyone know the publisher? I have been unable to trace it in >our library. I was the original poster of the information. Unfortunately my copy was lent out at the time so all I could provide were the authors last names and the title. Here is the full reference: Microprocessors: A Programmers View Robert B.K. Dewar & Matthew Smosna McGraw Hill (c) 1990 ISBN 0-07-016639-0 >So far my experience of SPARC has been less than good, as >the explanation in the Architecture manual leaves a lot to the >imagination. Some thing which really explained what happens to the stack >or window roll, how va_args is supposed to work, and so on would be really >helpful. You won't find that kind of detail in Dewar and Smosna. Check out the manual "Porting Software to SPARC Sytems" that comes bound with the "Assembler Language Reference Manual". It has a little information on this topic in the section "Porting C Programs" and the subsection on varargs(). >In my code someone keeps trampling on the stack, and honest guv' >it's not me! This is indeed a "gotcha" of programming on the SPARC. If you read the specifications of the calling conventions carefully (in the appendix called "Software Considerations" of the architecture manual) you will find that the top of the stack must at all times contain 23 words that can be clobbered by called procedures. So any space that you use on the stack must have been allocated below the stack top by the SAVE instruction. The difficulty that I have had is in finding specific details on the calling conventions that the C compiler uses. I believe, for instance, that it will say that the caller, not the callee, is responsible for saving the floating-point registers. -- Dan Salomon -- salomon@ccu.UManitoba.CA Dept. of Computer Science / University of Manitoba Winnipeg, Manitoba, Canada R3T 2N2 / (204) 275-6682 -- Send compilers articles to compilers@iecc.cambridge.ma.us or {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.