jonathan.forbes@canremote.uucp (JONATHAN FORBES) (12/21/89)
Using Lattice C 5.04, how many register variables can I allocate within a function? Is it two data registers and two address registers, or more/less? i.e.: register UBYTE x; register ULONG y; register UBYTE *p; register ULONG *q; being the limit? --- * Via ProDoor 3.1R
mwm@raven.pa.dec.com (Mike (With friends like these, who needs hallucinations) Meyer) (01/03/90)
>> Using Lattice C 5.04, how many register variables can I allocate within >> a function? As many as you want. Like all C compilers, it ignores the ones it doesn't implement. Unlike most others, it doesn't implement any. The compiler thinks it can do a better job of keeping stuff in the registers by using them as cache than you can by tagging specific variables as registers. <mike -- When logic and proportion have fallen softly dead, Mike Meyer And the white knight is talking backwards, mwm@berkeley.edu And the red queen's off her head, ucbvax!mwm Remember what the dormouse said. mwm@ucbjade.BITNET
farren@well.UUCP (Mike Farren) (01/04/90)
Mike (With friends like these, who needs hallucinations) Meyer writes: >The [Lattice] compiler thinks it can do a better job of keeping stuff in >the registers by using them as cache than you can by tagging specific >variables as registers. O.K., but is it correct? Has anyone done an analysis of Lattice code to be able to tell if this is Good or Bad? -- Mike Farren farren@well.sf.ca.usa
riley@batcomputer.tn.cornell.edu (Daniel S. Riley) (01/11/90)
In article <15315@well.UUCP> farren@well.UUCP (Mike Farren) writes: >Mike (With friends like these, who needs hallucinations) Meyer writes: >>The [Lattice] compiler thinks it can do a better job of keeping stuff in >>the registers by using them as cache than you can by tagging specific >>variables as registers. >O.K., but is it correct? Has anyone done an analysis of Lattice code >to be able to tell if this is Good or Bad? I don't think the Lattice compiler completely ignores "register" declarations. It may take them as advisory information only, but I have certainly seen code change with 5.0 when I changed what variables were declared register. Does it do a good job? Yes, in most cases. I have found that I usually get the best code by not declaring any register variables and letting the optimizer do its work. In some special cases, it helps to give the optimizer some hints by declaring register variables, but generally it does a pretty good job. As a side note on "register" and program semantics, remember that you can't take the address of a register variable. Some compilers that don't otherwise respect register declarations use this information to modify the assumptions made by the optimizer (I believe the MIPS C compiler does this). -Dan Riley (riley@tcgould.tn.cornell.edu, cornell!batcomputer!riley) -Wilson Lab, Cornell University