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]

[tuples] Save gimplified bodies for each function


This patch adds support to save the GIMPLE sequence generated by the
gimplifier for each function.  Since this sequence will be very
short-lived (it disappears after the CFG is built), it does not make
sense to store it in CFUN or the FNDECL.  So, the bodies are stored in a
private pointer map indexed by FNDECL.

This change allows us to use the regular function dumping logic and we
now have a better method to determine if a function is in GIMPLE form.
If DECL_SAVED_TREE has been nullified, we can use gimple_body().

The patch also introduces -fgimple-only, which should simplify the
initial implementation.  If this flag is given, the compiler exits
immediately after gimplification.  Completely useless in general, but it
will make our lives easier for now.

Tested on gimple.exp.  Committed to branch.
2007-07-12  Diego Novillo  <dnovillo@google.com>

	* tree.c (create_artificial_label): Move from gimplify.c
	(get_name): Likewise.
	* tree.h (create_artificial_label, get_name): Move
	declarations earlier in the file.
	* diagnostic.h (dump_gimple_stmt, print_gimple_stmt,
	dump_gimple_seq): Rearrange.
	* tree-gimple.h (gimplify_function_tree): Move from tree.h.
	* gimple-pretty-print.c (do_niy): Tidy.
	(maybe_init_pretty_print): Add comment.
	(newline_and_indent): Likewise.
	Remove "gimpleir: " prefix.
	(debug_gimple_stmt): Add comment.
	(dump_gs_seq): Remove.
	(dump_gimple_seq): Add argument SPC.
	Update all users.
	If FLAGS contains TDF_DETAILS, emit "gimpleir:" prefix.
	(dump_gs_cond): If FLAGS contains TDF_DETAILS, emit
	"gimpleir:" prefix.
	(dump_gs_bind): Likewise.
	* function.h (struct function): Remove field 'gimplified'.
	* gimple-ir.c (gimple_bodies): New private variable.
	(set_gimple_body): New.
	(gimple_body): New.
	* gimple-ir.h: Include pointer-set.h.
	Add comment before data structure definitons.
	(set_gimple_body): Declare.
	(gimple_body): Declare.
	* gimplify.c (create_artificial_label): Move to tree.c
	(get_name): Likewise.
	(gimplify_function_tree): Change return type to void.
	Call set_gimple_body after gimplification and nullify
	DECL_SAVED_TREE.
	Update all callers.
	* common.opt (fgimple-only): New option.
	* tree-optimize.c (tree_rest_of_compilation): Do not nullify
	DECL_SAVED_TREE.
	* c-gimplify.c (c_genericize): Restore gimplification logic to
	mainline version.
	If -fgimple-only was given, exit.
	* Makefile.in (GIMPLE_IR_H): Add pointer-set.h
	* tree-cfg.c (execute_build_cfg): Nullify GIMPLE body after
	building the CFG.
	(dump_function_to_file): If DECL_SAVED_TREE is NULL dump the
	GIMPLE body of the function.


testsuite/ChangeLog.tuples

	* gcc.dg/gimple/gimple.exp (load_lib): Add -fgimple-only to
	DEFAULT_CFLAGS.

Index: tree.c
===================================================================
--- tree.c	(revision 126601)
+++ tree.c	(working copy)
@@ -8380,4 +8380,44 @@ call_expr_arglist (tree exp)
   return arglist;
 }
 
+
+/* Create a nameless artificial label and put it in the current function
+   context.  Returns the newly created label.  */
+
+tree
+create_artificial_label (void)
+{
+  tree lab = build_decl (LABEL_DECL, NULL_TREE, void_type_node);
+
+  DECL_ARTIFICIAL (lab) = 1;
+  DECL_IGNORED_P (lab) = 1;
+  DECL_CONTEXT (lab) = current_function_decl;
+  return lab;
+}
+
+/*  Given a tree, try to return a useful variable name that we can use
+    to prefix a temporary that is being assigned the value of the tree.
+    I.E. given  <temp> = &A, return A.  */
+
+const char *
+get_name (tree t)
+{
+  tree stripped_decl;
+
+  stripped_decl = t;
+  STRIP_NOPS (stripped_decl);
+  if (DECL_P (stripped_decl) && DECL_NAME (stripped_decl))
+    return IDENTIFIER_POINTER (DECL_NAME (stripped_decl));
+  else
+    {
+      switch (TREE_CODE (stripped_decl))
+	{
+	case ADDR_EXPR:
+	  return get_name (TREE_OPERAND (stripped_decl, 0));
+	default:
+	  return NULL;
+	}
+    }
+}
+
 #include "gt-tree.h"
