From: mjs@hpfcso.FC.HP.COM (Marc Sabatella) Date: Wed, 10 Apr 1991 20:20:55 GMT Subject: Re: Optimising C compiler question Message-ID: <8840026@hpfcso.FC.HP.COM> Organization: Hewlett-Packard, Fort Collins, CO, USA Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!hp-col!hpldola!hpysllb!hpyhde4!hpcc05!hplabs!hpfcso!mjs Newsgroups: comp.arch References: <1991Apr8.193155.3911@vax5.cit.cornell.edu> Lines: 23 >|> Are modern RISC compilers sufficiently good that they automatically make >|> sensible choice of register variables? [...] > >No. At least I've not seen any that good. The problem is that _any_ >use of the address of a variable requires turning off the register >atrtribute - even call by reference to a procedure. Unless the compiler >keeps track of all uses of all variables, it can't identify those that >can be made register variables. Come on, Jim, you know better than this. Determining which variables are *candidates* for register allocation is TRIVIAL. While the actual allocation may not be as good as you can do by hand (since you have dynamic information, like how many times that loop will really be executed), it is usually almost as good as randomly putting "register" on most or all locals would do. > Most compilers optimize on the 'basic >block' level - and don't know much about the use of variables outside >that level (except for the declaraction). Still, as you say, a _really_ >good compiler would make the register attribute redundant. Translation - any compiler taking advatntage of basic global optimization techniques you can read about in your favorite Dragon book. Certainly any compiler for a RISC chip.