gccint: Loop manipulation

1 
1 16.3 Loop manipulation
1 ======================
1 
1 The loops tree can be manipulated using the following functions:
1 
1    * 'flow_loop_tree_node_add': Adds a node to the tree.
1    * 'flow_loop_tree_node_remove': Removes a node from the tree.
1    * 'add_bb_to_loop': Adds a basic block to a loop.
1    * 'remove_bb_from_loops': Removes a basic block from loops.
1 
1  Most low-level CFG functions update loops automatically.  The following
1 functions handle some more complicated cases of CFG manipulations:
1 
1    * 'remove_path': Removes an edge and all blocks it dominates.
1    * 'split_loop_exit_edge': Splits exit edge of the loop, ensuring that
1      PHI node arguments remain in the loop (this ensures that
1      loop-closed SSA form is preserved).  Only useful on GIMPLE.
1 
1  Finally, there are some higher-level loop transformations implemented.
1 While some of them are written so that they should work on non-innermost
1 loops, they are mostly untested in that case, and at the moment, they
1 are only reliable for the innermost loops:
1 
1    * 'create_iv': Creates a new induction variable.  Only works on
1      GIMPLE.  'standard_iv_increment_position' can be used to find a
1      suitable place for the iv increment.
1    * 'duplicate_loop_to_header_edge',
1      'tree_duplicate_loop_to_header_edge': These functions (on RTL and
1      on GIMPLE) duplicate the body of the loop prescribed number of
1      times on one of the edges entering loop header, thus performing
1      either loop unrolling or loop peeling.  'can_duplicate_loop_p'
1      ('can_unroll_loop_p' on GIMPLE) must be true for the duplicated
1      loop.
1    * 'loop_version': This function creates a copy of a loop, and a
1      branch before them that selects one of them depending on the
1      prescribed condition.  This is useful for optimizations that need
1      to verify some assumptions in runtime (one of the copies of the
1      loop is usually left unchanged, while the other one is transformed
1      in some way).
1    * 'tree_unroll_loop': Unrolls the loop, including peeling the extra
1      iterations to make the number of iterations divisible by unroll
1      factor, updating the exit condition, and removing the exits that
1      now cannot be taken.  Works only on GIMPLE.
1