GCC Middle and Back End API Reference
ssa-iterators.h File Reference

Go to the source code of this file.

Data Structures

struct  immediate_use_iterator_d
struct  ssa_operand_iterator_d

Typedefs

typedef struct
immediate_use_iterator_d 
imm_use_iterator
typedef struct
ssa_operand_iterator_d 
ssa_op_iter

Enumerations

enum  ssa_op_iter_type { ssa_op_iter_none = 0, ssa_op_iter_tree, ssa_op_iter_use, ssa_op_iter_def }

Functions

bool has_zero_uses_1 (const ssa_use_operand_t *head)
bool single_imm_use_1 (const ssa_use_operand_t *head, use_operand_p *use_p, gimple *stmt)
static void delink_imm_use ()
static void link_imm_use_to_list ()
static void link_imm_use ()
static void set_ssa_use_from_ptr ()
static void link_imm_use_stmt ()
static void relink_imm_use ()
static void relink_imm_use_stmt (ssa_use_operand_t *linknode, ssa_use_operand_t *old, gimple stmt)
static bool end_readonly_imm_use_p ()
static use_operand_p first_readonly_imm_use ()
static use_operand_p next_readonly_imm_use ()
static bool has_zero_uses ()
static bool has_single_use ()
static bool single_imm_use ()
static unsigned int num_imm_uses ()
static bool op_iter_done ()
static use_operand_p op_iter_next_use ()
static def_operand_p op_iter_next_def ()
static tree op_iter_next_tree ()
static void clear_and_done_ssa_iter ()
static void op_iter_init ()
static use_operand_p op_iter_init_use ()
static def_operand_p op_iter_init_def ()
static tree op_iter_init_tree ()
static tree single_ssa_tree_operand ()
static use_operand_p single_ssa_use_operand ()
static def_operand_p single_ssa_def_operand ()
static bool zero_ssa_operands ()
static int num_ssa_operands ()
static tree single_phi_def ()
static use_operand_p op_iter_init_phiuse ()
static def_operand_p op_iter_init_phidef ()
static bool end_imm_use_stmt_p ()
static void end_imm_use_stmt_traverse ()
static use_operand_p move_use_after_head (use_operand_p use_p, use_operand_p head, use_operand_p last_p)
static void link_use_stmts_after ()
static gimple first_imm_use_stmt ()
static gimple next_imm_use_stmt ()
static use_operand_p first_imm_use_on_stmt ()
static bool end_imm_use_on_stmt_p ()
static use_operand_p next_imm_use_on_stmt ()
static void delink_stmt_imm_use ()

Typedef Documentation

   Immediate use lists are used to directly access all uses for an SSA
   name and get pointers to the statement for each use.

   The structure ssa_use_operand_d consists of PREV and NEXT pointers
   to maintain the list.  A USE pointer, which points to address where
   the use is located and a LOC pointer which can point to the
   statement where the use is located, or, in the case of the root
   node, it points to the SSA name itself.

   The list is anchored by an occurrence of ssa_operand_d *in* the
   ssa_name node itself (named 'imm_uses').  This node is uniquely
   identified by having a NULL USE pointer. and the LOC pointer
   pointing back to the ssa_name node itself.  This node forms the
   base for a circular list, and initially this is the only node in
   the list.

   Fast iteration allows each use to be examined, but does not allow
   any modifications to the uses or stmts.

   Normal iteration allows insertion, deletion, and modification. the
   iterator manages this by inserting a marker node into the list
   immediately before the node currently being examined in the list.
   this marker node is uniquely identified by having null stmt *and* a
   null use pointer.

   When iterating to the next use, the iteration routines check to see
   if the node after the marker has changed. if it has, then the node
   following the marker is now the next one to be visited. if not, the
   marker node is moved past that node in the list (visualize it as
   bumping the marker node through the list).  this continues until
   the marker node is moved to the original anchor position. the
   marker node is then removed from the list.

   If iteration is halted early, the marker node must be removed from
   the list before continuing.  
   This structure is used in the operand iterator loops.  It contains the
   items required to determine which operand is retrieved next.  During
   optimization, this structure is scalarized, and any unused fields are
   optimized away, resulting in little overhead.  

Enumeration Type Documentation

Enumerator:
ssa_op_iter_none 
ssa_op_iter_tree 
ssa_op_iter_use 
ssa_op_iter_def 

Function Documentation

static void clear_and_done_ssa_iter ( )
inlinestatic
   This functions clears the iterator PTR, and marks it done.  This is normally
   used to prevent warnings in the compile about might be uninitialized
   components.  

Referenced by zero_ssa_operands().

static void delink_imm_use ( )
inlinestatic
   Delink an immediate_uses node from its chain.  
     Return if this node is not in a list.  

References link_imm_use_to_list(), ssa_use_operand_d::prev, and ssa_use_operand_d::use.

Referenced by finalize_ssa_uses(), link_imm_use_to_list(), op_iter_init_phiuse(), and release_ssa_name().

static void delink_stmt_imm_use ( )
inlinestatic
   Delink all immediate_use information for STMT.  

Referenced by gsi_split_seq_before().

static bool end_imm_use_on_stmt_p ( )
inlinestatic
    Return TRUE if the last use on the stmt IMM refers to has been visited.  
static bool end_imm_use_stmt_p ( )
inlinestatic
   Return true is IMM has reached the end of the immediate use stmt list.  
static void end_imm_use_stmt_traverse ( )
inlinestatic
   Finished the traverse of an immediate use stmt list IMM by removing the
   placeholder node from the list.  

References immediate_use_iterator_d::end_p, immediate_use_iterator_d::imm_use, immediate_use_iterator_d::iter_node, ssa_use_operand_d::next, immediate_use_iterator_d::next_imm_name, and ssa_use_operand_d::prev.

static bool end_readonly_imm_use_p ( )
inlinestatic
   Return true is IMM has reached the end of the immediate use list.  

Referenced by relink_imm_use_stmt().

static use_operand_p first_imm_use_on_stmt ( )
inlinestatic
   This routine will return the first use on the stmt IMM currently refers
   to.  
static gimple first_imm_use_stmt ( )
inlinestatic
   Initialize IMM to traverse over uses of VAR.  Return the first statement.  
     iter_node is used as a marker within the immediate use list to indicate
     where the end of the current stmt's uses are.  Initialize it to NULL
     stmt and use, which indicates a marker node.  
static use_operand_p first_readonly_imm_use ( )
inlinestatic
   Initialize iterator IMM to process the list for VAR.  

References has_zero_uses_1(), and ssa_use_operand_d::next.

static bool has_single_use ( )
inlinestatic
   Return true if VAR has a single nondebug use.  
     If there aren't any uses whatsoever, we're done.  
     If there's a single use, check that it's not a debug stmt.  
     If there are debug stmts, we have to look at each of them.  

Referenced by create_mul_ssa_cand(), find_basis_for_base_expr(), find_equal_ptrs(), infer_value_range(), print_exprs(), record_phi_increments(), register_edge_assert_for_1(), rewrite_reciprocal(), and stmt_is_power_of_op().

static bool has_zero_uses ( )
inlinestatic
   Return true if VAR has no nondebug uses.  
     A single use_operand means there is no items in the list.  
     If there are debug stmts, we have to look at each use and see
     whether there are any nondebug uses.  

References is_gimple_debug(), ssa_use_operand_d::loc, ssa_use_operand_d::next, and ssa_use_operand_d::stmt.

Referenced by coalesce_partitions(), DFS(), do_partial_partial_insertion(), eliminate_phi(), initialize_parameter_reductions(), and ipa_analyze_call_uses().

bool has_zero_uses_1 ( const ssa_use_operand_t head)

Referenced by first_readonly_imm_use().

static void link_imm_use ( )
inlinestatic
   Link ssa_imm_use node LINKNODE into the chain for DEF.  

Referenced by link_imm_use_stmt(), and link_imm_use_to_list().

static void link_imm_use_stmt ( )
inlinestatic
   Link ssa_imm_use node LINKNODE into the chain for DEF, with use occurring
   in STMT.  

References link_imm_use(), ssa_use_operand_d::loc, relink_imm_use(), and ssa_use_operand_d::stmt.

Referenced by lower_emutls_stmt().

static void link_imm_use_to_list ( )
inlinestatic
   Link ssa_imm_use node LINKNODE into the chain for LIST.  
     Link the new node at the head of the list.  If we are in the process of
     traversing the list, we won't visit any new nodes added to it.  

References delink_imm_use(), link_imm_use(), and ssa_use_operand_d::use.

Referenced by delink_imm_use().

static void link_use_stmts_after ( )
inlinestatic
   This routine will relink all uses with the same stmt as HEAD into the list
   immediately following HEAD for iterator IMM.  
     Only look at virtual or real uses, depending on the type of HEAD.  
     Link iter node in after last_p.  

References immediate_use_iterator_d::imm_use, ssa_use_operand_d::next, and immediate_use_iterator_d::next_imm_name.

static use_operand_p move_use_after_head ( use_operand_p  use_p,
use_operand_p  head,
use_operand_p  last_p 
)
inlinestatic
   Immediate use traversal of uses within a stmt require that all the
   uses on a stmt be sequentially listed.  This routine is used to build up
   this sequential list by adding USE_P to the end of the current list
   currently delimited by HEAD and LAST_P.  The new LAST_P value is
   returned.  
     Skip head when we find it.  
         If use_p is already linked in after last_p, continue.  
             Delink from current location, and link in at last_p.  

Referenced by op_iter_init_phidef().

static use_operand_p next_imm_use_on_stmt ( )
inlinestatic
   Bump to the next use on the stmt IMM refers to, return NULL if done.  
static gimple next_imm_use_stmt ( )
inlinestatic
   Bump IMM to the next stmt which has a use of var.  
