14.2 Loop querying

The functions to query the information about loops are declared in cfgloop.h. Some of the information can be taken directly from the structures. loop_father field of each basic block contains the innermost loop to that the block belongs. The most useful fields of loop structure (that are kept up-to-date at all times) are:

There are other fields in the loop structures, many of them used only by some of the passes, or not updated during CFG changes; in general, they should not be accessed directly.

The most important functions to query loop structures are: