This is the mail archive of the gcc@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: peephole optimizations


roy rosen <roy.1rosen@gmail.com> writes:

> 2010/5/3, Ian Lance Taylor <iant@google.com>:
>> roy rosen <roy.1rosen@gmail.com> writes:
>>
>> > 1. Is that true that if I try to match in the pattern two insns and in
>> > my code between these insns there is another insn which does not have
>> > any dependency connection to the other two, Is that true that the
>> > peephole would not match in this case? (i.e. the insns to match must
>> > come in the code in sequential order with no other insns between
>> > them)?
>>
>> Yes.
>>
>
> Was there any special problem implementing such peephole mechanism or
> simply nobody tried to work on this yet?

It would have to be very conservative about whether the intervening
instructions affected the instructions being optimized.  I don't think
there is any special problem other than that.

The compiler doesn't rely on peepholes that much, since most of that
sort of thing is done in the combine pass.  The peepholes are mostly
used to optimize the output of the register allocator.  As such, the
instructions tend to be sequential anyhow.  Before starting a project
to permit skipping instructions in the middle of peepholes, I think it
would be useful to analyze some .s files and see how often the
peephole could be applied.

Ian


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