diff mbox

[gimple-classes,committed,83/92] Concretize gimple_assign_nontemporal_move_p

Message ID 1414442490-14841-84-git-send-email-dmalcolm@redhat.com
State New
Headers show

Commit Message

David Malcolm Oct. 27, 2014, 8:41 p.m. UTC
This corresponds to:
  [PATCH 85/89] Concretize gimple_assign_nontemporal_move_p
  https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01202.html
from the original 89-patch kit

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

gcc/
	* gimple.h (gimple_assign_nontemporal_move_p): Require a
	const_gimple_assign rather than a const_gimple.

	* cfgexpand.c (expand_gimple_stmt_1): Add local assign_stmt and
	checked cast within "case GIMPLE_ASSIGN".

	* gimple-streamer-out.c (output_gimple_stmt): Add checked cast to
	gimple_assign.
---
 gcc/ChangeLog.gimple-classes | 13 +++++++++++++
 gcc/cfgexpand.c              | 18 ++++++++++--------
 gcc/gimple-streamer-out.c    |  5 ++++-
 gcc/gimple.h                 |  3 +--
 4 files changed, 28 insertions(+), 11 deletions(-)
diff mbox

Patch

diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index e064bcf..572fe5a 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,18 @@ 
 2014-10-24  David Malcolm  <dmalcolm@redhat.com>
 
+	Concretize gimple_assign_nontemporal_move_p
+
+	* gimple.h (gimple_assign_nontemporal_move_p): Require a
+	const_gimple_assign rather than a const_gimple.
+
+	* cfgexpand.c (expand_gimple_stmt_1): Add local assign_stmt and
+	checked cast within "case GIMPLE_ASSIGN".
+
+	* gimple-streamer-out.c (output_gimple_stmt): Add checked cast to
+	gimple_assign.
+
+2014-10-24  David Malcolm  <dmalcolm@redhat.com>
+
 	Concretize gimple_call_arg_flags
 
 	* gimple.h (gimple_call_arg_flags): Require a const_gimple_call
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 65de5b2..88bcd72 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -3251,7 +3251,8 @@  expand_gimple_stmt_1 (gimple stmt)
 
     case GIMPLE_ASSIGN:
       {
-	tree lhs = gimple_assign_lhs (stmt);
+	gimple_assign assign_stmt = as_a <gimple_assign> (stmt);
+	tree lhs = gimple_assign_lhs (assign_stmt);
 
 	/* Tree expand used to fiddle with |= and &= of two bitfield
 	   COMPONENT_REFs here.  This can't happen with gimple, the LHS
@@ -3261,7 +3262,7 @@  expand_gimple_stmt_1 (gimple stmt)
 	    || get_gimple_rhs_class (gimple_expr_code (stmt))
 	       == GIMPLE_SINGLE_RHS)
 	  {
-	    tree rhs = gimple_assign_rhs1 (stmt);
+	    tree rhs = gimple_assign_rhs1 (assign_stmt);
 	    gcc_assert (get_gimple_rhs_class (gimple_expr_code (stmt))
 			== GIMPLE_SINGLE_RHS);
 	    if (gimple_has_location (stmt) && CAN_HAVE_LOCATION_P (rhs))
@@ -3272,12 +3273,13 @@  expand_gimple_stmt_1 (gimple stmt)
 	      ;
 	    else
 	      expand_assignment (lhs, rhs,
-				 gimple_assign_nontemporal_move_p (stmt));
+				 gimple_assign_nontemporal_move_p (
+				   assign_stmt));
 	  }
 	else
 	  {
 	    rtx target, temp;
-	    bool nontemporal = gimple_assign_nontemporal_move_p (stmt);
+	    bool nontemporal = gimple_assign_nontemporal_move_p (assign_stmt);
 	    struct separate_ops ops;
 	    bool promoted = false;
 
@@ -3285,18 +3287,18 @@  expand_gimple_stmt_1 (gimple stmt)
 	    if (GET_CODE (target) == SUBREG && SUBREG_PROMOTED_VAR_P (target))
 	      promoted = true;
 
-	    ops.code = gimple_assign_rhs_code (stmt);
+	    ops.code = gimple_assign_rhs_code (assign_stmt);
 	    ops.type = TREE_TYPE (lhs);
 	    switch (get_gimple_rhs_class (gimple_expr_code (stmt)))
 	      {
 		case GIMPLE_TERNARY_RHS:
-		  ops.op2 = gimple_assign_rhs3 (stmt);
+		  ops.op2 = gimple_assign_rhs3 (assign_stmt);
 		  /* Fallthru */
 		case GIMPLE_BINARY_RHS:
-		  ops.op1 = gimple_assign_rhs2 (stmt);
+		  ops.op1 = gimple_assign_rhs2 (assign_stmt);
 		  /* Fallthru */
 		case GIMPLE_UNARY_RHS:
-		  ops.op0 = gimple_assign_rhs1 (stmt);
+		  ops.op0 = gimple_assign_rhs1 (assign_stmt);
 		  break;
 		default:
 		  gcc_unreachable ();
diff --git a/gcc/gimple-streamer-out.c b/gcc/gimple-streamer-out.c
index 71def75..e429b31 100644
--- a/gcc/gimple-streamer-out.c
+++ b/gcc/gimple-streamer-out.c
@@ -80,7 +80,10 @@  output_gimple_stmt (struct output_block *ob, gimple stmt)
   bp_pack_var_len_unsigned (&bp, gimple_num_ops (stmt));
   bp_pack_value (&bp, gimple_no_warning_p (stmt), 1);
   if (is_gimple_assign (stmt))
-    bp_pack_value (&bp, gimple_assign_nontemporal_move_p (stmt), 1);
+    bp_pack_value (&bp,
+		   gimple_assign_nontemporal_move_p (
+		     as_a <gimple_assign> (stmt)),
+		   1);
   bp_pack_value (&bp, gimple_has_volatile_ops (stmt), 1);
   hist = gimple_histogram_value (cfun, stmt);
   bp_pack_value (&bp, hist != NULL, 1);
diff --git a/gcc/gimple.h b/gcc/gimple.h
index a396ec3..5570c54 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -2426,9 +2426,8 @@  gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code,
 /* Returns true if GS is a nontemporal move.  */
 
 static inline bool
-gimple_assign_nontemporal_move_p (const_gimple gs)
+gimple_assign_nontemporal_move_p (const_gimple_assign gs)
 {
-  GIMPLE_CHECK (gs, GIMPLE_ASSIGN);
   return gs->nontemporal_move;
 }