GCC Middle and Back End API Reference
tree-ssa-loop-unswitch.c File Reference

Functions

static struct looptree_unswitch_loop (struct loop *, basic_block, tree)
static bool tree_unswitch_single_loop (struct loop *, int)
static tree tree_may_unswitch_on (basic_block, struct loop *)
unsigned int tree_ssa_unswitch_loops ()
static tree tree_may_unswitch_on ()
static tree simplify_using_entry_checks ()
static bool tree_unswitch_single_loop ()

Function Documentation

static tree simplify_using_entry_checks ( )
static
Simplifies COND using checks in front of the entry of the LOOP.  Just very
   simplish (sufficient to prevent us from duplicating loop in unswitching
   unnecessarily).   

References edge_def::flags, gimple_cond_code(), gimple_cond_lhs(), gimple_cond_rhs(), last_stmt(), loop_preheader_edge(), operand_equal_p(), single_pred_edge(), single_pred_p(), and edge_def::src.

Referenced by tree_unswitch_single_loop().

static tree tree_may_unswitch_on ( basic_block  ,
struct loop  
)
static
static tree tree_may_unswitch_on ( )
static
Checks whether we can unswitch LOOP on condition at end of BB -- one of its
   basic blocks (for what it means see comments below).   

References flow_bb_inside_loop_p(), gimple_bb(), gimple_cond_code(), gimple_cond_false_p(), gimple_cond_lhs(), gimple_cond_rhs(), gimple_cond_true_p(), and last_stmt().

unsigned int tree_ssa_unswitch_loops ( void  )
static struct loop * tree_unswitch_loop ( struct loop loop,
basic_block  unswitch_on,
tree  cond 
)
staticread
@verbatim Loop unswitching.

Copyright (C) 2004-2013 Free Software Foundation, Inc.

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/.

This file implements the loop unswitching, i.e. transformation of loops like

   while (A)
     {
       if (inv)
         B;

       X;

       if (!inv)
         C;
     }

   where inv is the loop invariant, into

   if (inv)
     {
       while (A)
         {
           B;
           X;
         }
     }
   else
     {
       while (A)
         {
           X;
           C;
         }
     }

   Inv is considered invariant iff the values it compares are both invariant;
   tree-ssa-loop-im.c ensures that all the suitable conditions are in this
   shape.   
Unswitch a LOOP w.r. to given basic block UNSWITCH_ON.  We only support
   unswitching of innermost loops.  COND is the condition determining which
   loop is entered -- the new loop is entered if COND is true.  Returns NULL
   if impossible, new loop otherwise.   

References extract_true_false_edges_from_block(), flow_bb_inside_loop_p(), loop::inner, loop_version(), edge_def::probability, basic_block_def::succs, and unshare_expr().

Referenced by tree_unswitch_single_loop().

static bool tree_unswitch_single_loop ( struct loop ,
int   
)
static