www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/11/21:31:44

Newsgroups: comp.os.msdos.djgpp
From: "William A. Barath" <wi534 AT victoria DOT tc DOT canada>
Subject: Re: Register variables with -O2
In-Reply-To: <Pine.GSO.3.95.980108130328.17326A-100000@kempelen.inf.bme.hu>
Message-ID: <Pine.GSO.3.95.iB1.0.980109181740.28291A-100000@vtn1>
Sender: news AT freenet DOT victoria DOT bc DOT ca (News Manager)
Organization: Victoria Telecommunity Network
References: <Pine DOT GSO DOT 3 DOT 95 DOT 980108130328 DOT 17326A-100000 AT kempelen DOT inf DOT bme DOT hu>
Mime-Version: 1.0
Date: Sat, 10 Jan 1998 02:26:42 GMT
Lines: 28
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019