This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gimple-classes, committed 67/92] Make gimple_cond_set_{true|false}_label require gimple_cond.
- From: David Malcolm <dmalcolm at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: David Malcolm <dmalcolm at redhat dot com>
- Date: Mon, 27 Oct 2014 16:41:05 -0400
- Subject: [gimple-classes, committed 67/92] Make gimple_cond_set_{true|false}_label require gimple_cond.
- Authentication-results: sourceware.org; auth=none
- References: <1414442490-14841-1-git-send-email-dmalcolm at redhat dot com>
This corresponds to:
[PATCH 69/89] Make gimple_cond_set_{true|false}_label require gimple_cond.
https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01198.html
from the original 89-patch kit
That earlier patch was approved by Jeff:
> OK once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00835.html
gcc/
* gimple.h (gimple_cond_set_true_label): Require a gimple_cond.
(gimple_cond_set_false_label): Likewise.
* tree-cfg.c (make_cond_expr_edges): Convert "entry" from gimple to
a gimple_cond.
(cleanup_dead_labels): Introduce a checked cast to a gimple_cond within
the GIMPLE_COND case.
---
gcc/ChangeLog.gimple-classes | 12 ++++++++++++
gcc/gimple.h | 6 ++----
gcc/tree-cfg.c | 33 ++++++++++++++++++---------------
3 files changed, 32 insertions(+), 19 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index c024a2b..2bfebca 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,17 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Make gimple_cond_set_{true|false}_label require gimple_cond.
+
+ * gimple.h (gimple_cond_set_true_label): Require a gimple_cond.
+ (gimple_cond_set_false_label): Likewise.
+
+ * tree-cfg.c (make_cond_expr_edges): Convert "entry" from gimple to
+ a gimple_cond.
+ (cleanup_dead_labels): Introduce a checked cast to a gimple_cond within
+ the GIMPLE_COND case.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Concretize three gimple_return_ accessors
* gimple.h (gimple_return_retval_ptr): Require a const_gimple_return
diff --git a/gcc/gimple.h b/gcc/gimple.h
index e1afe99..6a09975 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -3091,9 +3091,8 @@ gimple_cond_true_label (const_gimple gs)
predicate evaluates to true. */
static inline void
-gimple_cond_set_true_label (gimple gs, tree label)
+gimple_cond_set_true_label (gimple_cond gs, tree label)
{
- GIMPLE_CHECK (gs, GIMPLE_COND);
gimple_set_op (gs, 2, label);
}
@@ -3102,9 +3101,8 @@ gimple_cond_set_true_label (gimple gs, tree label)
predicate evaluates to false. */
static inline void
-gimple_cond_set_false_label (gimple gs, tree label)
+gimple_cond_set_false_label (gimple_cond gs, tree label)
{
- GIMPLE_CHECK (gs, GIMPLE_COND);
gimple_set_op (gs, 3, label);
}
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 4aaeb6d..4de42a8 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -1045,7 +1045,7 @@ assign_discriminators (void)
static void
make_cond_expr_edges (basic_block bb)
{
- gimple entry = last_stmt (bb);
+ gimple_cond entry = as_a <gimple_cond> (last_stmt (bb));
gimple then_stmt, else_stmt;
basic_block then_bb, else_bb;
tree then_label, else_label;
@@ -1414,21 +1414,24 @@ cleanup_dead_labels (void)
switch (gimple_code (stmt))
{
case GIMPLE_COND:
- label = gimple_cond_true_label (stmt);
- if (label)
- {
- new_label = main_block_label (label);
- if (new_label != label)
- gimple_cond_set_true_label (stmt, new_label);
- }
+ {
+ gimple_cond cond_stmt = as_a <gimple_cond> (stmt);
+ label = gimple_cond_true_label (cond_stmt);
+ if (label)
+ {
+ new_label = main_block_label (label);
+ if (new_label != label)
+ gimple_cond_set_true_label (cond_stmt, new_label);
+ }
- label = gimple_cond_false_label (stmt);
- if (label)
- {
- new_label = main_block_label (label);
- if (new_label != label)
- gimple_cond_set_false_label (stmt, new_label);
- }
+ label = gimple_cond_false_label (cond_stmt);
+ if (label)
+ {
+ new_label = main_block_label (label);
+ if (new_label != label)
+ gimple_cond_set_false_label (cond_stmt, new_label);
+ }
+ }
break;
case GIMPLE_SWITCH:
--
1.8.5.3