Next:Loop-closed SSA form, Previous:Loop querying, Up:Analysis and Representation of Loops [Contents][Index]
The loops tree can be manipulated using the following functions:
flow_loop_tree_node_add: Adds a node to the tree.flow_loop_tree_node_remove: Removes a node from the tree.add_bb_to_loop: Adds a basic block to a loop.remove_bb_from_loops: Removes a basic block from loops.Most low-level CFG functions update loops automatically. The followingfunctions handle some more complicated cases of CFG manipulations:
remove_path: Removes an edge and all blocks it dominates.split_loop_exit_edge: Splits exit edge of the loop,ensuring that PHI node arguments remain in the loop (this ensures thatloop-closed SSA form is preserved). Only useful on GIMPLE.Finally, there are some higher-level loop transformations implemented.While some of them are written so that they should work on non-innermostloops, they are mostly untested in that case, and at the moment, theyare only reliable for the innermost loops:
create_iv: Creates a new induction variable. Only works onGIMPLE.standard_iv_increment_position can be used to find asuitable place for the iv increment.duplicate_loop_body_to_header_edge,tree_duplicate_loop_body_to_header_edge: These functions (on RTL andon GIMPLE) duplicate the body of the loop prescribed number of times onone of the edges entering loop header, thus performing either loopunrolling or loop peeling.can_duplicate_loop_p(can_unroll_loop_p on GIMPLE) must be true for the duplicatedloop.loop_version: This function creates a copy of a loop, anda branch before them that selects one of them depending on theprescribed condition. This is useful for optimizations that need toverify some assumptions in runtime (one of the copies of the loop isusually left unchanged, while the other one is transformed in some way).tree_unroll_loop: Unrolls the loop, including peeling theextra iterations to make the number of iterations divisible by unrollfactor, updating the exit condition, and removing the exits that nowcannot be taken. Works only on GIMPLE.Next:Loop-closed SSA form, Previous:Loop querying, Up:Analysis and Representation of Loops [Contents][Index]