Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site hou5e.UUCP Path: utzoo!watmath!clyde!burl!hou3c!hocda!houxm!hogpc!houti!ariel!hou5f!hou5e!tgg From: tgg@hou5e.UUCP Newsgroups: net.arch,net.lang.c Subject: Re: RISC perspective Message-ID: <936@hou5e.UUCP> Date: Tue, 13-Mar-84 19:21:02 EST Article-I.D.: hou5e.936 Posted: Tue Mar 13 19:21:02 1984 Date-Received: Wed, 14-Mar-84 19:49:13 EST References: <27900009@ucbesvax.UUCP> <26@utastro.UUCP>, <1797@rlgvax.UUCP> Organization: AT&T Information Systems Laboratories, Holmdel, NJ Lines: 38 >The idea is good, but there's one problem with its current implementation; >there's no way to make those hints truly "machine-independent". The problem >is that you want to use all the registers you can (actually, there's even >a tradeoff here; you get extra performance from instructions referencing >registers, but you do have to save and restore those registers, and if you >have complicated expressions you may run out of scratch registers and be >forced to use temporaries in memory), but "all the registers you can" is >machine-dependent. On the PDP-11, "all the registers you can" in the Ritchie >and Johnson compilers is 3; on the VAX-11, it's 6, and on the M68000, it's >(at least on our compiler) 6 registers not containing pointers and four >registers containing pointers. Just declaring everything you can to be >"register" wins only if 1) there are enough registers to satisfy your requests >or 2) the variables that will cause the greatest improvement when put in >registers are assigned to registers first, and the less important ones cause >the compiler to ignore the "register" declaration. > > > Guy Harris > {seismo,ihnp4,allegra}!rlgvax!guy No no no - you're taking the meaning of 'register' too literally! It does not mean that the compiler is forced to use a register for these variables, it just means that you're giving it a hint that these variables are more likely to be referenced than other variables. If that means that, for the machine at hand, the variables should be three's complimented and stored in reverse bit order starting at memory location 3fd3.8 (octal) because that is the absolute best place to store an integer for speedy calculations, then the compiler should do that for 'register' variables. Let the compiler worry about what to do if it runs out of registers or other resources. The point is that 'register' exists to differentiate some variables from others so that a compiler can make some reasonable tradeoffs if possible. Making every variable in a program 'register' isn't any good because their *all* important. If you want overall optimization, make a better optimizer. Personally, I think that 'register' should have been changed to 'fast' or something like it long ago... Tom Gulvin ABI - Holmdel