This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Minor CCP improvement and add comments to tree.h


On Thu, 2004-09-23 at 09:06, Daniel Berlin wrote:

> Just so you realize, value handles are equivalent to, in some cases, 
> expressions with value handles in them, so don't be surprised if you 
> see them.
It's not a concern at this stage, though it is something I'll need
to deal with at some point.

At least initially, I'd like to get DOM using the value_handle stuff
internally.  Once that's in good shape we can seriously look at
letting VALUE_HANDLEs persist.


> 
> IE it may be equivalent to "VH.62 + VH.75".  This is because of the 
> whole "This is equivalent to some very long string of expressions and 
> each part was assigned a value number" deal.
> I actually had a small bit of code that would expand this out to the 
> first equivalent expression on the list, so that you could print out 
> something like "a_5 + e_3 + c_10 + 100 + d_20 * e_40" for these, but I 
> was only using it for debugging, so it never got into the actual 
> mainline code.
> I still have it somewhere if it is ever useful to you.
I don't immediately see a need for it.

> > I should have asked in a different way.  Let's assume I'm changing
> > the form of an expression, but not its actual value.  For example,
> > we might change a division into a shift or a modulo into a bitwise
> > and.  We're careful not to apply such transformations when it would
> > change the value of the expression, though they do change the form
> > of the underlying expression -- which might in turn change the
> > VALUE_HANDLE, depending on how it's computed.
> It could change the value handle, but it doesn't actually have to if 
> you don't want it to (since we *know* they are the same value, 
> regardless of whether *it* knows they are).
I had pondered this -- something about leaving the VALUE_HANDLES
unchanged in this circumstance makes me uneasy.


> In this case, you can always just do the following:
> Compute the "value number expression" for the new form (IE VH.62 << 2 
> or whatever), and then add this expression to the hashtable as 
> equivalent to the old value handle using vn_add(new_expr, 
> old_value_handle), so that if you look up the new expression, you still 
> get the same value handle.
> vn_add simply assumes you know what you are doing, which in this case, 
> we do :)
Again, something is telling me there's more to it than that.  But
maybe it really is that simple.

The only other immediate question for using VALUE_HANDLEs within
DOM is handling the short-lived equivalences created by things like
COND_EXPRs and the like.  But I think as long as I can register and
deregister a specific entry in the equivalency tables that the
short-live equivalences should "just work" much like the short lived
constant equivalences just worked.

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]