This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: What does un-cse exactly refer to?
- From: Jim Wilson <wilson at tuliptree dot org>
- To: Kazu Hirata <kazu at cs dot umass dot edu>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 25 Aug 2003 13:01:32 -0700
- Subject: Re: What does un-cse exactly refer to?
- References: <20030824.050003.55488960.kazu@cs.umass.edu>
Kazu Hirata wrote:
Is this problem what "un-cse" in http://gcc.gnu.org/projects/ would
try to solve?
It is hard to say, since the description doesn't say much. You could
try going back from cvs/mail logs to figure out where this come from.
That might give info about the original pupose.
Here is my guess. cse only looks at one instruction at a time.
Sometimes that isn't enough info to make the best choice. For instance,
suppose the cost of a constant is 2, and the cost of a register is one.
Then it is better to load the constant into a register if it is used
two or more times, but it is better to use the constant directly if it
is only used once. But since cse only looks at one instruction at a
time, cse can't make this distinction. This is a common problem with
NO_FUNCTION_CSE, for instance, which should depend on how many times a
function address is used rather than being a yes or no answer. This is
not the problem you are looking at.
The problem you are looking at could perhaps be fixed with
rematerialization in the register allocation. When allocating pseudos
to registers, if the register value is a constant, and that constant is
cheaper than the register, then we put the constant back.
Interestingly, this happens on h8300 port but not on i386. Maybe, cse
does not notice an implicit set (a == 0) on i386!?
Unlikely. There is probably something more complicated going on.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com