Available No. of Registers

Christopher Byrnes cb at mitre-bedford.arpa
Wed Jan 21 00:21:21 AEST 1987


  Several people have pointed out that the number of effective register
declarations will vary from CPU architecture to architecture.  Register
declarations can also vary from `C' compiler to `C' compiler.  I've used
several different 680x0 compilers.  One (of unknown heritage) was effective
for up to 6 "integer" or "short" data values (using 68000 registers d2 - d7
with d0 and d1 reserved for function returns and intermediate expressions)
AND it was effective for up to 3 "pointer" values (using registers a2 - a4,
with a0 and a1 reserved for function returns, a5 as a frame pointer, a6 as
the stack pointer and a7 as the program counter).  If you were carfeful,
you could have up to 9 registers in use at once.

  I'm now using the Sun `C' compiler on version 3.0 of Sun's UNIX system.
Could someone tell me what the magic numbers are for effective register
declarations on this `C' compiler.  Does the `C' optimizer do register
allocations correctly anyways (as some good compilers may do now)?  I'd
rather not have to wade through assembler listings to try and figure these
magic numbers out again.  Thanks.


/* the usual disclaimers */		Christopher Byrnes
					The MITRE Corporation
					Burlington Road
					M/S A156
					Bedford, Mass. 01730

					cb at Mitre-Bedford.ARPA
					...!decvax!linus!mbunix!cb.UUCP



More information about the Comp.lang.c mailing list