GCC Middle and Back End API 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 } |
#define BREAK_FROM_IMM_USE_STMT | ( | ITER | ) |
Use this to terminate the FOR_EACH_IMM_USE_STMT loop early. Failure to do so will result in leaving a iterator marker node in the immediate use list, and nothing good will come from that.
Referenced by destroy_bb_vec_info(), determine_unroll_factor(), and rewrite_use_nonlinear_expr().
#define FOR_EACH_IMM_USE_FAST | ( | DEST, | |
ITER, | |||
SSAVAR | |||
) |
Use this iterator when simply looking at stmts. Adding, deleting or modifying stmts will cause this iterator to malfunction.
Referenced by all_immediate_uses_same_place(), avoid_complex_debug_insns(), find_released_ssa_name(), initialize_root_vars_lm(), ipa_analyze_call_uses(), loe_visit_block(), partition_free(), remove_ssa_form(), and vect_mark_relevant().
#define FOR_EACH_IMM_USE_ON_STMT | ( | DEST, | |
ITER | |||
) |
Use this iterator in combination with FOR_EACH_IMM_USE_STMT to get access to each occurrence of ssavar on the stmt returned by that iterator.. for instance:
FOR_EACH_IMM_USE_STMT (stmt, iter, var) { FOR_EACH_IMM_USE_ON_STMT (use_p, iter) { SET_USE (use_p, blah); } update_stmt (stmt); }
Referenced by avoid_complex_debug_insns(), lookup_avail_expr(), process_assert_insertions_for(), and rewrite_use_nonlinear_expr().
#define FOR_EACH_IMM_USE_STMT | ( | STMT, | |
ITER, | |||
SSAVAR | |||
) |
Use this iterator to visit each stmt which has a use of SSAVAR.
Referenced by avoid_complex_debug_insns(), destroy_bb_vec_info(), determine_unroll_factor(), dump_all_asserts(), insert_debug_temps_for_defs(), lookup_avail_expr(), note_simd_array_uses(), process_assert_insertions_for(), reset_debug_uses(), rewrite_use_nonlinear_expr(), and vect_analyze_slp().
#define FOR_EACH_PHI_ARG | ( | USEVAR, | |
STMT, | |||
ITER, | |||
FLAGS | |||
) |
This macro will execute a loop over all the arguments of a PHI which match FLAGS. A use_operand_p is always returned via USEVAR. FLAGS can be either SSA_OP_USE or SSA_OP_VIRTUAL_USES or SSA_OP_ALL_USES.
Referenced by eliminate_phi(), op_iter_init_phidef(), and register_edge_assert_for().
#define FOR_EACH_PHI_OR_STMT_DEF | ( | DEFVAR, | |
STMT, | |||
ITER, | |||
FLAGS | |||
) |
This macro will execute a loop over a stmt, regardless of whether it is a real stmt or a PHI node, looking at the DEF nodes matching FLAGS.
Referenced by create_edge_for_control_dependence().
#define FOR_EACH_PHI_OR_STMT_USE | ( | USEVAR, | |
STMT, | |||
ITER, | |||
FLAGS | |||
) |
This macro will execute a loop over a stmt, regardless of whether it is a real stmt or a PHI node, looking at the USE nodes matching FLAGS.
Referenced by separate_decls_in_region_stmt().
#define FOR_EACH_SSA_DEF_OPERAND | ( | DEFVAR, | |
STMT, | |||
ITER, | |||
FLAGS | |||
) |
This macro executes a loop over the operands of STMT specified in FLAG, returning each operand as a 'def_operand_p' in the variable DEFVAR. ITER is an ssa_op_iter structure used to control the loop.
Referenced by destroy_bb_vec_info(), gimple_redirect_edge_and_branch(), and reset_debug_uses().
#define FOR_EACH_SSA_TREE_OPERAND | ( | TREEVAR, | |
STMT, | |||
ITER, | |||
FLAGS | |||
) |
This macro executes a loop over the operands of STMT specified in FLAG, returning each operand as a 'tree' in the variable TREEVAR. ITER is an ssa_op_iter structure used to control the loop.
Referenced by check_array_ref(), do_partial_partial_insertion(), get_value_for_expr(), insert_range_assertions(), register_edge_assert_for_1(), single_ssa_tree_operand(), surely_varying_stmt_p(), and vect_create_cond_for_alias_checks().
#define FOR_EACH_SSA_USE_OPERAND | ( | USEVAR, | |
STMT, | |||
ITER, | |||
FLAGS | |||
) |
This macro executes a loop over the operands of STMT specified in FLAG, returning each operand as a 'use_operand_p' in the variable USEVAR. ITER is an ssa_op_iter structure used to control the loop.
Referenced by op_iter_init_phidef(), rewrite_debug_stmt_uses(), set_rename(), and warn_uninitialized_vars().
#define NUM_SSA_OPERANDS | ( | STMT, | |
FLAGS | |||
) | num_ssa_operands (STMT, FLAGS) |
This macro counts the number of operands in STMT matching FLAGS.
#define SINGLE_SSA_DEF_OPERAND | ( | STMT, | |
FLAGS | |||
) | single_ssa_def_operand (STMT, FLAGS) |
This macro returns an operand in STMT as a def_operand_p if it is the ONLY operand matching FLAGS. If there are 0 or more than 1 operand matching FLAGS, then NULL_DEF_OPERAND_P is returned.
#define SINGLE_SSA_TREE_OPERAND | ( | STMT, | |
FLAGS | |||
) | single_ssa_tree_operand (STMT, FLAGS) |
This macro returns an operand in STMT as a tree if it is the ONLY operand matching FLAGS. If there are 0 or more than 1 operand matching FLAGS, then NULL_TREE is returned.
Referenced by find_loop_niter(), and finished_with_expr().
#define SINGLE_SSA_USE_OPERAND | ( | STMT, | |
FLAGS | |||
) | single_ssa_use_operand (STMT, FLAGS) |
This macro returns an operand in STMT as a use_operand_p if it is the ONLY operand matching FLAGS. If there are 0 or more than 1 operand matching FLAGS, then NULL_USE_OPERAND_P is returned.
#define SSA_OP_ALL_DEFS (SSA_OP_VIRTUAL_DEFS | SSA_OP_DEF) |
Referenced by gimple_redirect_edge_and_branch(), and surely_varying_stmt_p().
#define SSA_OP_ALL_OPERANDS (SSA_OP_ALL_USES | SSA_OP_ALL_DEFS) |
#define SSA_OP_ALL_USES (SSA_OP_VIRTUAL_USES | SSA_OP_USE) |
Referenced by rewrite_debug_stmt_uses().
#define SSA_OP_ALL_VIRTUALS (SSA_OP_VIRTUAL_USES | SSA_OP_VIRTUAL_DEFS) |
#define SSA_OP_DEF 0x02 /* Real DEF operands. */ |
#define SSA_OP_USE 0x01 /* Real USE operands. */ |
These flags are used to determine which operands are returned during execution of the loop.
Referenced by do_partial_partial_insertion(), eliminate_phi(), find_loop_niter(), get_value_for_expr(), op_iter_init_phidef(), op_iter_next_tree(), register_edge_assert_for(), register_edge_assert_for_1(), separate_decls_in_region_stmt(), set_rename(), vect_create_cond_for_alias_checks(), and warn_uninitialized_vars().
#define SSA_OP_VDEF 0x08 /* VDEF operands. */ |
Referenced by num_imm_uses(), op_iter_next_tree(), and op_iter_next_use().
#define SSA_OP_VIRTUAL_DEFS (SSA_OP_VDEF) |
#define SSA_OP_VIRTUAL_USES (SSA_OP_VUSE) |
These are commonly grouped operand flags.
Referenced by op_iter_init_phidef().
#define SSA_OP_VUSE 0x04 /* VUSE operands. */ |
Referenced by op_iter_next_tree().
#define ZERO_SSA_OPERANDS | ( | STMT, | |
FLAGS | |||
) | zero_ssa_operands (STMT, FLAGS) |
This macro returns TRUE if there are no operands matching FLAGS in STMT.
Referenced by register_edge_assert_for_1().
typedef struct immediate_use_iterator_d imm_use_iterator |
Header file for SSA iterators. Copyright (C) 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/. 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.
typedef struct ssa_operand_iterator_d ssa_op_iter |
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.
enum ssa_op_iter_type |
|
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().
|
inlinestatic |
Delink an immediate_uses node from its chain.
Return if this node is not in a list.
References gcc_checking_assert, link_imm_use_to_list(), NULL, ssa_use_operand_d::prev, SSA_NAME_IMM_USE_NODE, TREE_CODE, and ssa_use_operand_d::use.
Referenced by finalize_ssa_uses(), link_imm_use_to_list(), op_iter_init_phiuse(), and release_ssa_name().
|
inlinestatic |
Delink all immediate_use information for STMT.
Referenced by gsi_split_seq_before().
|
inlinestatic |
Return TRUE if the last use on the stmt IMM refers to has been visited.
|
inlinestatic |
Return true is IMM has reached the end of the immediate use stmt list.
|
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, NULL_USE_OPERAND_P, ssa_use_operand_d::prev, and SSA_NAME_IMM_USE_NODE.
|
inlinestatic |
Return true is IMM has reached the end of the immediate use list.
Referenced by relink_imm_use_stmt().
|
inlinestatic |
This routine will return the first use on the stmt IMM currently refers to.
|
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.
|
inlinestatic |
Initialize iterator IMM to process the list for VAR.
References has_zero_uses_1(), MAY_HAVE_DEBUG_STMTS, ssa_use_operand_d::next, and SSA_NAME_IMM_USE_NODE.
|
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().
|
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, NULL, NULL_USE_OPERAND_P, SSA_NAME_IMM_USE_NODE, ssa_use_operand_d::stmt, and USE_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().
|
inlinestatic |
Link ssa_imm_use node LINKNODE into the chain for DEF.
Referenced by link_imm_use_stmt(), and link_imm_use_to_list().
|
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, NULL, relink_imm_use(), and ssa_use_operand_d::stmt.
Referenced by lower_emutls_stmt().
|
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().
|
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.
|
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().
|
inlinestatic |
Bump to the next use on the stmt IMM refers to, return NULL if done.
|
inlinestatic |
Bump IMM to the next stmt which has a use of var.
|
inlinestatic |
Bump IMM to the next use in the list.
References is_gimple_debug(), MAY_HAVE_DEBUG_STMTS, ssa_use_operand_d::next, NULL, single_imm_use_1(), SSA_NAME_IMM_USE_NODE, and USE_STMT.
|
inlinestatic |
Return the number of nondebug immediate uses of VAR.
References ssa_operand_iterator_d::flags, gcc_checking_assert, gimple_op_ptr(), gimple_vdef_ptr(), ssa_operand_iterator_d::i, is_gimple_reg(), ssa_operand_iterator_d::iter_type, ssa_operand_iterator_d::numops, SSA_OP_DEF, ssa_op_iter_def, SSA_OP_VDEF, ssa_operand_iterator_d::stmt, TREE_CODE, and TREE_VALUE.
|
inlinestatic |
Return the number of operands matching FLAGS in STMT.
References ssa_operand_iterator_d::done, and NULL_DEF_OPERAND_P.
|
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().
|
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.
|
inlinestatic |
Initialize iterator PTR to the def operands in STMT based on FLAGS. Return the first def.
|
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 FOR_EACH_PHI_ARG, FOR_EACH_SSA_USE_OPERAND, gimple_vuse_op(), is_gimple_reg(), move_use_after_head(), NULL_USE_OPERAND_P, SSA_OP_USE, SSA_OP_VIRTUAL_USES, USE_FROM_PTR, and USE_STMT.
|
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.
|
inlinestatic |
Initialize iterator PTR to the operands in STMT based on FLAGS. Return the first operand as a tree.
References op_iter_done().
|
inlinestatic |
Initialize iterator PTR to the use operands in STMT based on FLAGS. Return the first use.
|
inlinestatic |
Get the next iterator def value for PTR.
References is_gimple_reg(), TREE_CODE, and TREE_VALUE.
|
inlinestatic |
Get the next iterator tree value for PTR.
References ssa_operand_iterator_d::done, ssa_operand_iterator_d::flags, gcc_checking_assert, gimple_asm_noutputs(), gimple_use_ops(), gimple_vuse(), ssa_operand_iterator_d::i, use_optype_d::next, NULL, NULL_TREE, ssa_operand_iterator_d::numops, SSA_OP_DEF, SSA_OP_USE, SSA_OP_VDEF, SSA_OP_VUSE, ssa_operand_iterator_d::stmt, and ssa_operand_iterator_d::uses.
|
inlinestatic |
Get the next iterator use value for PTR.
References ssa_operand_iterator_d::flags, gcc_checking_assert, gimple_op(), gimple_vdef(), ssa_operand_iterator_d::i, ssa_operand_iterator_d::iter_type, use_optype_d::next, ssa_operand_iterator_d::numops, SSA_OP_DEF, ssa_op_iter_tree, SSA_OP_VDEF, ssa_operand_iterator_d::stmt, USE_OP, and ssa_operand_iterator_d::uses.
|
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().
|
inlinestatic |
Relink ssa_imm_use node LINKNODE into the chain for OLD, with use occurring in STMT.
References end_readonly_imm_use_p(), gcc_assert, immediate_use_iterator_d::imm_use, immediate_use_iterator_d::iter_node, and ssa_use_operand_d::next.
|
inlinestatic |
Set the value of a use pointed to by USE to VAL.
|
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().
|
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.
|
inlinestatic |
If there is a single operand in STMT matching FLAGS, return it. Otherwise return NULL.
References ssa_operand_iterator_d::done, and NULL_USE_OPERAND_P.
|
inlinestatic |
If there is a single operand in STMT matching FLAGS, return it. Otherwise return NULL.
References FOR_EACH_SSA_TREE_OPERAND, and gcc_checking_assert.
|
inlinestatic |
If there is a single operand in STMT matching FLAGS, return it. Otherwise return NULL.
|
inlinestatic |
Return true if there are zero operands in STMT matching the type given in FLAGS.
References clear_and_done_ssa_iter(), comp, ssa_operand_iterator_d::done, gcc_checking_assert, and PHI_RESULT.