[PATCH][GIMPLE FE] Revert some unnecesary changes, get a .gimple dump

Richard Biener rguenther@suse.de
Fri Oct 28 09:42:00 GMT 2016


Tested on x86_64-unknown-linux-gnu.

Richard.

2016-10-28  Richard Biener  <rguenther@suse.de>

	c/
	* gimple-parser.c: Include tree-dump.h.
	(c_parser_parse_gimple_body): Do not claim PROP_gimple_lcf
	or PROP_gimple_leh.  Dump to .gimple dump file.
	(c_parser_parse_ssa_name): Set DECL_GIMPLE_REG_P for vector
	and complex vars we create SSA names for.

	* gimplify.c (gimplify_function_tree): Revert unnecessary changes.
	* tree-cfg.c (dump_function_to_file): Adjust condition when to
	dump GIMPLE.

diff --git a/gcc/c/gimple-parser.c b/gcc/c/gimple-parser.c
index 392f6b0..7f8d948 100644
--- a/gcc/c/gimple-parser.c
+++ b/gcc/c/gimple-parser.c
@@ -54,6 +54,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-ssanames.h"
 #include "gimple-ssa.h"
 #include "tree-dfa.h"
+#include "tree-dump.h"
 
 
 /* Gimple parsing functions.  */
@@ -114,10 +115,11 @@ c_parser_parse_gimple_body (c_parser *parser)
   /* While we have SSA names in the IL we do not have a CFG built yet
      and PHIs are represented using a PHI internal function.  We do
      have lowered control flow and exception handling (well, we do not
-     have parser support for EH yet).  */
-  cfun->curr_properties = PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh;
+     have parser support for EH yet).  But as we still have BINDs
+     we have to go through lowering again.  */
+  cfun->curr_properties = PROP_gimple_any;
 
-  return;
+  dump_function (TDI_generic, current_function_decl);
 }
 
 /* Parse a compound statement in gimple function body.
@@ -696,6 +698,9 @@ c_parser_parse_ssa_name (c_parser *parser,
 	      c_parser_error (parser, "base variable or SSA name not declared"); 
 	      return error_mark_node;
 	    }
+	  if (VECTOR_TYPE_P (TREE_TYPE (parent))
+	      || TREE_CODE (TREE_TYPE (parent)) == COMPLEX_TYPE)
+	    DECL_GIMPLE_REG_P (parent) = 1;
 	  name = make_ssa_name_fn (cfun, parent,
 				   gimple_build_nop (), version);
 	}
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index efae537..5da1725 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -12337,22 +12337,7 @@ gimplify_function_tree (tree fndecl)
       && !needs_to_live_in_memory (ret))
     DECL_GIMPLE_REG_P (ret) = 1;
 
-  if (!cfun->gimple_body)
-    bind = gimplify_body (fndecl, true);
-  else
-    {
-      gimple_seq seq;
-      gimple *outer_stmt;
-      seq = cfun->gimple_body;
-      outer_stmt = gimple_seq_first_stmt (seq);
-      if (gimple_code (outer_stmt) == GIMPLE_BIND
-	  && gimple_seq_first (seq) == gimple_seq_last (seq))
-	bind = as_a <gbind *> (outer_stmt);
-      else
-	bind = gimple_build_bind (NULL_TREE, seq, NULL);
-
-      DECL_SAVED_TREE (fndecl) = NULL_TREE;
-    }
+  bind = gimplify_body (fndecl, true);
 
   /* The tree body of the function is no longer needed, replace it
      with the new GIMPLE body.  */
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 7d7763d..e99e102 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -7666,7 +7666,7 @@ dump_function_to_file (tree fndecl, FILE *file, int flags)
 
       fprintf (file, "}\n");
     }
-  else if (DECL_SAVED_TREE (fndecl) == NULL)
+  else if (fun->curr_properties & PROP_gimple_any)
     {
       /* The function is now in GIMPLE form but the CFG has not been
 	 built yet.  Emit the single sequence of GIMPLE statements



More information about the Gcc-patches mailing list