aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2008-08-23 22:28:07 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2008-08-23 20:28:07 +0000
commit00fc23337d06089d5662383e2f6bdea105055894 (patch)
treeb2d83395a226ce339483346c7db1d16095008402 /gcc/gimple.c
parent98e146ab5ceb193cc662f9f6c313a87988131f35 (diff)
downloadgcc-00fc23337d06089d5662383e2f6bdea105055894.zip
gcc-00fc23337d06089d5662383e2f6bdea105055894.tar.gz
gcc-00fc23337d06089d5662383e2f6bdea105055894.tar.bz2
tree.c (decl_address_ip_invariant_p): New function.
* 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. From-SVN: r139523
Diffstat (limited to 'gcc/gimple.c')
-rw-r--r--gcc/gimple.c62
1 files changed, 50 insertions, 12 deletions
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 9e7d921..c651f0d 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