Index: tree.h
===================================================================
--- tree.h	(revision 126601)
+++ tree.h	(working copy)
@@ -4368,6 +4368,11 @@ extern bool empty_body_p (tree);
 extern tree call_expr_arg (tree, int);
 extern tree *call_expr_argp (tree, int);
 extern tree call_expr_arglist (tree);
+extern tree create_artificial_label (void);
+extern const char *get_name (tree);
+
+/* In gimplify.c */
+extern tree unshare_expr (tree);
 
 /* In stmt.c */
 
@@ -4735,11 +4740,6 @@ extern void expand_anon_union_decl (tree
 extern tree tree_overlaps_hard_reg_set (tree, HARD_REG_SET *);
 #endif
 
-/* In gimplify.c.  */
-extern tree create_artificial_label (void);
-extern struct gs_sequence gimplify_function_tree (tree);
-extern const char *get_name (tree);
-extern tree unshare_expr (tree);
 
 /* Interface of the DWARF2 unwind info support.  */
 
Index: diagnostic.h
===================================================================
--- diagnostic.h	(revision 126601)
+++ diagnostic.h	(working copy)
@@ -210,10 +210,8 @@ extern char *file_name_as_prefix (const 
 /* In tree-pretty-print.c  */
 extern void print_declaration (pretty_printer *, tree, int, int);
 extern int dump_generic_node (pretty_printer *, tree, int, int, bool);
-extern void dump_gimple_stmt (pretty_printer *, gimple, int, int);
 extern void print_generic_stmt (FILE *, tree, int);
 extern void print_generic_stmt_indented (FILE *, tree, int, int);
-extern void print_gimple_stmt (FILE *, gimple, int);
 extern void print_generic_expr (FILE *, tree, int);
 extern void print_generic_decl (FILE *, tree, int);
 extern void debug_c_tree (tree);
@@ -224,6 +222,8 @@ extern void debug_generic_stmt (tree);
 extern void debug_tree_chain (tree);
 extern void debug_gimple_stmt (gimple);
 extern void debug_gimple_seq (gs_seq);
-extern void dump_gimple_seq (FILE *, gs_seq);
+extern void print_gimple_seq (FILE *, gs_seq, int, int);
+extern void print_gimple_stmt (FILE *, gimple, int, int);
+extern void dump_gimple_stmt (pretty_printer *, gimple, int, int);
 
 #endif /* ! GCC_DIAGNOSTIC_H */
Index: tree-gimple.h
===================================================================
--- tree-gimple.h	(revision 126602)
+++ tree-gimple.h	(working copy)
@@ -150,6 +150,9 @@ extern tree omp_reduction_init (tree, tr
 extern void lower_nested_functions (tree);
 extern void insert_field_into_struct (tree, tree);
 
+/* In gimplify.c.  */
+extern void gimplify_function_tree (tree);
+
 /* Convenience routines to walk all statements of a gimple function.
    The difference between these walkers and the generic walk_tree is
    that walk_stmt provides context information to the callback
Index: testsuite/gcc.dg/gimple/gimple.exp
===================================================================
--- testsuite/gcc.dg/gimple/gimple.exp	(revision 126601)
+++ testsuite/gcc.dg/gimple/gimple.exp	(working copy)
@@ -21,7 +21,7 @@ load_lib gcc-dg.exp
 # If a testcase doesn't have special options, use these.
 global DEFAULT_CFLAGS
 if ![info exists DEFAULT_CFLAGS] then {
-    set DEFAULT_CFLAGS "-O2 -fdump-tree-gimple-details"
+    set DEFAULT_CFLAGS "-O0 -fgimple-only -fdump-tree-gimple-details"
 }
 
 # Initialize `dg'.
Index: gimple-pretty-print.c
===================================================================
--- gimple-pretty-print.c	(revision 126601)
+++ gimple-pretty-print.c	(working copy)
@@ -48,11 +48,13 @@ static bool initialized = false;
 static void
 do_niy (pretty_printer *buffer, gimple gs)
 {
-  pp_printf (buffer, "<<< Unknown gimple statement: %s >>>\n",
+  pp_printf (buffer, "<<< Unknown GIMPLE statement: %s >>>\n",
 	     gs_code_name[(int) GS_CODE (gs)]);
 }
 
 
+/* Initialize the pretty printer on FILE if needed.  */
+
 static void
 maybe_init_pretty_print (FILE *file)
 {
@@ -67,76 +69,74 @@ maybe_init_pretty_print (FILE *file)
 }
 
 
+/* Emit a newline and SPC indentantion spaces to BUFFER.  */
+
 static void
 newline_and_indent (pretty_printer *buffer, int spc)
 {
   pp_newline (buffer);
-  pp_string (buffer, "gimpleir: ");
   INDENT (spc);
 }
 
 
+/* Print the GIMPLE statement GS on stderr.  */
+
 void
 debug_gimple_stmt (gimple gs)
 {
-  print_gimple_stmt (stderr, gs, TDF_VOPS|TDF_MEMSYMS);
+  print_gimple_stmt (stderr, gs, 0, TDF_VOPS|TDF_MEMSYMS);
   fprintf (stderr, "\n");
 }
 
 
+/* Dump GIMPLE statement G to FILE using SPC indentantion spaces and
+   FLAGS as in dump_gimple_stmt.  */
+
 void
-debug_gimple_seq (gs_seq seq)
+print_gimple_stmt (FILE *file, gimple g, int spc, int flags)
 {
-  gimple_stmt_iterator i;
-
-  for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
-    {
-      gimple gs = gsi_stmt (i);
-      print_gimple_stmt (stderr, gs, TDF_VOPS|TDF_MEMSYMS);
-    }
+  maybe_init_pretty_print (file);
+  dump_gimple_stmt (&buffer, g, spc, flags);
+  pp_flush (&buffer);
 }
 
 
-/* Dump a sequence to a BUFFER.  */
+/* Print the GIMPLE sequence SEQ on BUFFER using SPC indentantion
+   spaces and FLAGS as in dump_gimple_stmt.  */
 
 static void
-dump_gs_seq (pretty_printer *buffer, gs_seq seq, int spc, int flags)
+dump_gimple_seq (pretty_printer *buffer, gs_seq seq, int spc, int flags)
 {
   gimple_stmt_iterator i;
 
   for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
     {
       gimple gs = gsi_stmt (i);
-      pp_string (buffer, "gimpleir: ");
+      if (flags & TDF_DETAILS)
+	pp_string (buffer, "gimpleir: ");
       dump_gimple_stmt (buffer, gs, spc, flags);
     }
 }
 
 
-/* Dump a sequence to a FILE *.  */
+/* Dump GIMPLE sequence SEQ to FILE using SPC indentantion spaces and
+   FLAGS as in dump_gimple_stmt.  */
 
 void
-dump_gimple_seq (FILE *file, gs_seq seq)
+print_gimple_seq (FILE *file, gs_seq seq, int spc, int flags)
 {
-  gimple_stmt_iterator i;
-
-  for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
-    {
-      gimple gs = gsi_stmt (i);
-      fprintf (file, "gimpleir: ");
-      print_gimple_stmt (file, gs, TDF_VOPS|TDF_MEMSYMS);
-    }
+  maybe_init_pretty_print (file);
+  dump_gimple_seq (&buffer, seq, spc, flags);
+  pp_flush (&buffer);
 }
 
 
-/* Same, but for gimple statements.  */
+/* Print the GIMPLE sequence SEQ on stderr.  */
 
 void
-print_gimple_stmt (FILE *file, gimple g, int flags)
+debug_gimple_seq (gs_seq seq)
 {
-  maybe_init_pretty_print (file);
-  dump_gimple_stmt (&buffer, g, 0, flags);
-  pp_flush (&buffer);
+  print_gimple_seq (stderr, seq, 0, TDF_VOPS|TDF_MEMSYMS);
 }
 
 
@@ -264,8 +264,8 @@ op_gs_cond (enum gs_cond pred)
 static void
 dump_gs_cond (pretty_printer *buffer, gimple gs, int spc, int flags)
 {
-  /* This stupid line is here so we can scan for it in the testsuite.  */
-  pp_string (buffer, "GS_COND tuple");
+  if (flags & TDF_DETAILS)
+    pp_string (buffer, "GS_COND tuple");
 
   newline_and_indent (buffer, spc);
   pp_string (buffer, "if (");
@@ -317,7 +317,9 @@ dump_gs_label (pretty_printer *buffer, g
 static void
 dump_gs_bind (pretty_printer *buffer, gimple gs, int spc, int flags)
 {
-  pp_string (buffer, "GS_BIND tuple");
+  if (flags & TDF_DETAILS)
+    pp_string (buffer, "GS_BIND tuple");
+
   newline_and_indent (buffer, spc);
 
   pp_character (buffer, '{');
@@ -334,7 +336,7 @@ dump_gs_bind (pretty_printer *buffer, gi
       newline_and_indent (buffer, spc + 2);
     }
 
-  dump_gs_seq (buffer, gs_bind_body (gs), spc + 2, flags);
+  dump_gimple_seq (buffer, gs_bind_body (gs), spc + 2, flags);
   newline_and_indent (buffer, spc);
   pp_character (buffer, '}');
 }
@@ -378,7 +380,7 @@ dump_gimple_stmt (pretty_printer *buffer
       break;
 
     case GS_NOP:
-      pp_string (buffer, "GS_NOP tuple");
+      pp_string (buffer, "GS_NOP");
       break;
 
     case GS_RETURN:
@@ -392,6 +394,7 @@ dump_gimple_stmt (pretty_printer *buffer
     default:
       GS_NIY;
     }
+
   newline_and_indent (buffer, spc);
   pp_write_text_to_stream (buffer);
 }
Index: function.h
===================================================================
--- function.h	(revision 126602)
+++ function.h	(working copy)
@@ -475,11 +475,6 @@ struct function GTY(())
 
   /* Set when the tail call has been produced.  */
   unsigned int tail_call_emit : 1;
-
-  /* FIXME tuples: This bit is temporarily here to mark when a
-     function has been gimplified, so we can make sure we're not
-     creating non GIMPLE tuples after gimplification.  */
-  unsigned gimplified : 1;
 };
 
 /* If va_list_[gf]pr_size is set to this, it means we don't know how
Index: gimple-ir.c
===================================================================
--- gimple-ir.c	(revision 126601)
+++ gimple-ir.c	(working copy)
@@ -35,6 +35,12 @@ const char *const gs_code_name[] = {
 };
 #undef DEFGSCODE
 
+/* Pointer map to store the sequence of GIMPLE statements
+   corresponding to each function.  For every FUNCTION_DECL FN, the
+   sequence of GIMPLE statements corresponding to FN are stored in
+   gimple_body (FN).  */
+static struct pointer_map_t *gimple_bodies = NULL;
+
 /* Gimple tuple constructors.  */
 
 /* Construct a GS_RETURN statement.
@@ -930,3 +936,32 @@ walk_tuple_ops (gimple gs, walk_tree_fn 
       break;
     }
 }
+
+
+/* Set sequence SEQ to be the GIMPLE body for function FN.  */
+
+void
+set_gimple_body (tree fn, gs_seq seq)
+{
+  void **slot;
+
+  if (gimple_bodies == NULL)
+    gimple_bodies = pointer_map_create ();
+
+  slot = pointer_map_insert (gimple_bodies, fn);
+  *slot = (void *) seq;
+}
+  
+
+/* Return the body of GIMPLE statements for function FN.  */
+
+gs_seq
+gimple_body (tree fn)
+{
+  void **slot;
+  
+  if (gimple_bodies && (slot = pointer_map_contains (gimple_bodies, fn)))
+    return (gs_seq) *slot;
+  
+  return NULL;
+}
Index: gimple-ir.h
===================================================================
--- gimple-ir.h	(revision 126602)
+++ gimple-ir.h	(working copy)
@@ -23,6 +23,8 @@ Software Foundation, 51 Franklin Street,
 #ifndef GCC_GIMPLE_IR_H
 #define GCC_GIMPLE_IR_H
 
+#include "pointer-set.h"
+
 enum gs_code {
 #define DEFGSCODE(SYM, STRING)	SYM,
 #include "gimple.def"
@@ -82,6 +84,8 @@ gs_seq_empty_p (gs_seq s)
   return s->first == NULL;
 }
 
+/* Data structure definitions for GIMPLE tuples.  */
+
 struct gimple_statement_base GTY(())
 {
   ENUM_BITFIELD(gs_code) code : 16;
@@ -117,8 +121,6 @@ struct gimple_statement_omp GTY(())
      struct gs_sequence body;
 };
 
-/* Gimple tuples.  */
-
 /* GS_BIND */
 struct gimple_statement_bind GTY(())
 {
@@ -402,8 +404,9 @@ extern enum gimple_statement_structure_e
 extern void sort_case_labels (VEC(tree,heap) *);
 extern void walk_tuple_ops (gimple, walk_tree_fn, void *,
     			    struct pointer_set_t *);
-extern void walk_seq_ops (gs_seq, walk_tree_fn, void *,
-			  struct pointer_set_t *);
+extern void walk_seq_ops (gs_seq, walk_tree_fn, void *, struct pointer_set_t *);
+extern void set_gimple_body (tree, gs_seq);
+extern gs_seq gimple_body (tree);
 
 extern const char *const gs_code_name[];
 
@@ -1329,5 +1332,7 @@ gs_add_subcode_flag (gimple g, unsigned 
 {
   GS_SUBCODE_FLAGS (g) |= flag;
 }
+
 #include "gimple-iterator.h"
+
 #endif  /* GCC_GIMPLE_IR_H */
Index: gimplify.c
===================================================================
--- gimplify.c	(revision 126602)
+++ gimplify.c	(working copy)
@@ -371,20 +371,6 @@ remove_suffix (char *name, int len)
     }
 }
 
-/* Create a nameless artificial label and put it in the current function
-   context.  Returns the newly created label.  */
-
-tree
-create_artificial_label (void)
-{
-  tree lab = build_decl (LABEL_DECL, NULL_TREE, void_type_node);
-
-  DECL_ARTIFICIAL (lab) = 1;
-  DECL_IGNORED_P (lab) = 1;
-  DECL_CONTEXT (lab) = current_function_decl;
-  return lab;
-}
-
 /* Subroutine for find_single_pointer_decl.  */
 
 static tree
@@ -503,31 +489,6 @@ create_tmp_var (tree type, const char *p
   return tmp_var;
 }
 
-/*  Given a tree, try to return a useful variable name that we can use
-    to prefix a temporary that is being assigned the value of the tree.
-    I.E. given  <temp> = &A, return A.  */
-
-const char *
-get_name (tree t)
-{
-  tree stripped_decl;
-
-  stripped_decl = t;
-  STRIP_NOPS (stripped_decl);
-  if (DECL_P (stripped_decl) && DECL_NAME (stripped_decl))
-    return IDENTIFIER_POINTER (DECL_NAME (stripped_decl));
-  else
-    {
-      switch (TREE_CODE (stripped_decl))
-	{
-	case ADDR_EXPR:
-	  return get_name (TREE_OPERAND (stripped_decl, 0));
-	default:
-	  return NULL;
-	}
-    }
-}
-
 /* Create a temporary with a name derived from VAL.  Subroutine of
    lookup_tmp_var; nobody else should call this function.  */
 
@@ -6634,11 +6595,11 @@ gimplify_body (tree *body_p, gs_seq seq_
    Returns the sequence of GIMPLE statements corresponding to the body
    of FNDECL.  */
 
-struct gs_sequence
+void
 gimplify_function_tree (tree fndecl)
 {
   tree oldfn, parm, ret;
-  struct gs_sequence seq;
+  gs_seq seq;
 
   oldfn = current_function_decl;
   current_function_decl = fndecl;
@@ -6664,8 +6625,8 @@ gimplify_function_tree (tree fndecl)
       && !needs_to_live_in_memory (ret))
     DECL_GIMPLE_REG_P (ret) = 1;
 
-  gs_seq_init (&seq);
-  gimplify_body (&DECL_SAVED_TREE (fndecl), &seq, fndecl, true);
+  seq = (gs_seq) ggc_alloc_cleared (sizeof (*seq));
+  gimplify_body (&DECL_SAVED_TREE (fndecl), seq, fndecl, true);
 
   /* FIXME tuples */
 #if 0
@@ -6697,12 +6658,16 @@ gimplify_function_tree (tree fndecl)
     }
 #endif
 
-  cfun->gimplified = true;
+  /* The tree body of the function is no longer needed, replace it
+     with the new GIMPLE body.  */
+  set_gimple_body (fndecl, seq);
+  DECL_SAVED_TREE (fndecl) = NULL_TREE;
+
   current_function_decl = oldfn;
   cfun = oldfn ? DECL_STRUCT_FUNCTION (oldfn) : NULL;
-  return seq;
 }
-
+
+
 /* Expands EXPR to list of gimple statements STMTS.  If SIMPLE is true,
    force the result to be either ssa_name or an invariant, otherwise
    just force it to be a rhs expression.  If VAR is not NULL, make the
Index: common.opt
===================================================================
--- common.opt	(revision 126601)
+++ common.opt	(working copy)
@@ -486,6 +486,10 @@ ffunction-sections
 Common Report Var(flag_function_sections)
 Place each function into its own section
 
+fgimple-only
+Common Report Var(flag_gimple_only)
+Generate GIMPLE form for one function, then stop
+
 fgcse
 Common Report Var(flag_gcse) Optimization
 Perform global common subexpression elimination
Index: tree-optimize.c
===================================================================
--- tree-optimize.c	(revision 126601)
+++ tree-optimize.c	(working copy)
@@ -410,7 +410,6 @@ tree_rest_of_compilation (tree fndecl)
   /* Release the default bitmap obstack.  */
   bitmap_obstack_release (NULL);
   
-  DECL_SAVED_TREE (fndecl) = NULL;
   cfun = 0;
 
   /* If requested, warn about function definitions where the function will
Index: c-gimplify.c
===================================================================
--- c-gimplify.c	(revision 126602)
+++ c-gimplify.c	(working copy)
@@ -80,7 +80,6 @@ c_genericize (tree fndecl)
   FILE *dump_orig;
   int local_dump_flags;
   struct cgraph_node *cgn;
-  struct gs_sequence seq;
 
   /* Dump the C-specific tree IR.  */
   dump_orig = dump_begin (TDI_original, &local_dump_flags);
@@ -104,23 +103,12 @@ c_genericize (tree fndecl)
     }
 
   /* Go ahead and gimplify for now.  */
-  seq = gimplify_function_tree (fndecl);
-
-  dump_orig = dump_begin (TDI_generic, &local_dump_flags);
-  if (dump_orig)
-    {
-      /* Dump the genericized tree IR.  */
-      dump_function_to_file (fndecl, dump_orig, local_dump_flags);
-
-      /* Dump the gimple IR.  */
-      if (dump_orig && (local_dump_flags & TDF_DETAILS))
-	dump_gimple_seq (dump_orig, &seq);
+  gimplify_function_tree (fndecl);
 
-      dump_end (TDI_generic, dump_orig);
-    }
+  dump_function (TDI_generic, fndecl);
 
-  /* FIXME tuples.  */
-  exit (0);
+  if (flag_gimple_only)
+    exit (0);
 
   /* Genericize all nested functions now.  We do things in this order so
      that items like VLA sizes are expanded properly in the context of
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 126601)
+++ Makefile.in	(working copy)
@@ -735,7 +735,8 @@ BUILTINS_DEF = builtins.def sync-builtin
 TREE_H = tree.h tree.def $(MACHMODE_H) tree-check.h $(BUILTINS_DEF) \
           input.h statistics.h vec.h treestruct.def $(HASHTAB_H) \
           double-int.h
-GIMPLE_IR_H = gimple-ir.h gimple.def gsstruct.def gimple-iterator.h
+GIMPLE_IR_H = gimple-ir.h gimple.def gsstruct.def gimple-iterator.h \
+	      pointer-set.h
 BASIC_BLOCK_H = basic-block.h bitmap.h sbitmap.h varray.h $(PARTITION_H) \
           hard-reg-set.h cfghooks.h $(OBSTACK_H)
 GCOV_IO_H = gcov-io.h gcov-iov.h auto-host.h
Index: tree-cfg.c
===================================================================
--- tree-cfg.c	(revision 126601)
+++ tree-cfg.c	(working copy)
@@ -209,6 +209,7 @@ static unsigned int
 execute_build_cfg (void)
 {
   build_tree_cfg (&DECL_SAVED_TREE (current_function_decl));
+  set_gimple_body (current_function_decl, NULL);
   return 0;
 }
 
@@ -4990,7 +4991,7 @@ dump_function_to_file (tree fn, FILE *fi
 
   if (cfun && cfun->decl == fn && cfun->cfg && basic_block_info)
     {
-      /* Make a CFG based dump.  */
+      /* If the CFG has been built, emit a CFG-based dump.  */
       check_bb_profile (ENTRY_BLOCK_PTR, file);
       if (!ignore_topmost_bind)
 	fprintf (file, "{\n");
@@ -5004,6 +5005,13 @@ dump_function_to_file (tree fn, FILE *fi
       fprintf (file, "}\n");
       check_bb_profile (EXIT_BLOCK_PTR, file);
     }
+  else if (DECL_SAVED_TREE (fn) == NULL)
+    {
+      /* The function is now in GIMPLE form but the CFG has not been
+	 built yet.  Emit the single sequence of GIMPLE statements
+	 that make up its body.  */
+      print_gimple_seq (file, gimple_body (fn), 2, flags);
+    }
   else
     {
       int indent;

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