Combine or peephole?

Jeff Law law@redhat.com
Wed Apr 21 15:46:00 GMT 2010


On 04/21/10 00:39, Frank Isamov wrote:
> On Mon, Apr 19, 2010 at 5:54 PM, Jeff Law<law@redhat.com>  wrote:
>    
>> combine requires a data dependency, so for this situation, combine isn't
>> going to help.  The easy solution is to create a peephole.    You can also
>> create a machine dependent reorg pass to detect more of these opportunities.
>> Jeff
>>
>>      
>
> Hi Jeff, et al,
>
> Thank you for your reply. Two more questions:
>
> 1. Is it possible to add a machine dependent reorg pass at backend
> level without changing the standard infrastructure? If so, can you
> please point me such example? If no, may the new plugin architecture
> help here?
>    
Yes.  See MACHINE_DEPENDENT_REORG.


> 2. A peephole for such case just repeats instruction definition
> pattern. As all information already available for such peephole,
> wouldnÂ’t it be useful to implement the pass to be a part of the
> standard infrastructure?
>    
I looked at this to support certain instructions on the PA 15+ years 
ago; reorg.c has most of the infrastructure one would need to implement 
this as a generic pass.  Instead of combining the insns into a SEQUENCE 
(which implies an insn + delay slots), you'd want to combine them into a 
new INSN with a PARALLEL.  reorg.c was (is?) unique in that it has the 
ability to look at two insns with no data dependencies from relatively 
arbitrary locations in the insn stream and manipulate them.

I actually hacked up reorg to do this, but the patches are long since 
gone...  The 2nd iteration for supporting these special PA instructions 
is what people now know as MACHINE_DEPENDENT_REORG.  The PA 
implementation may provide you with some ideas -- it was rather 
simplistic, but got the vast majority of the benefit without being 
overly compile-time expensive.

If I was to take on this problem again today, I'd probably start with a 
revamp of reorg to make it more library-ish using standard data 
dependency algorithms to detect when specific insns do not have data 
dependencies.  On top of that library would be delay slot filling and 
independent insn combination.

jeff



More information about the Gcc mailing list