How to detect whether we're inside of a loop??

Daniel Berlin dberlin@dberlin.org
Wed Apr 9 19:10:00 GMT 2003


On Wednesday, April 9, 2003, at 02:25  PM, Geoff Keating wrote:

> "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu> writes:
>
>> I was interested in experimenting with heuristics which might expand a
>> builtin depending on whether at the point of expansion we're in a loop
>> or not.  E.g. It might make sense to expand something which might
>> create slightly larger code only if we think it's likely that it'll be
>> executed a number of times.  I'm guessing that being inside a loop is
>> one way to increase that probability.  Thus I was curious if there's a
>> way to detect this.
>
> Why don't you just use the support that GCC already has for detecting
> the probability that a block will be executed?

Because it's at the tree level he's talking about, not the RTL level.
--Dan



More information about the Gcc mailing list