GCC Middle and Back End API Reference
tree-phinodes.c File Reference

Functions

static int ideal_phi_node_len (int)
void phinodes_print_statistics ()
static gimple_statement_phiallocate_phi_node ()
static int ideal_phi_node_len ()
static gimple make_phi_node ()
void release_phi_node ()
static gimple_statement_phiresize_phi_node ()
void reserve_phi_args_for_new_edge ()
void add_phi_node_to_bb ()
gimple create_phi_node ()
void add_phi_arg ()
static void remove_phi_arg_num ()
void remove_phi_args ()
void remove_phi_node ()
void remove_phi_nodes ()
tree degenerate_phi_result ()

Variables

static vec< gimple, va_gc > * free_phinodes [NUM_BUCKETS-2]
static unsigned long free_phinode_count
unsigned int phi_nodes_reused
unsigned int phi_nodes_created

Function Documentation

void add_phi_arg ( )
   Add a new argument to PHI node PHI.  DEF is the incoming reaching
   definition and E is the edge through which DEF reaches PHI.  The new
   argument is added at the end of the argument list.
   If PHI has reached its maximum capacity, add a few slots.  In this case,
   PHI points to the reallocated phi node when we return.  
     We resize PHI nodes upon edge creation.  We should always have
     enough room at this point.  
     We resize PHI nodes upon edge creation.  We should always have
     enough room at this point.  
     Copy propagation needs to know what object occur in abnormal
     PHI nodes.  This is a convenient place to record such information.  

Referenced by create_iv(), create_loop_fn(), create_parallel_loop(), find_clusters_1(), flush_pending_stmts(), get_initial_def_for_reduction(), gimple_stringop_fixed_value(), input_phi(), vect_create_cond_for_alias_checks(), and verify_loop_closed_ssa().

void add_phi_node_to_bb ( )
   Adds PHI to BB.  
     Add the new PHI node to the list of PHI nodes for block BB.  
     Associate BB to the PHI node.  

References make_phi_node(), and basic_block_def::preds.

static gimple_statement_phi* allocate_phi_node ( )
inlinestatic
   Allocate a PHI node with at least LEN arguments.  If the free list
   happens to contain a PHI node with LEN arguments or more, return
   that one.  
     If our free list has an element, then use it.  
tree degenerate_phi_result ( )
   Given PHI, return its RHS if the PHI is a degenerate, otherwise return
   NULL.  
     Ignoring arguments which are the same as LHS, if all the remaining
     arguments are the same, then the PHI is a degenerate and has the
     value of that common argument.  
         We bring in some of operand_equal_p not only to speed things
         up, but also to avoid crashing when dereferencing the type of
         a released SSA name.  

Referenced by analyze_evolution_in_loop().

static int ideal_phi_node_len ( int  )
static
static int ideal_phi_node_len ( )
static
   Given LEN, the original number of requested PHI arguments, return
   a new, "ideal" length for the PHI node.  The "ideal" length rounds
   the total size of the PHI node up to the next power of two bytes.

   Rounding up will not result in wasting any memory since the size request
   will be rounded up by the GC system anyway.  [ Note this is not entirely
   true since the original length might have fit on one of the special
   GC pages. ]  By rounding up, we may avoid the need to reallocate the
   PHI node later if we increase the number of arguments for the PHI.  
     We do not support allocations of less than two PHI argument slots.  
     Compute the number of bytes of the original request.  
     Round it up to the next power of two.  
     Now compute and return the number of PHI argument slots given an
     ideal size allocation.  
static gimple make_phi_node ( )
static
   Return a PHI node with LEN argument slots for variable VAR.  
     We need to clear the entire PHI node, including the argument
     portion, because we represent a "missing PHI argument" by placing
     NULL_TREE in PHI_ARG_DEF.  

Referenced by add_phi_node_to_bb().

void phinodes_print_statistics ( void  )
   Dump some simple statistics regarding the re-use of PHI nodes.  
void release_phi_node ( )
   We no longer need PHI, release it so that it may be reused.  
static void remove_phi_arg_num ( )
static
   Remove the Ith argument from PHI's argument list.  This routine
   implements removal by swapping the last alternative with the
   alternative we want to delete and then shrinking the vector, which
   is consistent with how we remove an edge from the edge vector.  
     Delink the item which is being removed.  
     If it is not the last element, move the last element
     to the element we want to delete, resetting all the links. 
         Set use on new node, and link into last element's place.  
         Move the location as well.  
     Shrink the vector and return.  Note that we do not have to clear
     PHI_ARG_DEF because the garbage collector will not look at those
     elements beyond the first PHI_NUM_ARGS elements of the array.  
void remove_phi_args ( )
   Remove all PHI arguments associated with edge E.  

References gsi_end_p(), gsi_start_phis(), remove_phi_node(), and set_phi_nodes().

void remove_phi_node ( )
   Remove the PHI node pointed-to by iterator GSI from basic block BB.  After
   removal, iterator GSI is updated to point to the next PHI node in the
   sequence. If RELEASE_LHS_P is true, the LHS of this PHI node is released
   into the free pool of SSA names.  
     If we are deleting the PHI node, then we should release the
     SSA_NAME node so that it can be reused.  

References gimple_phi_arg_def(), gimple_phi_num_args(), and gimple_phi_result().

Referenced by eliminate_phi(), insert_out_of_ssa_copy_on_edge(), remove_phi_args(), and replace_phi_args_in().

void remove_phi_nodes ( )
   Remove all the phi nodes from BB.  
void reserve_phi_args_for_new_edge ( )
   Reserve PHI arguments for a new edge to basic block BB.  
             The result of the PHI is defined by this PHI node.  
         We represent a "missing PHI argument" by placing NULL_TREE in
         the corresponding slot.  If PHI arguments were added
         immediately after an edge is created, this zeroing would not
         be necessary, but unfortunately this is not the case.  For
         example, the loop optimizer duplicates several basic blocks,
         redirects edges, and then fixes up PHI arguments later in
         batch.  
static gimple_statement_phi* resize_phi_node ( )
static
   Resize an existing PHI node.  The only way is up.  Return the
   possibly relocated phi.  
     The garbage collector will not look at the PHI node beyond the
     first PHI_NUM_ARGS elements.  Therefore, all we have to copy is a
     portion of the PHI node currently in use.  

Variable Documentation

unsigned long free_phinode_count
static
vec<gimple, va_gc>* free_phinodes[NUM_BUCKETS-2]
static
unsigned int phi_nodes_created
unsigned int phi_nodes_reused