Go to the source code of this file.
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 |
static void delink_stmt_imm_use |
( |
| ) |
|
|
inlinestatic |
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 |
static bool end_readonly_imm_use_p |
( |
| ) |
|
|
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 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 |
static void link_imm_use |
( |
| ) |
|
|
inlinestatic |
static void link_imm_use_stmt |
( |
| ) |
|
|
inlinestatic |
static void link_imm_use_to_list |
( |
| ) |
|
|
inlinestatic |
static void link_use_stmts_after |
( |
| ) |
|
|
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().
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.
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 unsigned int num_imm_uses |
( |
| ) |
|
|
inlinestatic |
static int num_ssa_operands |
( |
| ) |
|
|
inlinestatic |
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.
Initialize iterator PTR to the def operands in STMT based on FLAGS. Return
the first def.
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().
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().
Initialize iterator PTR to the use operands in STMT based on FLAGS. Return
the first use.
static tree op_iter_next_tree |
( |
| ) |
|
|
inlinestatic |
static void relink_imm_use |
( |
| ) |
|
|
inlinestatic |
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 |
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 |
static tree single_ssa_tree_operand |
( |
| ) |
|
|
inlinestatic |
If there is a single operand in STMT matching FLAGS, return it. Otherwise
return NULL.
If there is a single operand in STMT matching FLAGS, return it. Otherwise
return NULL.
static bool zero_ssa_operands |
( |
| ) |
|
|
inlinestatic |