diff options
author | amacleod <amacleod@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-10-01 15:46:53 +0000 |
---|---|---|
committer | amacleod <amacleod@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-10-01 15:46:53 +0000 |
commit | 8f6fa493f6996ec343ead1770530605326197ff9 (patch) | |
tree | eaa52ec7e3d23ca35b23922da83d4e62a0837824 /gcc/tree-ssa-operands.h | |
parent | 24e28cb5278924fc604ac2c61162db3fa3b8f201 (diff) | |
download | gcc-8f6fa493f6996ec343ead1770530605326197ff9.tar.gz |
* tree-into-ssa.c (enum need_phi_state): Relocate from tree-flow.h.
(dump_decl_set): Move to gimple.c.
* gimple.h: Don't include tree-ssa-operands.h.
(dump_decl_set): Add prototype.
(gimple_vuse_op, gimple_vdef_op, update_stmt, update_stmt_if_modified):
Move to gimple-ssa.h.
(phi_ssa_name_p, phi_nodes, phi_nodes_ptr, gimple_phi_arg_def,
gimple_phi_arg_def_ptr, gimple_phi_arg_edge, gimple_phi_arg_location,
gimple_phi_arg_location_from_edge, gimple_phi_arg_set_location,
gimple_phi_arg_has_location): Relocate from tree-flow-inline.h
* gimple.c (walk_stmt_load_store_ops): Use gimple_phi_arg_def rather
than PHI_ARG_DEF.
(dump_decl_set): Relocate here.
* gimple-ssa.h: New file.
(gimple_vuse_op, gimple_vdef_op, update_stmt, update_stmt_if_modified):
Relocate from gimple.h.
* tree-cfg.c (has_zero_uses_1, single_imm_use_1): Move to...
* tree-ssa-operands.c (swap_ssa_operands): Rename from
swap_tree_operands and remove non-ssa path.
(has_zero_uses_1, single_imm_use_1): Relocate from tree-cfg.c.
* tree-ssa-reassoc.c (linearize_expr_tree, repropagate_negates): Use
swap_ssa_operands.
* tree-vect-loop.c (destroy_loop_vec_info, vect_is_slp_reduction,
vect_is_simple_reduction_1): Use swap_ssa_operands.
* tree-flow.h: Move various prototypes to tree-phinodes.h.
(enum need_phi_state): Move to tree-into-ssa.c.
(struct immediate_use_iterator_d, FOR_EACH_IMM_*,
BREAK_FROM_IMM_USE_STMT): Move to ssa-iterators.h.
(swap_tree_operands): Rename and move prototype to tree-ssa-operands.h.
* tree-flow-inline.h (delink_imm_use, link_imm_use_to_list,
link_imm_use, set_ssa_use_from_ptr, link_imm_use_stmt, relink_imm_use,
relink_imm_use_stmt, end_readonly_imm_use_p, first_readonly_imm_use,
next_readonly_imm_use, has_zero_uses, has_single_use, single_imm_use,
num_imm_uses): Move to ssa-iterators.h.
(get_use_from_ptr, get_def_from_ptr): Move to tree-ssa-operands.h
(gimple_phi_arg_imm_use_ptr, phi_arg_index_from_use): Move to
tree-phinodes.h.
(op_iter_done, op_iter_next_def, op_iter_next_tree,
clear_and_done_ssa_iter, op_iter_init, op_iter_init_use,
op_iter_init_def, op_iter_init_tree, single_ssa_tree_operand,
single_ssa_use_operand, single_ssa_def_operand, zero_ssa_operands,
num_ssa_operands, delink_stmt_imm_use, single_phi_def,
op_iter_init_phiuse, op_iter_init_phidef, end_imm_use_stmt_p,
end_imm_use_stmt_traverse, move_use_after_head, link_use_stmts_after,
first_imm_use_stmt, next_imm_use_stmt, first_imm_use_on_stmt,
end_imm_use_on_stmt_p, next_imm_use_on_stmt): Move to ssa-iterators.h.
(gimple_phi_arg_def, gimple_phi_arg_def_ptr, gimple_phi_arg_edge,
gimple_phi_arg_location, gimple_phi_arg_location_from_edge,
gimple_phi_arg_set_location, gimple_phi_arg_has_location, phi_nodes,
phi_nodes_ptr, phi_ssa_name_p): Move to gimple.h.
(set_phi_nodes): Move to tree-phinodes.h.
* tree-ssa-operands.h (enum ssa_op_iter_type,
struct ssa_operand_iterator_d, SSA_OP*, FOR_EACH_SSA*, SINGLE_SSA*,
ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS): Move to ssa-iterators.h.
(dump_decl_set): Remove prototype.
(get_use_from_ptr, get_def_from_ptr): Relocate from tree-flow.h.
* tree-phinodes.h: New file. Move some prototypes from tree-flow.h.
(set_phi_nodes): Relocate from tree-flow-inline.h.
(gimple_phi_arg_imm_use_ptr, phi_arg_index_from_use): Relocate from
tree-flow-inline.h
* tree-ssa.h: Add tree-phinodes.h, gimple-ssa.h, ssa-iterators.h to
include list. Temporarily add gimple.h to include list.
* ssa-iterators.h: New file.
(struct immediate_use_iterator_d, FOR_EACH_IMM_*,
BREAK_FROM_IMM_USE_STMT): Relocate from tree-flow.h.
(enum ssa_op_iter_type, struct ssa_operand_iterator_d, SSA_OP*,
FOR_EACH_SSA*, SINGLE_SSA*, ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS):
Relocate from tree-ssa-operands.h.
(delink_imm_use, link_imm_use_to_list, link_imm_use,
set_ssa_use_from_ptr, link_imm_use_stmt, relink_imm_use,
relink_imm_use_stmt, end_readonly_imm_use_p, first_readonly_imm_use,
next_readonly_imm_use, has_zero_uses, has_single_use, single_imm_use,
num_imm_uses, get_use_from_ptr, get_def_from_ptr,
phi_arg_index_from_use, op_iter_done, op_iter_next_def,
op_iter_next_tree, clear_and_done_ssa_iter, op_iter_init,
op_iter_init_use, op_iter_init_def, op_iter_init_tree,
single_ssa_tree_operand, single_ssa_use_operand, single_ssa_def_operand,
zero_ssa_operands, num_ssa_operands, delink_stmt_imm_use,
single_phi_def, op_iter_init_phiuse, op_iter_init_phidef,
end_imm_use_stmt_p, end_imm_use_stmt_traverse, move_use_after_head,
link_use_stmts_after, first_imm_use_stmt, next_imm_use_stmt,
first_imm_use_on_stmt, end_imm_use_on_stmt_p, next_imm_use_on_stmt):
Relocate from tree-flow-inline.h.
* tree-outof-ssa.h: Change _SSAEXPAND_H macro to GCC_TREE_OUTOF_SSA_H.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203068 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-operands.h')
-rw-r--r-- | gcc/tree-ssa-operands.h | 139 |
1 files changed, 20 insertions, 119 deletions
diff --git a/gcc/tree-ssa-operands.h b/gcc/tree-ssa-operands.h index 09a5a02ecf5..b3a4a920e88 100644 --- a/gcc/tree-ssa-operands.h +++ b/gcc/tree-ssa-operands.h @@ -75,9 +75,11 @@ struct GTY(()) ssa_operands { #define PHI_RESULT_PTR(PHI) gimple_phi_result_ptr (PHI) #define PHI_RESULT(PHI) DEF_FROM_PTR (PHI_RESULT_PTR (PHI)) #define SET_PHI_RESULT(PHI, V) SET_DEF (PHI_RESULT_PTR (PHI), (V)) - -#define PHI_ARG_DEF_PTR(PHI, I) gimple_phi_arg_imm_use_ptr ((PHI), (I)) +/* #define PHI_ARG_DEF(PHI, I) USE_FROM_PTR (PHI_ARG_DEF_PTR ((PHI), (I))) +*/ +#define PHI_ARG_DEF_PTR(PHI, I) gimple_phi_arg_imm_use_ptr ((PHI), (I)) +#define PHI_ARG_DEF(PHI, I) gimple_phi_arg_def ((PHI), (I)) #define SET_PHI_ARG_DEF(PHI, I, V) \ SET_USE (PHI_ARG_DEF_PTR ((PHI), (I)), (V)) #define PHI_ARG_DEF_FROM_EDGE(PHI, E) \ @@ -87,136 +89,35 @@ struct GTY(()) ssa_operands { #define PHI_ARG_INDEX_FROM_USE(USE) phi_arg_index_from_use (USE) +extern bool ssa_operands_active (struct function *); extern void init_ssa_operands (struct function *fn); extern void fini_ssa_operands (void); -extern void update_stmt_operands (gimple); +extern bool verify_ssa_operands (gimple stmt); extern void free_stmt_operands (gimple); +extern void update_stmt_operands (gimple); +extern void swap_ssa_operands (gimple, tree *, tree *); extern bool verify_imm_links (FILE *f, tree var); -extern bool verify_ssa_operands (gimple stmt); -extern void dump_immediate_uses (FILE *file); extern void dump_immediate_uses_for (FILE *file, tree var); +extern void dump_immediate_uses (FILE *file); extern void debug_immediate_uses (void); extern void debug_immediate_uses_for (tree var); -extern void dump_decl_set (FILE *, bitmap); -extern void debug_decl_set (bitmap); - -extern bool ssa_operands_active (struct function *); extern bool virtual_operand_p (tree); extern void unlink_stmt_vdef (gimple); -enum ssa_op_iter_type { - ssa_op_iter_none = 0, - ssa_op_iter_tree, - ssa_op_iter_use, - ssa_op_iter_def -}; - -/* 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. */ +/* Return the tree pointed-to by USE. */ +static inline tree +get_use_from_ptr (use_operand_p use) +{ + return *(use->use); +} -typedef struct ssa_operand_iterator_d +/* Return the tree pointed-to by DEF. */ +static inline tree +get_def_from_ptr (def_operand_p def) { - enum ssa_op_iter_type iter_type; - bool done; - int flags; - unsigned i; - unsigned numops; - use_optype_p uses; - gimple stmt; -} ssa_op_iter; - -/* These flags are used to determine which operands are returned during - execution of the loop. */ -#define SSA_OP_USE 0x01 /* Real USE operands. */ -#define SSA_OP_DEF 0x02 /* Real DEF operands. */ -#define SSA_OP_VUSE 0x04 /* VUSE operands. */ -#define SSA_OP_VDEF 0x08 /* VDEF operands. */ - -/* These are commonly grouped operand flags. */ -#define SSA_OP_VIRTUAL_USES (SSA_OP_VUSE) -#define SSA_OP_VIRTUAL_DEFS (SSA_OP_VDEF) -#define SSA_OP_ALL_VIRTUALS (SSA_OP_VIRTUAL_USES | SSA_OP_VIRTUAL_DEFS) -#define SSA_OP_ALL_USES (SSA_OP_VIRTUAL_USES | SSA_OP_USE) -#define SSA_OP_ALL_DEFS (SSA_OP_VIRTUAL_DEFS | SSA_OP_DEF) -#define SSA_OP_ALL_OPERANDS (SSA_OP_ALL_USES | SSA_OP_ALL_DEFS) - -/* 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. */ -#define FOR_EACH_SSA_TREE_OPERAND(TREEVAR, STMT, ITER, FLAGS) \ - for (TREEVAR = op_iter_init_tree (&(ITER), STMT, FLAGS); \ - !op_iter_done (&(ITER)); \ - (void) (TREEVAR = op_iter_next_tree (&(ITER)))) - -/* 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. */ -#define FOR_EACH_SSA_USE_OPERAND(USEVAR, STMT, ITER, FLAGS) \ - for (USEVAR = op_iter_init_use (&(ITER), STMT, FLAGS); \ - !op_iter_done (&(ITER)); \ - USEVAR = op_iter_next_use (&(ITER))) - -/* 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. */ -#define FOR_EACH_SSA_DEF_OPERAND(DEFVAR, STMT, ITER, FLAGS) \ - for (DEFVAR = op_iter_init_def (&(ITER), STMT, FLAGS); \ - !op_iter_done (&(ITER)); \ - DEFVAR = op_iter_next_def (&(ITER))) - -/* 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. */ -#define FOR_EACH_PHI_ARG(USEVAR, STMT, ITER, FLAGS) \ - for ((USEVAR) = op_iter_init_phiuse (&(ITER), STMT, FLAGS); \ - !op_iter_done (&(ITER)); \ - (USEVAR) = op_iter_next_use (&(ITER))) - - -/* 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. */ -#define FOR_EACH_PHI_OR_STMT_USE(USEVAR, STMT, ITER, FLAGS) \ - for ((USEVAR) = (gimple_code (STMT) == GIMPLE_PHI \ - ? op_iter_init_phiuse (&(ITER), STMT, FLAGS) \ - : op_iter_init_use (&(ITER), STMT, FLAGS)); \ - !op_iter_done (&(ITER)); \ - (USEVAR) = op_iter_next_use (&(ITER))) - -/* 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. */ -#define FOR_EACH_PHI_OR_STMT_DEF(DEFVAR, STMT, ITER, FLAGS) \ - for ((DEFVAR) = (gimple_code (STMT) == GIMPLE_PHI \ - ? op_iter_init_phidef (&(ITER), STMT, FLAGS) \ - : op_iter_init_def (&(ITER), STMT, FLAGS)); \ - !op_iter_done (&(ITER)); \ - (DEFVAR) = op_iter_next_def (&(ITER))) - -/* 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. */ -#define SINGLE_SSA_TREE_OPERAND(STMT, FLAGS) \ - single_ssa_tree_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 SINGLE_SSA_USE_OPERAND(STMT, FLAGS) \ - single_ssa_use_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_DEF_OPERAND(STMT, FLAGS) \ - single_ssa_def_operand (STMT, FLAGS) - -/* This macro returns TRUE if there are no operands matching FLAGS in STMT. */ -#define ZERO_SSA_OPERANDS(STMT, FLAGS) zero_ssa_operands (STMT, FLAGS) - -/* This macro counts the number of operands in STMT matching FLAGS. */ -#define NUM_SSA_OPERANDS(STMT, FLAGS) num_ssa_operands (STMT, FLAGS) + return *def; +} #endif /* GCC_TREE_SSA_OPERANDS_H */ |