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]

[PATCH] Bits and pieces to make cfglayout mode easier to work with


Hello,

This patch does two things:
* Detect if we're in cfglayout mode, and automatically set
  CLEANUP_CFGLAYOUT on the cleanup_cfg flags.  I will clean
  up the places where we set this flag explicitly later.
* Make cfglayout survive across ggc_collect calls.  We would
  collect function headers and footers because they are not
  connected to the insn chain and their placeholder did not
  have a GTY(()) marker.

Bootstrapped&tested on ia46-linux and x86_64-linux, as part of
a bigger patch that adds two passes (into_cfglayout_mode, and,
you've guessed it!, outof_cfglayout_mode).  I can now run in
cfglayout mode from pass_initial_value_sets all the way up to
pass_combine.

If no-one objects, I'll commit this patch in the second half
of this week.

Gr.
Steven




	* cfgcleanup.c (cleanup_cfg): Detect cfglayout mode and set
	the CLEANUP_CFGLAYOUT flag when in cfglayout mode.

	* Makefile.c (GTFILES): Add cfglayout.h.
	* gengtype.c (open_base_files): Likewise.
	* cfglayout.c (cfg_layout_function_footer,
	cfg_layout_function_header) Reindent to make gengtype happy.
	* cfglayout.h (cfg_layout_function_footer,
	cfg_layout_function_header): Add GTY(()) marker.

Index: cfgcleanup.c
===================================================================
--- cfgcleanup.c	(revision 120800)
+++ cfgcleanup.c	(working copy)
@@ -2220,6 +2220,12 @@ cleanup_cfg (int mode)
 {
   bool changed = false;
 
+  /* Set the cfglayout mode flag here.  We could update all the callers
+     but that is just inconvenient, especially given that we eventually
+     want to have cfglayout mode as the default.  */
+  if (current_ir_type () == IR_RTL_CFGLAYOUT)
+    mode |= CLEANUP_CFGLAYOUT;
+
   timevar_push (TV_CLEANUP_CFG);
   if (delete_unreachable_blocks ())
     {
Index: Makefile.in
===================================================================
--- Makefile.in	(revision 120800)
+++ Makefile.in	(working copy)
@@ -2804,7 +2804,7 @@ GTFILES = $(srcdir)/input.h $(srcdir)/co
   $(srcdir)/function.c $(srcdir)/except.h \
   $(srcdir)/gcse.c $(srcdir)/integrate.c $(srcdir)/lists.c $(srcdir)/optabs.c \
   $(srcdir)/profile.c $(srcdir)/regclass.c \
-  $(srcdir)/reg-stack.c $(srcdir)/cfglayout.c \
+  $(srcdir)/reg-stack.c $(srcdir)/cfglayout.c $(srcdir)/cfglayout.h \
   $(srcdir)/sdbout.c $(srcdir)/stor-layout.c \
   $(srcdir)/stringpool.c $(srcdir)/tree.c $(srcdir)/varasm.c \
   $(srcdir)/tree-mudflap.c $(srcdir)/tree-flow.h \
Index: gengtype.c
===================================================================
--- gengtype.c	(revision 120800)
+++ gengtype.c	(working copy)
@@ -1107,7 +1107,7 @@ open_base_files (void)
       "hard-reg-set.h", "basic-block.h", "cselib.h", "insn-addr.h",
       "optabs.h", "libfuncs.h", "debug.h", "ggc.h", "cgraph.h",
       "tree-flow.h", "reload.h", "cpp-id-data.h", "tree-chrec.h",
-      "except.h", "output.h", NULL
+      "cfglayout.h", "except.h", "output.h", NULL
     };
     const char *const *ifp;
     outf_p gtype_desc_c;
Index: cfglayout.c
===================================================================
--- cfglayout.c	(revision 120800)
+++ cfglayout.c	(working copy)
@@ -40,7 +40,8 @@ Software Foundation, 51 Franklin Street,
 #include "vecprim.h"
 
 /* Holds the interesting trailing notes for the function.  */
-rtx cfg_layout_function_footer, cfg_layout_function_header;
+rtx cfg_layout_function_footer;
+rtx cfg_layout_function_header;
 
 static rtx skip_insns_after_block (basic_block);
 static void record_effective_endpoints (void);
Index: cfglayout.h
===================================================================
--- cfglayout.h	(revision 120800)
+++ cfglayout.h	(working copy)
@@ -23,7 +23,8 @@
 
 #include "basic-block.h"
 
-extern rtx cfg_layout_function_footer;
+extern GTY(()) rtx cfg_layout_function_footer;
+extern GTY(()) rtx cfg_layout_function_header;
 
 extern void cfg_layout_initialize (unsigned int);
 extern void cfg_layout_finalize (void);


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