This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: CFG not taken care
> Hi,
>
> I was just going through the GCC code when I happen
> to notice something strange. It may not be bug, but
> I'm confused.
>
> Defined in rtlanal.c, the function reg_set_between_p
> returns true if a register is set between two insns;
> all three things passed in its arguments. To my
> surprise, there was just a loop like:
>
> for (insn = (NEXT_INSN (from_insn); insn != to_insn;
> insn = NEXT_INSN (insn))
> {
> ........
> }
>
> It is called by many passes; but the important point
> is that its traversal is linear. The CFG is not taken
> care of. For example, consider the scenario:
>
> .L1
> from_insn;
> bra .L2 (unconditional jump)
>
> .L3
> ......
> to_insn;
>
> .L2
> .....
> /* set the reg here */
> bra .L2
>
> Certainly, these cases cannot be caught by
> reg_set_between_p. There is a whole set of such
> functions like reg_referenced_between_p, etc. Is there
> any other set of functions covering CFG??
>
> I may be missing some important observation. Sorry
> for my ignorance!!
These functions are supposed to be used only locally inside superblock
where this don't matter. We do similar local analysis at many places in
GCC still :(
Honza
>
> Thanks and Regards,
>
>
> =====
>
>
> __________________________________
> Do you Yahoo!?
> New Yahoo! Photos - easier uploading and sharing.
> http://photos.yahoo.com/