static use_operand_p next_readonly_imm_use ( )
inlinestatic
   Bump IMM to the next use in the list.  
     If this assertion fails, it indicates the 'next' pointer has changed
     since the last bump.  This indicates that the list is being modified
     via stmt changes, or SET_USE, or somesuch thing, and you need to be
     using the SAFE version of the iterator.  

References is_gimple_debug(), ssa_use_operand_d::next, and single_imm_use_1().

static int num_ssa_operands ( )
inlinestatic
   Return the number of operands matching FLAGS in STMT.  

References ssa_operand_iterator_d::done.

static bool op_iter_done ( )
inlinestatic
    -----------------------------------------------------------------------  
   The following set of routines are used to iterator over various type of
   SSA operands.  
   Return true if PTR is finished iterating.  

Referenced by op_iter_init_tree().

static void op_iter_init ( )
inlinestatic
   Initialize the iterator PTR to the virtual defs in STMT.  
     PHI nodes require a different iterator initialization path.  We
     do not support iterating over virtual defs or uses without
     iterating over defs or uses at the same time.  
static def_operand_p op_iter_init_def ( )
inlinestatic
   Initialize iterator PTR to the def operands in STMT based on FLAGS. Return
   the first def.  
static def_operand_p op_iter_init_phidef ( )
inlinestatic
   Start an iterator for a PHI definition.  
     If the PHI node doesn't have the operand type we care about,
     we're done.  
     The first call to op_iter_next_def will terminate the iterator since
     all the fields are NULL.  Simply return the result here as the first and
     therefore only result.  

References gimple_vuse_op(), is_gimple_reg(), and move_use_after_head().

static use_operand_p op_iter_init_phiuse ( )
inlinestatic
   Initialize the iterator PTR for uses matching FLAGS in PHI.  FLAGS should
   be either SSA_OP_USES or SSA_OP_VIRTUAL_USES.  
     If the PHI node doesn't the operand type we care about, we're done.  

References delink_imm_use(), and immediate_use_iterator_d::iter_node.

static tree op_iter_init_tree ( )
inlinestatic
   Initialize iterator PTR to the operands in STMT based on FLAGS. Return
   the first operand as a tree.  

References op_iter_done().

static use_operand_p op_iter_init_use ( )
inlinestatic
   Initialize iterator PTR to the use operands in STMT based on FLAGS. Return
   the first use.  
static def_operand_p op_iter_next_def ( )
inlinestatic
   Get the next iterator def value for PTR.  

References is_gimple_reg().

static void relink_imm_use ( )
inlinestatic
   Relink a new node in place of an old node in the list.  
     The node one had better be in the same list.  
         Remove the old node from the list.  

References immediate_use_iterator_d::end_p, and immediate_use_iterator_d::imm_use.

Referenced by link_imm_use_stmt().

static void relink_imm_use_stmt ( ssa_use_operand_t linknode,
ssa_use_operand_t old,
gimple  stmt 
)
inlinestatic
   Relink ssa_imm_use node LINKNODE into the chain for OLD, with use occurring
   in STMT.  

References end_readonly_imm_use_p(), immediate_use_iterator_d::imm_use, immediate_use_iterator_d::iter_node, and ssa_use_operand_d::next.

static void set_ssa_use_from_ptr ( )
inlinestatic
   Set the value of a use pointed to by USE to VAL.  
static bool single_imm_use ( )
inlinestatic
   If VAR has only a single immediate nondebug use, return true, and
   set USE_P and STMT to the use pointer and stmt of occurrence.  
     If there aren't any uses whatsoever, we're done.  
     If there's a single use, check that it's not a debug stmt.  
     If there are debug stmts, we have to look at each of them.  

Referenced by finished_with_expr(), get_prop_dest_stmt(), phi_result_unknown_predicate(), and stmt_is_power_of_op().

bool single_imm_use_1 ( const ssa_use_operand_t head,
use_operand_p use_p,
gimple stmt 
)
   Return true if the var whose chain of uses starts at PTR has a
   single nondebug use.  Set USE_P and STMT to that single nondebug
   use, if so, or to NULL otherwise.  

Referenced by next_readonly_imm_use().

static tree single_phi_def ( )
inlinestatic
   If there is a single DEF in the PHI node which matches FLAG, return it.
   Otherwise return NULL_DEF_OPERAND_P.  

References immediate_use_iterator_d::end_p, and immediate_use_iterator_d::imm_use.

static def_operand_p single_ssa_def_operand ( )
inlinestatic
   If there is a single operand in STMT matching FLAGS, return it.  Otherwise
   return NULL.  

References ssa_operand_iterator_d::done.

static tree single_ssa_tree_operand ( )
inlinestatic
   If there is a single operand in STMT matching FLAGS, return it.  Otherwise
   return NULL.  
static use_operand_p single_ssa_use_operand ( )
inlinestatic
   If there is a single operand in STMT matching FLAGS, return it.  Otherwise
   return NULL.  
static bool zero_ssa_operands ( )
inlinestatic
   Return true if there are zero operands in STMT matching the type
   given in FLAGS.  

References clear_and_done_ssa_iter(), comp, and ssa_operand_iterator_d::done.