|Backward branches email@example.com (2003-12-14)|
|Re: Backward branches firstname.lastname@example.org (2003-12-20)|
|Re: Backward branches email@example.com (2003-12-21)|
|Re: Backward branches firstname.lastname@example.org (2004-01-02)|
|Re: Backward branches email@example.com (2004-01-09)|
|Re: Backward branches firstname.lastname@example.org (Jens Troeger) (2004-01-12)|
|Re: Backward branches Robert.Thorpe@antenova.com (Robert Thorpe) (2004-01-16)|
|From:||email@example.com (Torben Ęgidius Mogensen)|
|Date:||20 Dec 2003 11:44:36 -0500|
|Organization:||Department of Computer Science, University of Copenhagen|
|Posted-Date:||20 Dec 2003 11:44:36 EST|
firstname.lastname@example.org (kugan) writes:
> I need to detect loops using H/W. I am wondering whether it is
> possible to detect loops just by detecting backward branches. What
> would be the approximate success rate for this scheme? What are the
> other instances where backward branches will be used?
Any loop (that hasn't been fully unrolled) will certainly involve a
backwards branch at some point. Not all backwards branches are loops,
though. If you reorder basic blocks, you can well have one branch of
an if-then-else placed after the join-point, so you need a backwards
jump to get to the join-point. Jumps to exception-handling code can
also be backwards, but compilers would tend to make these forwards as
some branch predictors assume backwards branches are taken (until they
have gathered evidence to the contrary).
In summary: All lopps involve backwards branches. It is possible for
a compiler to arrange that all backwards branches are loops, but you
shouldn't bet on it.
Return to the
Search the comp.compilers archives again.