Re: [PATCH 85/89] Concretize gimple_assign_nontemporal_move_p

2014-05-12 Thread Jeff Law

On 04/21/14 10:57, David Malcolm wrote:

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.

OK when prereqs have gone in.
jeff



[PATCH 85/89] Concretize gimple_assign_nontemporal_move_p

2014-04-21 Thread David Malcolm
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/cfgexpand.c   | 18 ++
 gcc/gimple-streamer-out.c |  5 -
 gcc/gimple.h  |  3 +--
 3 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 983cec0..4447ca0 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -3189,7 +3189,8 @@ expand_gimple_stmt_1 (gimple stmt)
 
 case GIMPLE_ASSIGN:
   {
-   tree lhs = gimple_assign_lhs (stmt);
+   gimple_assign assign_stmt = stmt-as_a_gimple_assign ();
+   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
@@ -3199,7 +3200,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))
@@ -3210,12 +3211,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;
 
@@ -3223,18 +3225,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 b27d4de..22cc03a 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 (
+stmt-as_a_gimple_assign ()),
+  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 dd6dd38..d487629 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -2727,9 +2727,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;
 }
 
-- 
1.8.5.3