From b9c94ed7ac6512c7551a007128fed6f3caf21ed1 Mon Sep 17 00:00:00 2001 From: hubicka Date: Sat, 23 Aug 2008 20:28:07 +0000 Subject: * tree.c (decl_address_ip_invariant_p): New function. * tree.h (decl_address_ip_invariant_p): Declare. * gimple.c (strip_invariant_refs): Break out from ... (is_gimple_invariant_address): ... here (is_gimple_ip_invariant_address): New function. (is_gimple_ip_invariant): New function. * gimple.h (is_gimple_ip_invariant_address, is_gimple_ip_invariant): Declare. * ipa-cp.c (ipcp_lat_is_const): Remove handling of IPA_CONST_VALUE_REF. (ipcp_lat_is_insertable): All constants are insertable. (ipcp_lattice_from_jfunc, ipcp_print_all_lattices): Remove handling of IPA_CONST_VALUE_REF. (ipcp_initialize_node_lattices): Propagate all types of operands. (build_const_val): Do not handle IPA_CONST_VALUE_REF. (ipcp_create_replace_map): Reformat. (ipcp_need_redirect_p): Simplify. (ipcp_insert_stage): Check that argument is used before clonning. * ipa-prop.c (ipa_print_node_jump_functions): Do not handle IPA_CONST_REF. (compute_scalar_jump_functions): Simplify using is_gimple_ip_invariat. (determine_cst_member_ptr): Keep wrapping ADDR_EXPR of members. (update_call_notes_after_inlining): Expect ADDR_EXPR in operand. * ipa-prop.h (jump_func_type): Remove IPA_CONST_REF. (jump_func_type): Remove IPA_CONST_VALUE_REF. * tree-inline.c (tree_function_versioning): Add variables referenced by replacing trees. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139523 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimple.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 50 insertions(+), 12 deletions(-) (limited to 'gcc/gimple.c') diff --git a/gcc/gimple.c b/gcc/gimple.c index 9e7d92155b0..c651f0db9c3 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -2730,17 +2730,12 @@ is_gimple_address (const_tree t) } } -/* Return true if T is a gimple invariant address. */ +/* Strip out all handled components that produce invariant + offsets. */ -bool -is_gimple_invariant_address (const_tree t) +static const_tree +strip_invariant_refs (const_tree op) { - tree op; - - if (TREE_CODE (t) != ADDR_EXPR) - return false; - - op = TREE_OPERAND (t, 0); while (handled_component_p (op)) { switch (TREE_CODE (op)) @@ -2750,12 +2745,12 @@ is_gimple_invariant_address (const_tree t) if (!is_gimple_constant (TREE_OPERAND (op, 1)) || TREE_OPERAND (op, 2) != NULL_TREE || TREE_OPERAND (op, 3) != NULL_TREE) - return false; + return NULL; break; case COMPONENT_REF: if (TREE_OPERAND (op, 2) != NULL_TREE) - return false; + return NULL; break; default:; @@ -2763,7 +2758,38 @@ is_gimple_invariant_address (const_tree t) op = TREE_OPERAND (op, 0); } - return CONSTANT_CLASS_P (op) || decl_address_invariant_p (op); + return op; +} + +/* Return true if T is a gimple invariant address. */ + +bool +is_gimple_invariant_address (const_tree t) +{ + const_tree op; + + if (TREE_CODE (t) != ADDR_EXPR) + return false; + + op = strip_invariant_refs (TREE_OPERAND (t, 0)); + + return op && (CONSTANT_CLASS_P (op) || decl_address_invariant_p (op)); +} + +/* Return true if T is a gimple invariant address at IPA level + (so addresses of variables on stack are not allowed). */ + +bool +is_gimple_ip_invariant_address (const_tree t) +{ + const_tree op; + + if (TREE_CODE (t) != ADDR_EXPR) + return false; + + op = strip_invariant_refs (TREE_OPERAND (t, 0)); + + return op && (CONSTANT_CLASS_P (op) || decl_address_ip_invariant_p (op)); } /* Return true if T is a GIMPLE minimal invariant. It's a restricted @@ -2778,6 +2804,18 @@ is_gimple_min_invariant (const_tree t) return is_gimple_constant (t); } +/* Return true if T is a GIMPLE interprocedural invariant. It's a restricted + form of gimple minimal invariant. */ + +bool +is_gimple_ip_invariant (const_tree t) +{ + if (TREE_CODE (t) == ADDR_EXPR) + return is_gimple_ip_invariant_address (t); + + return is_gimple_constant (t); +} + /* Return true if T looks like a valid GIMPLE statement. */ bool -- cgit v1.2.1