|Register windows and nested procedures Mike.Spivey@comlab.oxford.ac.uk (1994-12-12)|
|Keywords:||sparc, code, registers, comment|
|Date:||Mon, 12 Dec 1994 10:51:36 GMT|
Does anyone have experience in building a code generator for a
Pascal-like language on the Sparc?
I'm building a compiler to use in teaching, so I want it to be as
simple as possible, while illustrating a good range of language
features. The source language has nested procedures, so parameters
and local variables of outer procedures must be addressable from inner
procedures. That means they can't always be kept in registers, and I
don't want to do the global analysis needed to find out which objects
can live in registers and which must be in memory.
It seems to me that unless we can keep plenty of values in registers
across a procedure call, then there's no point in using register
windows at all -- in fact, with recursive programs that don't keep
most of the registers full, register windows will make matters much
So I'm considering ignoring the register windows -- with mixed
feelings, because I don't want to be unfaithful to the style of the
Sparc, but I also don't want the style of the compiler be so highly
Sparc-specific that it doesn't provide a prototype for other target
Why generate Sparc code? Because my students have Sparcs on their
desks, and I can't resist the motivating excitement of generating code
that they can run on the real machine in front of them.
-- Mike Spivey, University of Oxford.
[It is my impression that when the folks at Berkeley were designing the
proto-SPARC the compiler they were using was PCC. PCC is real dumb about
procedure calls, and blindly saves every register that might be clobbered.
I recall an IBM tech report on the 801 or one of its descendants in which they
said that they considered windows but decided against them because they could
minimize the register save traffic in the compiler well enough that windows
are an overall loss. This probably explains why few of the more recent RISC
designs use windows. -John]
Return to the
Search the comp.compilers archives again.