aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2015-04-27 10:29:07 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2015-04-27 10:29:07 +0000
commit232f1f97ad3ed549374769697eda3e872aab95f3 (patch)
treea2c95407a69e695e95bc79c88324215c682d8408 /gcc
parente5115cf9bcfb46f6cc0df6486fee510cbf246640 (diff)
downloadgcc-232f1f97ad3ed549374769697eda3e872aab95f3.zip
gcc-232f1f97ad3ed549374769697eda3e872aab95f3.tar.gz
gcc-232f1f97ad3ed549374769697eda3e872aab95f3.tar.bz2
stor-layout.c (self_referential_component_ref_p): New predicate.
* stor-layout.c (self_referential_component_ref_p): New predicate. (copy_self_referential_tree_r): Use it. (self_referential_size): Punt for simple operations directly involving self-referential component references. * tree-cfg.c (dump_function_to_file): Add missing final curly bracket. From-SVN: r222456
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/stor-layout.c31
-rw-r--r--gcc/tree-cfg.c6
3 files changed, 31 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1908e46..3688fb4 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
2015-04-27 Eric Botcazou <ebotcazou@adacore.com>
+ * stor-layout.c (self_referential_component_ref_p): New predicate.
+ (copy_self_referential_tree_r): Use it.
+ (self_referential_size): Punt for simple operations directly involving
+ self-referential component references.
+ * tree-cfg.c (dump_function_to_file): Add missing final curly bracket.
+
+2015-04-27 Eric Botcazou <ebotcazou@adacore.com>
+
* ipa-icf.c (icf_handled_component_p): Remove redundant tests.
2015-04-27 Richard Sandiford <richard.sandiford@arm.com>
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index f18f1ac..54bbde6 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -127,6 +127,20 @@ variable_size (tree size)
/* An array of functions used for self-referential size computation. */
static GTY(()) vec<tree, va_gc> *size_functions;
+/* Return true if T is a self-referential component reference. */
+
+static bool
+self_referential_component_ref_p (tree t)
+{
+ if (TREE_CODE (t) != COMPONENT_REF)
+ return false;
+
+ while (REFERENCE_CLASS_P (t))
+ t = TREE_OPERAND (t, 0);
+
+ return (TREE_CODE (t) == PLACEHOLDER_EXPR);
+}
+
/* Similar to copy_tree_r but do not copy component references involving
PLACEHOLDER_EXPRs. These nodes are spotted in find_placeholder_in_expr
and substituted in substitute_in_expr. */
@@ -154,19 +168,10 @@ copy_self_referential_tree_r (tree *tp, int *walk_subtrees, void *data)
}
/* Default case: the component reference. */
- else if (code == COMPONENT_REF)
+ else if (self_referential_component_ref_p (*tp))
{
- tree inner;
- for (inner = TREE_OPERAND (*tp, 0);
- REFERENCE_CLASS_P (inner);
- inner = TREE_OPERAND (inner, 0))
- ;
-
- if (TREE_CODE (inner) == PLACEHOLDER_EXPR)
- {
- *walk_subtrees = 0;
- return NULL_TREE;
- }
+ *walk_subtrees = 0;
+ return NULL_TREE;
}
/* We're not supposed to have them in self-referential size trees
@@ -199,7 +204,7 @@ self_referential_size (tree size)
/* Do not factor out simple operations. */
t = skip_simple_constant_arithmetic (size);
- if (TREE_CODE (t) == CALL_EXPR)
+ if (TREE_CODE (t) == CALL_EXPR || self_referential_component_ref_p (t))
return size;
/* Collect the list of self-references in the expression. */
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 988ab2a..99b27c7 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -7441,7 +7441,11 @@ dump_function_to_file (tree fndecl, FILE *file, int flags)
else
{
if (!ignore_topmost_bind)
- fprintf (file, "{\n");
+ {
+ fprintf (file, "{\n");
+ /* No topmost bind, pretend it's ignored for later. */
+ ignore_topmost_bind = true;
+ }
indent = 2;
}