[gimple-classes, committed 05/44] More gcall *
David Malcolm
dmalcolm@redhat.com
Thu Nov 6 14:37:00 GMT 2014
gcc/ChangeLog.gimple-classes:
* gimple.c (gimple_set_lhs): Add checked casts to gassign * and
gcall * as appropriate.
* tree-cfg.c (execute_fixup_cfg): Introduce local "call_stmt"
via a dyn_cast and use it in place of "stmt" where appropriate
* tree-cfgcleanup.c (split_bb_on_noreturn_calls): Strengthen
local "stmt" from gimple to gcall *, replacing an is_gimple_call
with a dyn_cast.
* tree-cfgcleanup.h (fixup_noreturn_call): Strengthen param from
gimple to gcall *.
* tree-ssa-dce.c (eliminate_unnecessary_stmts): Replace
is_gimple_call with a dyn_cast, introducing local "call_stmt" and
using it in place of "stmt" for typesafety.
* tree-ssa-propagate.c (finish_update_gimple_call): Strengthen
params "new_stmt" and "stmt" from gimple to gcall *.
---
gcc/ChangeLog.gimple-classes | 17 +++++++++++++++++
gcc/gimple.c | 4 ++--
gcc/tree-cfg.c | 9 +++++----
gcc/tree-cfgcleanup.c | 4 ++--
gcc/tree-cfgcleanup.h | 2 +-
gcc/tree-ssa-dce.c | 10 +++++-----
gcc/tree-ssa-propagate.c | 4 ++--
7 files changed, 34 insertions(+), 16 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index e2fb3d2..33bd5bf 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,22 @@
2014-10-31 David Malcolm <dmalcolm@redhat.com>
+ * gimple.c (gimple_set_lhs): Add checked casts to gassign * and
+ gcall * as appropriate.
+ * tree-cfg.c (execute_fixup_cfg): Introduce local "call_stmt"
+ via a dyn_cast and use it in place of "stmt" where appropriate
+ * tree-cfgcleanup.c (split_bb_on_noreturn_calls): Strengthen
+ local "stmt" from gimple to gcall *, replacing an is_gimple_call
+ with a dyn_cast.
+ * tree-cfgcleanup.h (fixup_noreturn_call): Strengthen param from
+ gimple to gcall *.
+ * tree-ssa-dce.c (eliminate_unnecessary_stmts): Replace
+ is_gimple_call with a dyn_cast, introducing local "call_stmt" and
+ using it in place of "stmt" for typesafety.
+ * tree-ssa-propagate.c (finish_update_gimple_call): Strengthen
+ params "new_stmt" and "stmt" from gimple to gcall *.
+
+2014-10-31 David Malcolm <dmalcolm@redhat.com>
+
* config/i386/i386.c (add_condition_to_bb): Strengthen local
"call_cond_stmt" from gimple to gcall *.
* gimple-fold.c (gimple_build): Likewise for local "stmt".
diff --git a/gcc/gimple.c b/gcc/gimple.c
index b58c9db..d86ca49 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -1640,9 +1640,9 @@ gimple_set_lhs (gimple stmt, tree lhs)
enum gimple_code code = gimple_code (stmt);
if (code == GIMPLE_ASSIGN)
- gimple_assign_set_lhs (stmt, lhs);
+ gimple_assign_set_lhs (as_a <gassign *> (stmt), lhs);
else if (code == GIMPLE_CALL)
- gimple_call_set_lhs (stmt, lhs);
+ gimple_call_set_lhs (as_a <gcall *> (stmt), lhs);
else
gcc_unreachable ();
}
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 1d1aaef..1ec250b 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -8555,12 +8555,13 @@ execute_fixup_cfg (void)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);)
{
gimple stmt = gsi_stmt (gsi);
- tree decl = is_gimple_call (stmt)
- ? gimple_call_fndecl (stmt)
+ gcall *call_stmt = dyn_cast <gcall *> (stmt);
+ tree decl = call_stmt
+ ? gimple_call_fndecl (call_stmt)
: NULL;
if (decl)
{
- int flags = gimple_call_flags (stmt);
+ int flags = gimple_call_flags (call_stmt);
if (flags & (ECF_CONST | ECF_PURE | ECF_LOOPING_CONST_OR_PURE))
{
if (gimple_purge_dead_abnormal_call_edges (bb))
@@ -8574,7 +8575,7 @@ execute_fixup_cfg (void)
}
if (flags & ECF_NORETURN
- && fixup_noreturn_call (stmt))
+ && fixup_noreturn_call (call_stmt))
todo |= TODO_cleanup_cfg;
}
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index 7383924..fc9f2af 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -645,9 +645,9 @@ split_bb_on_noreturn_calls (basic_block bb)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
- gimple stmt = gsi_stmt (gsi);
+ gcall *stmt = dyn_cast <gcall *> (gsi_stmt (gsi));
- if (!is_gimple_call (stmt))
+ if (!stmt)
continue;
if (gimple_call_noreturn_p (stmt))
diff --git a/gcc/tree-cfgcleanup.h b/gcc/tree-cfgcleanup.h
index 19ff170..9538ddd 100644
--- a/gcc/tree-cfgcleanup.h
+++ b/gcc/tree-cfgcleanup.h
@@ -23,6 +23,6 @@ along with GCC; see the file COPYING3. If not see
/* In tree-cfgcleanup.c */
extern bitmap cfgcleanup_altered_bbs;
extern bool cleanup_tree_cfg (void);
-extern bool fixup_noreturn_call (gimple stmt);
+extern bool fixup_noreturn_call (gcall *stmt);
#endif /* GCC_TREE_CFGCLEANUP_H */
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index 06ffb24..20a4e40 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -1229,11 +1229,11 @@ eliminate_unnecessary_stmts (void)
something_changed = true;
remove_dead_stmt (&gsi, bb);
}
- else if (is_gimple_call (stmt))
+ else if (gcall *call_stmt = dyn_cast <gcall *> (stmt))
{
- tree name = gimple_call_lhs (stmt);
+ tree name = gimple_call_lhs (call_stmt);
- notice_special_calls (as_a <gcall *> (stmt));
+ notice_special_calls (call_stmt);
/* When LHS of var = call (); is dead, simplify it into
call (); saving one operand. */
@@ -1243,7 +1243,7 @@ eliminate_unnecessary_stmts (void)
/* Avoid doing so for allocation calls which we
did not mark as necessary, it will confuse the
special logic we apply to malloc/free pair removal. */
- && (!(call = gimple_call_fndecl (stmt))
+ && (!(call = gimple_call_fndecl (call_stmt))
|| DECL_BUILT_IN_CLASS (call) != BUILT_IN_NORMAL
|| (DECL_FUNCTION_CODE (call) != BUILT_IN_ALIGNED_ALLOC
&& DECL_FUNCTION_CODE (call) != BUILT_IN_MALLOC
@@ -1260,7 +1260,7 @@ eliminate_unnecessary_stmts (void)
fprintf (dump_file, "\n");
}
- gimple_call_set_lhs (stmt, NULL_TREE);
+ gimple_call_set_lhs (call_stmt, NULL_TREE);
maybe_clean_or_replace_eh_stmt (stmt, stmt);
update_stmt (stmt);
release_ssa_name (name);
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index 6625000..478e8b9 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -727,8 +727,8 @@ move_ssa_defining_stmt_for_defs (gimple new_stmt, gimple old_stmt)
A GIMPLE_CALL STMT is being replaced with GIMPLE_CALL NEW_STMT. */
static void
-finish_update_gimple_call (gimple_stmt_iterator *si_p, gimple new_stmt,
- gimple stmt)
+finish_update_gimple_call (gimple_stmt_iterator *si_p, gcall *new_stmt,
+ gcall *stmt)
{
gimple_call_set_lhs (new_stmt, gimple_call_lhs (stmt));
move_ssa_defining_stmt_for_defs (new_stmt, stmt);
--
1.7.11.7
More information about the Gcc-patches
mailing list