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 80/92] Concretize gimple_call_set_fntype


This corresponds to:
  [PATCH 82/89] Concretize gimple_call_set_fntype
  https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01187.html
from the original 89-patch kit

That earlier patch was approved by Jeff:
> This is fine once prerequisites have gone in.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00840.html

gcc/
	* gimple-fold.c (gimple_fold_builtin_sprintf_chk): Strengthen
	local "stmt" from gimple to gimple_call.

	* gimple.h (gimple_call_set_fntype): Require a gimple_call.

	* omp-low.c (lower_omp_1): Add a new local gimple_call "call_stmt",
	from a checked cast to gimple_call within the "case GIMPLE_CALL",
	for the regions where "stmt" is not subsequently overwritten.
---
 gcc/ChangeLog.gimple-classes | 13 +++++++++++++
 gcc/gimple-fold.c            |  2 +-
 gcc/gimple.h                 |  7 +++----
 gcc/omp-low.c                | 12 +++++++-----
 4 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index ae57d57..f0737b9 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_call_set_fntype
+
+	* gimple-fold.c (gimple_fold_builtin_sprintf_chk): Strengthen
+	local "stmt" from gimple to gimple_call.
+
+	* gimple.h (gimple_call_set_fntype): Require a gimple_call.
+
+	* omp-low.c (lower_omp_1): Add a new local gimple_call "call_stmt",
+	from a checked cast to gimple_call within the "case GIMPLE_CALL",
+	for the regions where "stmt" is not subsequently overwritten.
+
+2014-10-24  David Malcolm  <dmalcolm@redhat.com>
+
 	Concretize gimple_call_set_fn
 
 	* gimple.h (gimple_call_set_fn): Require a gimple_call.
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index c6ba019..20bdc7d 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -2050,7 +2050,7 @@ static bool
 gimple_fold_builtin_sprintf_chk (gimple_stmt_iterator *gsi,
 				 enum built_in_function fcode)
 {
-  gimple stmt = gsi_stmt (*gsi);
+  gimple_call stmt = as_a <gimple_call> (gsi_stmt (*gsi));
   tree dest, size, len, fn, fmt, flag;
   const char *fmt_str;
   unsigned nargs = gimple_call_num_args (stmt);
diff --git a/gcc/gimple.h b/gcc/gimple.h
index a7ec1d5..d37c441 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -2644,13 +2644,12 @@ gimple_call_fntype (const_gimple gs)
   return call_stmt->u.fntype;
 }
 
-/* Set the type of the function called by GS to FNTYPE.  */
+/* Set the type of the function called by CALL_STMT to FNTYPE.  */
 
 static inline void
-gimple_call_set_fntype (gimple gs, tree fntype)
+gimple_call_set_fntype (gimple_call call_stmt, tree fntype)
 {
-  gimple_statement_call *call_stmt = as_a <gimple_statement_call *> (gs);
-  gcc_gimple_checking_assert (!gimple_call_internal_p (gs));
+  gcc_gimple_checking_assert (!gimple_call_internal_p (call_stmt));
   call_stmt->u.fntype = fntype;
 }
 
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index cd0869f..993206f 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -10455,6 +10455,7 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context *ctx)
 {
   gimple stmt = gsi_stmt (*gsi_p);
   struct walk_stmt_info wi;
+  gimple_call call_stmt;
 
   if (gimple_has_location (stmt))
     input_location = gimple_location (stmt);
@@ -10570,7 +10571,8 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context *ctx)
       break;
     case GIMPLE_CALL:
       tree fndecl;
-      fndecl = gimple_call_fndecl (stmt);
+      call_stmt = as_a <gimple_call> (stmt);
+      fndecl = gimple_call_fndecl (call_stmt);
       if (fndecl
 	  && DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL)
 	switch (DECL_FUNCTION_CODE (fndecl))
@@ -10585,7 +10587,7 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context *ctx)
 	    cctx = ctx;
 	    if (gimple_code (cctx->stmt) == GIMPLE_OMP_SECTION)
 	      cctx = cctx->outer;
-	    gcc_assert (gimple_call_lhs (stmt) == NULL_TREE);
+	    gcc_assert (gimple_call_lhs (call_stmt) == NULL_TREE);
 	    if (!cctx->cancellable)
 	      {
 		if (DECL_FUNCTION_CODE (fndecl)
@@ -10599,12 +10601,12 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context *ctx)
 	    if (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_GOMP_BARRIER)
 	      {
 		fndecl = builtin_decl_explicit (BUILT_IN_GOMP_BARRIER_CANCEL);
-		gimple_call_set_fndecl (stmt, fndecl);
-		gimple_call_set_fntype (stmt, TREE_TYPE (fndecl));
+		gimple_call_set_fndecl (call_stmt, fndecl);
+		gimple_call_set_fntype (call_stmt, TREE_TYPE (fndecl));
 	      }
 	    tree lhs;
 	    lhs = create_tmp_var (TREE_TYPE (TREE_TYPE (fndecl)), NULL);
-	    gimple_call_set_lhs (stmt, lhs);
+	    gimple_call_set_lhs (call_stmt, lhs);
 	    tree fallthru_label;
 	    fallthru_label = create_artificial_label (UNKNOWN_LOCATION);
 	    gimple g;
-- 
1.8.5.3


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