Hi, 2010/5/3, Ian Lance Taylor <i...@google.com>: > roy rosen <roy.1ro...@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? I think it may be very beneficial since I guess that for most patterns, there are other insns between the pattern's insns which cause the peephole not to match... > > > 2. I saw that the peephole2 pass is done after IRA. Many peepholes are > > practically useless after register allocating. > > Is it possible to run it before IRA? Is it possible to run it several times? > > There are also many peepholes can not be run before register > allocation, because they depend on relationships between the > registers. > > Before register allocation, you should normally write an insn pattern > which can be recognized by the combine pass, rather than writing a > peephole. To do this, write a define_insn as usual, and use > appropriate operand and insn predicates to recognize the pattern you > are looking for. > > That has the advantage that it works even if random insns appear in > between the insns you care about, the case you ask about in your first > question. (However, it does not work across block boundaries.) > > Ian >