Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site elsie.UUCP Path: utzoo!watmath!clyde!cbosgd!ihnp4!qantel!lll-crg!seismo!elsie!ado From: ado@elsie.UUCP (Arthur David Olson) Newsgroups: net.unix-wizards,net.wanted Subject: Help wanted with C/4.?BSD/VAX register short problem Message-ID: <5300@elsie.UUCP> Date: Fri, 29-Nov-85 19:11:24 EST Article-I.D.: elsie.5300 Posted: Fri Nov 29 19:11:24 1985 Date-Received: Sun, 1-Dec-85 03:21:03 EST Followup-To: poster Organization: NIH-LEC, Bethesda, MD Lines: 26 Keywords: C VAX BSD register short Xref: watmath net.unix-wizards:15922 net.wanted:7664 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