What to do with lots of registers

John R. Jackson acz at pucc-k
Sat Jun 28 02:19:43 AEST 1986


Sorry this is lengthy, but here goes.

I do maintenance and development on the C compiler for the CDC Cyber
205 supercomputer.

Among other oddities about the hardware are a very large set of general
purpose registers (256 of them!).  All (non-vector) operations are
performed register to register, so it is best to have as many variables
declared register as possible.  Since most C programs do not often use
the register declaration, I need to study how to automatically promote
locals.

I am aware of some work done at HCR in this area, and would appreciate
any information they can give me.  I would also appreciate any ideas
anyone has.  I am aware of the problems of anything pointing to
anything, but it will be better to help most of the cases and then go
back and disable the promotion where it causes problems (via the auto
keyword???).

A second use of the register file could be to hold global variables.
Since most routines only have a few local variables, even promoting
everything will not use the registers fully.  One possibility I am
considering is an extension to the register declaration to specify what
register the variable should be assigned to.  Something like:

	sub (parm)
	register parm; {
		register (0x9a) global;
		.
		.
		.
	}

The register storage declaration for parm would be treated as normal,
i.e.  the next available free register will be assigned.  The global
declaration would force register #9A to be used.  Variables declared in
this way would not be saved across function calls, unless they happen
to overlap a register that will be saved anyway.  The scope would be
the routine the variable was declared in.

An alternative, or extension, would allow the register storage class to
be used outside the function body, again with the syntax extension to
specify a particular register.  The scope would then be the rest of the
source file just like any other external or static variable.

Note that I am not particularly interested in the portability issue.
My intent is to provide a performance boost for programs designed for
the 205.  This compiler already has so many syntax extensions for
vector references, one more isn't going to make any difference.

Does the C standard say anything about either of these issues?  By the
way, how do I get a copy?

Please reply by mail as much as possible, as I do not want to start a
net war about this.

Thanks in advance.

John R. Jackson				Senior 205 Systems Programmer
ARPANET: jrj at asc.Purdue.EDU		Purdue University Computing Center
     or  jrj at purdue-asc.ARPA		Mathematical Sciences Bldg.
BITNET:  JACKSON at PURCCVM		West Lafayette, IN 47907
USENET:  jrj at pucc-j.UUCP		317/494-1787



More information about the Comp.lang.c mailing list