This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gimple-classes, committed 85/92] Use gimple_call in some places within tree-ssa-dom.c


This corresponds to:
  [PATCH 87/89] Use gimple_call in some places within tree-ssa-dom.c
  https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01173.html
from the original 89-patch kit

That earlier patch was approved by Jeff:
> OK when prereqs go in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00856.html

gcc/
	* tree-ssa-dom.c (struct hashable_expr): Strengthen field
	call.fn_from from gimple to gimple_call.
	(initialize_hash_element): Replace check against GIMPLE_CALL
	with dyn_cast<gimple_call> and update gimple_call_ uses to use
	new gimple_call local, along with fn_from initializer.
	(iterative_hash_hashable_expr): Strengthen type of local "fn_from"
	from gimple to gimple_call.
	(print_expr_hash_elt): Likewise.
---
 gcc/ChangeLog.gimple-classes | 13 +++++++++++++
 gcc/tree-ssa-dom.c           | 20 ++++++++++----------
 2 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index 9255151..030df86 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,18 @@
 2014-10-24  David Malcolm  <dmalcolm@redhat.com>
 
+	Use gimple_call in some places within tree-ssa-dom.c
+
+	* tree-ssa-dom.c (struct hashable_expr): Strengthen field
+	call.fn_from from gimple to gimple_call.
+	(initialize_hash_element): Replace check against GIMPLE_CALL
+	with dyn_cast<gimple_call> and update gimple_call_ uses to use
+	new gimple_call local, along with fn_from initializer.
+	(iterative_hash_hashable_expr): Strengthen type of local "fn_from"
+	from gimple to gimple_call.
+	(print_expr_hash_elt): Likewise.
+
+2014-10-24  David Malcolm  <dmalcolm@redhat.com>
+
 	Concretize gimple_call_copy_flags and ipa_modify_call_arguments
 
 	* gimple.h (gimple_call_copy_flags): Require gimple_calls.
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 47e45da..a49601c 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -81,7 +81,7 @@ struct hashable_expr
     struct { enum tree_code op;  tree opnd; } unary;
     struct { enum tree_code op;  tree opnd0, opnd1; } binary;
     struct { enum tree_code op;  tree opnd0, opnd1, opnd2; } ternary;
-    struct { gimple fn_from; bool pure; size_t nargs; tree *args; } call;
+    struct { gimple_call fn_from; bool pure; size_t nargs; tree *args; } call;
     struct { size_t nargs; tree *args; } phi;
   } ops;
 };
@@ -325,18 +325,18 @@ initialize_hash_element (gimple stmt, tree lhs,
       expr->ops.binary.opnd0 = gimple_cond_lhs (stmt);
       expr->ops.binary.opnd1 = gimple_cond_rhs (stmt);
     }
-  else if (code == GIMPLE_CALL)
+  else if (gimple_call call_stmt = dyn_cast <gimple_call> (stmt))
     {
-      size_t nargs = gimple_call_num_args (stmt);
+      size_t nargs = gimple_call_num_args (call_stmt);
       size_t i;
 
-      gcc_assert (gimple_call_lhs (stmt));
+      gcc_assert (gimple_call_lhs (call_stmt));
 
-      expr->type = TREE_TYPE (gimple_call_lhs (stmt));
+      expr->type = TREE_TYPE (gimple_call_lhs (call_stmt));
       expr->kind = EXPR_CALL;
-      expr->ops.call.fn_from = stmt;
+      expr->ops.call.fn_from = call_stmt;
 
-      if (gimple_call_flags (stmt) & (ECF_CONST | ECF_PURE))
+      if (gimple_call_flags (call_stmt) & (ECF_CONST | ECF_PURE))
         expr->ops.call.pure = true;
       else
         expr->ops.call.pure = false;
@@ -344,7 +344,7 @@ initialize_hash_element (gimple stmt, tree lhs,
       expr->ops.call.nargs = nargs;
       expr->ops.call.args = XCNEWVEC (tree, nargs);
       for (i = 0; i < nargs; i++)
-        expr->ops.call.args[i] = gimple_call_arg (stmt, i);
+        expr->ops.call.args[i] = gimple_call_arg (call_stmt, i);
     }
   else if (gimple_switch swtch_stmt = dyn_cast <gimple_switch> (stmt))
     {
@@ -635,7 +635,7 @@ add_hashable_expr (const struct hashable_expr *expr, hash &hstate)
       {
         size_t i;
         enum tree_code code = CALL_EXPR;
-        gimple fn_from;
+        gimple_call fn_from;
 
         hstate.add_object (code);
         fn_from = expr->ops.call.fn_from;
@@ -711,7 +711,7 @@ print_expr_hash_elt (FILE * stream, const struct expr_hash_elt *element)
         {
           size_t i;
           size_t nargs = element->expr.ops.call.nargs;
-          gimple fn_from;
+          gimple_call fn_from;
 
           fn_from = element->expr.ops.call.fn_from;
           if (gimple_call_internal_p (fn_from))
-- 
1.8.5.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]