diff options
Diffstat (limited to 'gcc/tree-flow-inline.h')
-rw-r--r-- | gcc/tree-flow-inline.h | 221 |
1 files changed, 118 insertions, 103 deletions
diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h index 49be48e1009..97dadd4b564 100644 --- a/gcc/tree-flow-inline.h +++ b/gcc/tree-flow-inline.h @@ -594,7 +594,7 @@ zero_imm_uses_p (tree var) ssa_use_operand_t *ptr = &(SSA_NAME_IMM_USE_NODE (var)); return (ptr == ptr->next); } - + /* Return the tree pointer to by USE. */ static inline tree get_use_from_ptr (use_operand_p use) @@ -693,9 +693,6 @@ set_is_used (tree var) ann->used = 1; } - -/* ----------------------------------------------------------------------- */ - /* Return true if T is an executable statement. */ static inline bool is_exec_stmt (tree t) @@ -841,6 +838,63 @@ loop_containing_stmt (tree stmt) return bb->loop_father; } + +/* Return the memory partition tag associated with symbol SYM. */ + +static inline tree +memory_partition (tree sym) +{ + tree tag; + + /* MPTs belong to their own partition. */ + if (TREE_CODE (sym) == MEMORY_PARTITION_TAG) + return sym; + + gcc_assert (!is_gimple_reg (sym)); + tag = get_var_ann (sym)->mpt; + +#if defined ENABLE_CHECKING + if (tag) + gcc_assert (TREE_CODE (tag) == MEMORY_PARTITION_TAG); +#endif + + return tag; +} + + +/* Set MPT to be the memory partition associated with symbol SYM. */ + +static inline void +set_memory_partition (tree sym, tree mpt) +{ +#if defined ENABLE_CHECKING + if (mpt) + gcc_assert (TREE_CODE (mpt) == MEMORY_PARTITION_TAG + && !is_gimple_reg (sym)); +#endif + var_ann (sym)->mpt = mpt; + if (mpt) + { + bitmap_set_bit (MPT_SYMBOLS (mpt), DECL_UID (sym)); + + /* MPT inherits the call-clobbering attributes from SYM. */ + if (is_call_clobbered (sym)) + { + MTAG_GLOBAL (mpt) = 1; + mark_call_clobbered (mpt, ESCAPE_IS_GLOBAL); + } + } +} + +/* Return true if NAME is a memory factoring SSA name (i.e., an SSA + name for a memory partition. */ + +static inline bool +factoring_name_p (tree name) +{ + return TREE_CODE (SSA_NAME_VAR (name)) == MEMORY_PARTITION_TAG; +} + /* Return true if VAR is a clobbered by function calls. */ static inline bool is_call_clobbered (tree var) @@ -874,16 +928,6 @@ clear_call_clobbered (tree var) bitmap_clear_bit (gimple_call_clobbered_vars (cfun), DECL_UID (var)); } -/* Mark variable VAR as being non-addressable. */ -static inline void -mark_non_addressable (tree var) -{ - if (!MTAG_P (var)) - DECL_CALL_CLOBBERED (var) = false; - bitmap_clear_bit (gimple_call_clobbered_vars (cfun), DECL_UID (var)); - TREE_ADDRESSABLE (var) = 0; -} - /* Return the common annotation for T. Return NULL if the annotation doesn't already exist. */ static inline tree_ann_common_t @@ -929,20 +973,22 @@ op_iter_next_use (ssa_op_iter *ptr) } if (ptr->vuses) { - use_p = VUSE_OP_PTR (ptr->vuses); - ptr->vuses = ptr->vuses->next; + use_p = VUSE_OP_PTR (ptr->vuses, ptr->vuse_index); + if (++(ptr->vuse_index) >= VUSE_NUM (ptr->vuses)) + { + ptr->vuse_index = 0; + ptr->vuses = ptr->vuses->next; + } return use_p; } if (ptr->mayuses) { - use_p = MAYDEF_OP_PTR (ptr->mayuses); - ptr->mayuses = ptr->mayuses->next; - return use_p; - } - if (ptr->mustkills) - { - use_p = MUSTDEF_KILL_PTR (ptr->mustkills); - ptr->mustkills = ptr->mustkills->next; + use_p = VDEF_OP_PTR (ptr->mayuses, ptr->mayuse_index); + if (++(ptr->mayuse_index) >= VDEF_NUM (ptr->mayuses)) + { + ptr->mayuse_index = 0; + ptr->mayuses = ptr->mayuses->next; + } return use_p; } if (ptr->phi_i < ptr->num_phi) @@ -967,16 +1013,10 @@ op_iter_next_def (ssa_op_iter *ptr) ptr->defs = ptr->defs->next; return def_p; } - if (ptr->mustdefs) + if (ptr->vdefs) { - def_p = MUSTDEF_RESULT_PTR (ptr->mustdefs); - ptr->mustdefs = ptr->mustdefs->next; - return def_p; - } - if (ptr->maydefs) - { - def_p = MAYDEF_RESULT_PTR (ptr->maydefs); - ptr->maydefs = ptr->maydefs->next; + def_p = VDEF_RESULT_PTR (ptr->vdefs); + ptr->vdefs = ptr->vdefs->next; return def_p; } ptr->done = true; @@ -999,20 +1039,22 @@ op_iter_next_tree (ssa_op_iter *ptr) } if (ptr->vuses) { - val = VUSE_OP (ptr->vuses); - ptr->vuses = ptr->vuses->next; + val = VUSE_OP (ptr->vuses, ptr->vuse_index); + if (++(ptr->vuse_index) >= VUSE_NUM (ptr->vuses)) + { + ptr->vuse_index = 0; + ptr->vuses = ptr->vuses->next; + } return val; } if (ptr->mayuses) { - val = MAYDEF_OP (ptr->mayuses); - ptr->mayuses = ptr->mayuses->next; - return val; - } - if (ptr->mustkills) - { - val = MUSTDEF_KILL (ptr->mustkills); - ptr->mustkills = ptr->mustkills->next; + val = VDEF_OP (ptr->mayuses, ptr->mayuse_index); + if (++(ptr->mayuse_index) >= VDEF_NUM (ptr->mayuses)) + { + ptr->mayuse_index = 0; + ptr->mayuses = ptr->mayuses->next; + } return val; } if (ptr->defs) @@ -1021,16 +1063,10 @@ op_iter_next_tree (ssa_op_iter *ptr) ptr->defs = ptr->defs->next; return val; } - if (ptr->mustdefs) + if (ptr->vdefs) { - val = MUSTDEF_RESULT (ptr->mustdefs); - ptr->mustdefs = ptr->mustdefs->next; - return val; - } - if (ptr->maydefs) - { - val = MAYDEF_RESULT (ptr->maydefs); - ptr->maydefs = ptr->maydefs->next; + val = VDEF_RESULT (ptr->vdefs); + ptr->vdefs = ptr->vdefs->next; return val; } @@ -1050,15 +1086,15 @@ clear_and_done_ssa_iter (ssa_op_iter *ptr) ptr->defs = NULL; ptr->uses = NULL; ptr->vuses = NULL; - ptr->maydefs = NULL; + ptr->vdefs = NULL; ptr->mayuses = NULL; - ptr->mustdefs = NULL; - ptr->mustkills = NULL; ptr->iter_type = ssa_op_iter_none; ptr->phi_i = 0; ptr->num_phi = 0; ptr->phi_stmt = NULL_TREE; ptr->done = true; + ptr->vuse_index = 0; + ptr->mayuse_index = 0; } /* Initialize the iterator PTR to the virtual defs in STMT. */ @@ -1072,15 +1108,15 @@ op_iter_init (ssa_op_iter *ptr, tree stmt, int flags) ptr->defs = (flags & SSA_OP_DEF) ? DEF_OPS (stmt) : NULL; ptr->uses = (flags & SSA_OP_USE) ? USE_OPS (stmt) : NULL; ptr->vuses = (flags & SSA_OP_VUSE) ? VUSE_OPS (stmt) : NULL; - ptr->maydefs = (flags & SSA_OP_VMAYDEF) ? MAYDEF_OPS (stmt) : NULL; - ptr->mayuses = (flags & SSA_OP_VMAYUSE) ? MAYDEF_OPS (stmt) : NULL; - ptr->mustdefs = (flags & SSA_OP_VMUSTDEF) ? MUSTDEF_OPS (stmt) : NULL; - ptr->mustkills = (flags & SSA_OP_VMUSTKILL) ? MUSTDEF_OPS (stmt) : NULL; + ptr->vdefs = (flags & SSA_OP_VDEF) ? VDEF_OPS (stmt) : NULL; + ptr->mayuses = (flags & SSA_OP_VMAYUSE) ? VDEF_OPS (stmt) : NULL; ptr->done = false; ptr->phi_i = 0; ptr->num_phi = 0; ptr->phi_stmt = NULL_TREE; + ptr->vuse_index = 0; + ptr->mayuse_index = 0; } /* Initialize iterator PTR to the use operands in STMT based on FLAGS. Return @@ -1099,7 +1135,7 @@ op_iter_init_use (ssa_op_iter *ptr, tree stmt, int flags) static inline def_operand_p op_iter_init_def (ssa_op_iter *ptr, tree stmt, int flags) { - gcc_assert ((flags & (SSA_OP_ALL_USES | SSA_OP_VIRTUAL_KILLS)) == 0); + gcc_assert ((flags & SSA_OP_ALL_USES) == 0); op_iter_init (ptr, stmt, flags); ptr->iter_type = ssa_op_iter_def; return op_iter_next_def (ptr); @@ -1118,73 +1154,53 @@ op_iter_init_tree (ssa_op_iter *ptr, tree stmt, int flags) /* Get the next iterator mustdef value for PTR, returning the mustdef values in KILL and DEF. */ static inline void -op_iter_next_maymustdef (use_operand_p *use, def_operand_p *def, +op_iter_next_vdef (vuse_vec_p *use, def_operand_p *def, ssa_op_iter *ptr) { #ifdef ENABLE_CHECKING - gcc_assert (ptr->iter_type == ssa_op_iter_maymustdef); + gcc_assert (ptr->iter_type == ssa_op_iter_vdef); #endif if (ptr->mayuses) { - *def = MAYDEF_RESULT_PTR (ptr->mayuses); - *use = MAYDEF_OP_PTR (ptr->mayuses); + *def = VDEF_RESULT_PTR (ptr->mayuses); + *use = VDEF_VECT (ptr->mayuses); ptr->mayuses = ptr->mayuses->next; return; } - if (ptr->mustkills) - { - *def = MUSTDEF_RESULT_PTR (ptr->mustkills); - *use = MUSTDEF_KILL_PTR (ptr->mustkills); - ptr->mustkills = ptr->mustkills->next; - return; - } - *def = NULL_DEF_OPERAND_P; - *use = NULL_USE_OPERAND_P; + *use = NULL; ptr->done = true; return; } -/* Initialize iterator PTR to the operands in STMT. Return the first operands - in USE and DEF. */ static inline void -op_iter_init_maydef (ssa_op_iter *ptr, tree stmt, use_operand_p *use, - def_operand_p *def) +op_iter_next_mustdef (use_operand_p *use, def_operand_p *def, + ssa_op_iter *ptr) { - gcc_assert (TREE_CODE (stmt) != PHI_NODE); - - op_iter_init (ptr, stmt, SSA_OP_VMAYUSE); - ptr->iter_type = ssa_op_iter_maymustdef; - op_iter_next_maymustdef (use, def, ptr); + vuse_vec_p vp; + op_iter_next_vdef (&vp, def, ptr); + if (vp != NULL) + { + gcc_assert (VUSE_VECT_NUM_ELEM (*vp) == 1); + *use = VUSE_ELEMENT_PTR (*vp, 0); + } + else + *use = NULL_USE_OPERAND_P; } - /* Initialize iterator PTR to the operands in STMT. Return the first operands - in KILL and DEF. */ + in USE and DEF. */ static inline void -op_iter_init_mustdef (ssa_op_iter *ptr, tree stmt, use_operand_p *kill, +op_iter_init_vdef (ssa_op_iter *ptr, tree stmt, vuse_vec_p *use, def_operand_p *def) { gcc_assert (TREE_CODE (stmt) != PHI_NODE); - op_iter_init (ptr, stmt, SSA_OP_VMUSTKILL); - ptr->iter_type = ssa_op_iter_maymustdef; - op_iter_next_maymustdef (kill, def, ptr); -} - -/* Initialize iterator PTR to the operands in STMT. Return the first operands - in KILL and DEF. */ -static inline void -op_iter_init_must_and_may_def (ssa_op_iter *ptr, tree stmt, - use_operand_p *kill, def_operand_p *def) -{ - gcc_assert (TREE_CODE (stmt) != PHI_NODE); - - op_iter_init (ptr, stmt, SSA_OP_VMUSTKILL|SSA_OP_VMAYUSE); - ptr->iter_type = ssa_op_iter_maymustdef; - op_iter_next_maymustdef (kill, def, ptr); + op_iter_init (ptr, stmt, SSA_OP_VMAYUSE); + ptr->iter_type = ssa_op_iter_vdef; + op_iter_next_vdef (use, def, ptr); } @@ -1277,8 +1293,7 @@ delink_stmt_imm_use (tree stmt) use_operand_p use_p; if (ssa_operands_active ()) - FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, - (SSA_OP_ALL_USES | SSA_OP_ALL_KILLS)) + FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_ALL_USES) delink_imm_use (use_p); } |