ado@elsie.UUCP (Arthur David Olson) (11/30/85)
As documented on the 4.1BSD "cc" manual page, "The compiler currently ignores advice to put char, unsigned char, short or unsigned hsort variables in registers. It previously produced poor, and in some cases incorrect, code for such declarations." Since the smart folks at Berkeley were unable to fix the problem, I figure the best way to deal with it is a work-around. The notion I've come up with is to allow the "first pass" (which lives in the same executable as the "second pass" on 4.1BSD systems) to put shorts (et al.) into registers. Then, just before code is generated in the "second pass" (specifically, at the beginning of "p2compile") you'd change nodes whose "op"s were "REG" and whose "type"s were "short" (et al.) into "NAME" nodes--and would fill the "name" field of the node with the string "r5" or "r6" or whatever. The theory is that if the compiler produces correct code for non-register shorts (et al.) then it will produces correct code for register shorts provided that you make them look like non-register shorts. In testing out this approach, it would be a help to have samples of source code that caused the compiler to produce "poor, and in some cases incorrect, code." If you have such samples, I'd appreciate you mailing them to me. Thanks. -- UNIX is an AT&T Bell Laboratories trademark. C is a Mel Blanc/Jack Benny trademark. -- UUCP: ..decvax!seismo!elsie!ado ARPA: elsie!ado@seismo.ARPA DEC, VAX and Elsie are Digital Equipment and Borden trademarks