[PATCH] Generalize insert_insn_end_bb()

Leehod Baruch LEEHOD@il.ibm.com
Tue Aug 30 12:37:00 GMT 2005


> Ehm, you're kidding, right?  How can this possibly be useful to
> anyone outside gcse.c when "struct expr" is also in gcse.c?  And
> what about the updating of gcse'c local data flow (i.e. that call
> to record_set_info)?

No, I'm not kidding!
If you`ll take another look at the patch you`ll see that "struct expr"
is no longer passed to this function.
I agree that there is a problem with record_set_info, I didn't noticed
it, but if the idea will be accepted, this could be fixed easily.

> > Every code that uses LCM and need to apply changes according to its
> > output would need this function.  (How come mode-switching.c 
doesn't??)
>
> Maybe your "Every code .... this function" assertion is not so true
> as you think.

The function insert_insn_end_bb handles the insertion of an instruction
in an ABNORMAL edge.
At the mode switching optimization when this situation is encountered
we just check if the last instruction of the prev bb is a jump 
instruction.
If it is a jump instruction we emit the new instruction before it,
otherwise we emit it at the end of the basic block.  But if it was so
simple, why do we need all the other checks of insert_insn_end_bb?

Just an example, why does mode switching doesn't handles the case that the
last instruction in a call_insn?


Leehod.



More information about the Gcc-patches mailing list