aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2009-05-20 12:18:10 +0200
committerMartin Jambor <jamborm@gcc.gnu.org>2009-05-20 12:18:10 +0200
commit7ec492570b77735583dceb28b091b4fa71ea1320 (patch)
treec7a89b4084761b0c88e079e93dac65e6158c5343 /gcc
parent3f6f0eb2e4a89be2eed80ad57bf003c3fc0aa210 (diff)
downloadgcc-7ec492570b77735583dceb28b091b4fa71ea1320.zip
gcc-7ec492570b77735583dceb28b091b4fa71ea1320.tar.gz
gcc-7ec492570b77735583dceb28b091b4fa71ea1320.tar.bz2
tree-flow.h (insert_edge_copies_seq): Undeclare.
2009-05-20 Martin Jambor <mjambor@suse.cz> * tree-flow.h (insert_edge_copies_seq): Undeclare. (sra_insert_before): Likewise. (sra_insert_after): Likewise. (sra_init_cache): Likewise. (sra_type_can_be_decomposed_p): Likewise. * tree-mudflap.c (insert_edge_copies_seq): Copied here from tree-sra.c * tree-sra.c (sra_type_can_be_decomposed_p): Made static. (sra_insert_before): Likewise. (sra_insert_after): Likewise. (sra_init_cache): Likewise. (insert_edge_copies_seq): Made static and moved upwards. * tree-complex.c (extract_component): Added VIEW_CONVERT_EXPR switch case. * tree-flow-inline.h (contains_view_convert_expr_p): New function. * ipa-prop.c (get_ssa_def_if_simple_copy): New function. (determine_cst_member_ptr): Call get_ssa_def_if_simple_copy to skip simple copies. From-SVN: r147733
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog23
-rw-r--r--gcc/ipa-prop.c18
-rw-r--r--gcc/tree-complex.c1
-rw-r--r--gcc/tree-flow-inline.h15
-rw-r--r--gcc/tree-flow.h7
-rw-r--r--gcc/tree-mudflap.c20
-rw-r--r--gcc/tree-sra.c48
7 files changed, 101 insertions, 31 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 19a59b5..0e39144 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,26 @@
+2009-05-20 Martin Jambor <mjambor@suse.cz>
+
+ * tree-flow.h (insert_edge_copies_seq): Undeclare.
+ (sra_insert_before): Likewise.
+ (sra_insert_after): Likewise.
+ (sra_init_cache): Likewise.
+ (sra_type_can_be_decomposed_p): Likewise.
+ * tree-mudflap.c (insert_edge_copies_seq): Copied here from tree-sra.c
+ * tree-sra.c (sra_type_can_be_decomposed_p): Made static.
+ (sra_insert_before): Likewise.
+ (sra_insert_after): Likewise.
+ (sra_init_cache): Likewise.
+ (insert_edge_copies_seq): Made static and moved upwards.
+
+ * tree-complex.c (extract_component): Added VIEW_CONVERT_EXPR switch
+ case.
+
+ * tree-flow-inline.h (contains_view_convert_expr_p): New function.
+
+ * ipa-prop.c (get_ssa_def_if_simple_copy): New function.
+ (determine_cst_member_ptr): Call get_ssa_def_if_simple_copy to skip
+ simple copies.
+
2009-05-20 Richard Guenther <rguenther@suse.de>
* expr.c (expand_expr_real_1): Avoid calling do_store_flag
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 9088913..6f5e26b 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -428,6 +428,22 @@ fill_member_ptr_cst_jump_function (struct ipa_jump_func *jfunc,
jfunc->value.member_cst.delta = delta;
}
+/* If RHS is an SSA_NAMe and it is defined by a simple copy assign statement,
+ return the rhs of its defining statement. */
+
+static inline tree
+get_ssa_def_if_simple_copy (tree rhs)
+{
+ while (TREE_CODE (rhs) == SSA_NAME && !SSA_NAME_IS_DEFAULT_DEF (rhs))
+ {
+ gimple def_stmt = SSA_NAME_DEF_STMT (rhs);
+
+ if (gimple_assign_single_p (def_stmt))
+ rhs = gimple_assign_rhs1 (def_stmt);
+ }
+ return rhs;
+}
+
/* Traverse statements from CALL backwards, scanning whether the argument ARG
which is a member pointer is filled in with constant values. If it is, fill
the jump function JFUNC in appropriately. METHOD_FIELD and DELTA_FIELD are
@@ -467,6 +483,7 @@ determine_cst_member_ptr (gimple call, tree arg, tree method_field,
fld = TREE_OPERAND (lhs, 1);
if (!method && fld == method_field)
{
+ rhs = get_ssa_def_if_simple_copy (rhs);
if (TREE_CODE (rhs) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (rhs, 0)) == FUNCTION_DECL
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (rhs, 0))) == METHOD_TYPE)
@@ -484,6 +501,7 @@ determine_cst_member_ptr (gimple call, tree arg, tree method_field,
if (!delta && fld == delta_field)
{
+ rhs = get_ssa_def_if_simple_copy (rhs);
if (TREE_CODE (rhs) == INTEGER_CST)
{
delta = rhs;
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index 2835220..3f1992b 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -604,6 +604,7 @@ extract_component (gimple_stmt_iterator *gsi, tree t, bool imagpart_p,
case INDIRECT_REF:
case COMPONENT_REF:
case ARRAY_REF:
+ case VIEW_CONVERT_EXPR:
{
tree inner_type = TREE_TYPE (TREE_TYPE (t));
diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h
index 6a1ae4c..e6de377 100644
--- a/gcc/tree-flow-inline.h
+++ b/gcc/tree-flow-inline.h
@@ -1136,6 +1136,21 @@ ref_contains_array_ref (const_tree ref)
return false;
}
+/* Return true if REF has an VIEW_CONVERT_EXPR somewhere in it. */
+
+static inline bool
+contains_view_convert_expr_p (const_tree ref)
+{
+ while (handled_component_p (ref))
+ {
+ if (TREE_CODE (ref) == VIEW_CONVERT_EXPR)
+ return true;
+ ref = TREE_OPERAND (ref, 0);
+ }
+
+ return false;
+}
+
/* Return true, if the two ranges [POS1, SIZE1] and [POS2, SIZE2]
overlap. SIZE1 and/or SIZE2 can be (unsigned)-1 in which case the
range is open-ended. Otherwise return false. */
diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h
index a02eca5..df14eeb 100644
--- a/gcc/tree-flow.h
+++ b/gcc/tree-flow.h
@@ -881,13 +881,6 @@ tree vn_lookup_with_vuses (tree, VEC (tree, gc) *);
/* In tree-ssa-sink.c */
bool is_hidden_global_store (gimple);
-/* In tree-sra.c */
-void insert_edge_copies_seq (gimple_seq, basic_block);
-void sra_insert_before (gimple_stmt_iterator *, gimple_seq);
-void sra_insert_after (gimple_stmt_iterator *, gimple_seq);
-void sra_init_cache (void);
-bool sra_type_can_be_decomposed_p (tree);
-
/* In tree-loop-linear.c */
extern void linear_transform_loops (void);
extern unsigned perfect_loop_nest_depth (struct loop *);
diff --git a/gcc/tree-mudflap.c b/gcc/tree-mudflap.c
index 0c07b97..5f4f5ac 100644
--- a/gcc/tree-mudflap.c
+++ b/gcc/tree-mudflap.c
@@ -447,6 +447,26 @@ execute_mudflap_function_ops (void)
return 0;
}
+/* Insert a gimple_seq SEQ on all the outgoing edges out of BB. Note that
+ if BB has more than one edge, STMT will be replicated for each edge.
+ Also, abnormal edges will be ignored. */
+
+static void
+insert_edge_copies_seq (gimple_seq seq, basic_block bb)
+{
+ edge e;
+ edge_iterator ei;
+ unsigned n_copies = -1;
+
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ if (!(e->flags & EDGE_ABNORMAL))
+ n_copies++;
+
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ if (!(e->flags & EDGE_ABNORMAL))
+ gsi_insert_seq_on_edge (e, n_copies-- > 0 ? gimple_seq_copy (seq) : seq);
+}
+
/* Create and initialize local shadow variables for the lookup cache
globals. Put their decls in the *_l globals for use by
mf_build_check_statement_for. */
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 626a253..0f68941 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -236,7 +236,7 @@ is_sra_scalar_type (tree type)
instantiated, just that if we decide to break up the type into
separate pieces that it can be done. */
-bool
+static bool
sra_type_can_be_decomposed_p (tree type)
{
unsigned int cache = TYPE_UID (TYPE_MAIN_VARIANT (type)) * 2;
@@ -1267,6 +1267,26 @@ build_element_name (struct sra_elt *elt)
return XOBFINISH (&sra_obstack, char *);
}
+/* Insert a gimple_seq SEQ on all the outgoing edges out of BB. Note that
+ if BB has more than one edge, STMT will be replicated for each edge.
+ Also, abnormal edges will be ignored. */
+
+static void
+insert_edge_copies_seq (gimple_seq seq, basic_block bb)
+{
+ edge e;
+ edge_iterator ei;
+ unsigned n_copies = -1;
+
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ if (!(e->flags & EDGE_ABNORMAL))
+ n_copies++;
+
+ FOR_EACH_EDGE (e, ei, bb->succs)
+ if (!(e->flags & EDGE_ABNORMAL))
+ gsi_insert_seq_on_edge (e, n_copies-- > 0 ? gimple_seq_copy (seq) : seq);
+}
+
/* Instantiate an element as an independent variable. */
static void
@@ -2789,29 +2809,9 @@ generate_element_init (struct sra_elt *elt, tree init, gimple_seq *seq_p)
return ret;
}
-/* Insert a gimple_seq SEQ on all the outgoing edges out of BB. Note that
- if BB has more than one edge, STMT will be replicated for each edge.
- Also, abnormal edges will be ignored. */
-
-void
-insert_edge_copies_seq (gimple_seq seq, basic_block bb)
-{
- edge e;
- edge_iterator ei;
- unsigned n_copies = -1;
-
- FOR_EACH_EDGE (e, ei, bb->succs)
- if (!(e->flags & EDGE_ABNORMAL))
- n_copies++;
-
- FOR_EACH_EDGE (e, ei, bb->succs)
- if (!(e->flags & EDGE_ABNORMAL))
- gsi_insert_seq_on_edge (e, n_copies-- > 0 ? gimple_seq_copy (seq) : seq);
-}
-
/* Helper function to insert LIST before GSI, and set up line number info. */
-void
+static void
sra_insert_before (gimple_stmt_iterator *gsi, gimple_seq seq)
{
gimple stmt = gsi_stmt (*gsi);
@@ -2823,7 +2823,7 @@ sra_insert_before (gimple_stmt_iterator *gsi, gimple_seq seq)
/* Similarly, but insert after GSI. Handles insertion onto edges as well. */
-void
+static void
sra_insert_after (gimple_stmt_iterator *gsi, gimple_seq seq)
{
gimple stmt = gsi_stmt (*gsi);
@@ -3601,7 +3601,7 @@ debug_sra_elt_name (struct sra_elt *elt)
fputc ('\n', stderr);
}
-void
+static void
sra_init_cache (void)
{
if (sra_type_decomp_cache)