Path: chuka.playstation.co.uk!scea!sumner From: sumner@austin.metrowerks.com (Joel Sumner) Newsgroups: scee.yaroze.programming.codewarrior Subject: Re: register variables Date: Tue, 14 Apr 1998 14:46:59 -0500 Organization: Metrowerks Lines: 28 Message-ID: References: <01bd6477$65581880$c20f93c3@default> NNTP-Posting-Host: mtwks182.metrowerks.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Newsreader: Yet Another NewsWatcher 2.4.0 In article <01bd6477$65581880$c20f93c3@default>, "Jon Prestidge (alias Moose)" wrote: >With CodeWarrior:- > When you declare 'register' variables, how many are likely to acually >be registers >when the compiled/linked program is running? I can't find anything about >this in the targeting PS manual. Also does the compiler assign registers >to register variables in the order they are declared... meaning you should >declare your most heavily used variables as register variables first? The keyword "register", like "inline" is just a recommendation to the compiler. However, the compiler does take it pretty seriously. In general, a "register" variable will be placed into a register and not into memory. There are possible cases where it will not put it in a register though (typically when it is out of registers). The compiler will automatically place as many variables as it can in registers in higher optimization levels. It will also do "register coloring" which means that variables with non-overlapping lifetimes will be placed in the same register (i.e. T0="foo" for the first half of the function and "bar" for the second half of the function) -Joel -- PlayStation Development Tools Dude Metrowerks