Mail Archives: djgpp/1998/01/11/21:31:44
On Thu, 8 Jan 1998, Geza Herman wrote:
|How can I tell the compiler which variables use as register and which
|not when I use the option -O2?
I believe the correct answer to this question is, "you don't really want
to." DJGPP does a much better job of compiling if you don't use explicit
register variables. Unless you are adding optimal hand-coded assembly.
If you are adding Assembly, then you know how to specify register
variables.
If your question is more along the lines of "How can I tell gcc to not
registerize a variable for me" then I'd say "don't use the -O1 or -O2
options"
If your question was targeting the concept of making sure a variable
will always be synchronized from its register to its storage, then the
answer was "use the -fforce-mem" flag, which will force gcc to always
write out registerized variables after evaluation.
Otherwise, gcc will determine for you the best use of the registers to
eliminate reloads and re-evaluations. Trust it.
Wil Barath, aka WseM : "I feel as though I see my pen to write"
Author of VPM, EDITPLN, and other VGA Planets support programs
Visit my homepage! -------------> http://victoria.tc.ca/~wi534
- Raw text -