Thoughts about semantics of BB_VISITED

Zdenek Dvorak rakdver@atrey.karlin.mff.cuni.cz
Fri Jan 7 14:55:00 GMT 2005


Hello,

> >If the state of the mark would be undefined, you would need either to
> >clean them up first (over whole cfg), or use bitmaps for the marks.
> >Both of these approaches bring a risk of quadratic behavior.
> >
> Quadratic behaviour?  How?

because the places where it is used now (most notably, get_loop_body)
do not look at whole cfg, but just at the loop body.
If BB_VISITED would not be guaranteed to be zero, you would need to
put

FOR_ALL_BB (bb)
  bb->flags &= ~BB_VISITED;

into get_loop_body.  That would make its time complexity to be
proportional to the size of whole function, not just loop body.

Of course this could be fixed by only requiring the passes that
need get_loop_body to keep the flag clear, but given that it really
is not that much work to keep it clear everywhere, I don't think it
would be better.

Zdenek

> I'm suggesting that instead of
> 
> my_pass ()
> {
>   my_pass_code ();
>   FOR_ALL_BB (bb)
>     bb->flags &= ~BB_VISITED;
> }
> 
> we have
> 
> my_pass ()
> {
>   FOR_ALL_BB (bb)
>     bb->flags &= ~BB_VISITED;
>   my_pass_code ();
> }



More information about the Gcc mailing list