rwl@uvacs.UUCP (Ray Lubinsky) (07/10/85)
-- OK, I don't mind giving the complier some hints about what variables to turn into registers, but how many register variables can I declare in a function on the VAX 11/780? Usefully, that is. Is the number different than the number of registers available for user programs? Might as well reply by net -- I'm sure there are a lot of C fans out there on VAXen that would want to know, too. ADVthanksANCE! -- Ray Lubinsky University of Virginia, Dept. of Computer Science uucp: decvax!mcnc!ncsu!uvacs!rwl
arnold@ucsfcgl.UUCP (Ken Arnold%CGL) (07/16/85)
In article <2238@uvacs.UUCP> rwl@uvacs.UUCP (Ray Lubinsky) writes: >-- >OK, I don't mind giving the complier some hints about what variables to turn >into registers, but how many register variables can I declare in a function on >the VAX 11/780? Usefully, that is. Is the number different than the number of >registers available for user programs? Usefully, you can declare almost all of your variables to be register. We just went through all this. Since code written on one machine is very often taken to others, and the word "register" isn't very hard to type, you should declare almost everything a register. Even data types you don may not think fit in registers, like strucutures, enums, doubles, and unions. However, to answer the question -- 5. The rest of the registers are used for temporary values and other special purposes. Ken Arnol
chris@umcp-cs.UUCP (Chris Torek) (07/17/85)
>>... but how many register variables can I declare in a function on >>the VAX 11/780? >... >However, to answer the question -- 5. (Much as I hate to repeat myself....) In probably all the PCC derived Vax C compilers, the number is 6, not 5. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251) UUCP: seismo!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@maryland
guy@sun.uucp (Guy Harris) (07/18/85)
> However, to answer the question -- 5.
Or is it 6? (I can't get onto "sunvax" to test this.) R0 through R5 are
temporary (those are the ones that can be destroyed by "movc5" instructions
and the like), R15 is the PC, R14 is the SP, R13 is the FP, and R12 is the
AP (or possibly the other way around for the last two), leaving R6 through
R11 for register variables.
BTW, for the information of the orignal poster, the answer is the same on
the VAX-11/750, VAX-11/730, VAX-11/725, MicroVAX I, MicroVAX II, VAX 8600,
etc., etc.; it's a computer family so the answer should be the same for all
machines.
Guy Harris
brooks@lll-crg.ARPA (Eugene D. Brooks III) (07/18/85)
> >into registers, but how many register variables can I declare in a function on > >the VAX 11/780? Usefully, that is. Is the number different than the number of > > However, to answer the question -- 5. The rest of the registers are Strange answer! My version of Vax pcc allows 6, with each double precision value taking up 2.
dws@tolerant.UUCP (Dave W. Smith) (07/19/85)
> >>... but how many register variables can I declare in a function on > >>the VAX 11/780? > > In probably all the PCC derived Vax C compilers, the number is 6, > not 5. A little known fact about PCC based C compilers is that you can recycle registers with a function by using nested scopes. Example (for 11/780): f() { register int foo; /* r11 */ { register int bar; /* r10 */ ... } { register int baz; /* r10 */ ... } } -- David W. Smith {ucbvax}!tolerant!dws Tolerant Systems, Inc. 408/946-5667
arnold@ucsfcgl.UUCP (Ken Arnold%CGL) (07/20/85)
In article <704@lll-crg.ARPA> brooks@lll-crg.ARPA (Eugene D. Brooks III) writes: >>>into registers, but how many register variables can I declare in a function >>>on the VAX 11/780? Usefully, that is. >> >> However, to answer the question -- 5. The rest of the registers are > >Strange answer! My version of Vax pcc allows 6, with each double precision >value taking up 2. Okay, already! I made a typo! I was concentrating on the first part of the message, about how this is an irrelevant piece of information. I just didn't proof this part, obviously. Mea culpa! (How many times can I write on the bullitin board "6, not 5"?) Ken Arnold