Thanks. Do you mean the TARGET_RTX_COSTS hook?  Actually, I already have
made the long int more expensive in TARGET_RTX_COSTS function. It does
have effect for other optimizations (e.g., combine pass), but doesn't
work in the example mentioned in previous example. 

        if (INTVAL(x) >= 0 && INTVAL(x) <= 255) {
            *total = 1;
            return true;
        }
        *total = 4;
        return true; 


Bingfeng Mei

-----Original Message-----
From: Ian Lance Taylor [mailto:[EMAIL PROTECTED] 
Sent: 16 October 2007 15:32
To: Bingfeng Mei
Cc: gcc@gcc.gnu.org
Subject: Re: Machine dependent Tree optimization?

"Bingfeng Mei" <[EMAIL PROTECTED]> writes:

> Of couse, for processors without long/short instructions, this copy
> propagation is benefiical for performance by reducing unnecessary
> dependency. Therefore, whether to apply this copy propagation is
machine
> dependent to some degree.  
> 
> What I do now is to add some check in tree-ssa-copy.c and
tree-ssa-dom.c
> for our target. But this is not very clean. My question is whether
there
> is better way to implement such machine-dependent tree-level
> optimization (like hooks in RTL level).  I believe there are other
> processors that have the similar problem. What is common solution? 

This should normally be done at the RTL level by making long constants
more expensive in RTX_COSTS.  With luck that will let gcse pick this
up.

Ian


Reply via email to