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] Use cfglayout mode in RTL


Hi,

This is the first patch to keep the CFG in cfglayout mode in RTL.  This
is just the start.  I can't stay in cfglayout mode over tracer and loop2
because those passes go into and out of cfglayout mode as part of the
pass.  I'll fix that in a follow-up patch (which will be quite simple)
but I wanted to get this part in and then gradually start pushing the
out-of-cfglayout pass down in the pass schedule.

Bootstrapped and tested on i686-pc-linux-gnu.  Previous versions were
bootstrapped on a number of targets including mips, sh, ia64, and x86-64.

OK for the trunk?

Gr.
Steven

	* tree-pass.h (pass_into_cfg_layout_mode,
	pass_outof_cfg_layout_mode): Declare.
	* cfglayout.c (into_cfg_layout_mode, outof_cfg_layout_mode,
	pass_into_cfg_layout_mode, pass_outof_cfg_layout_mode): New.
	* passes.c (pass_into_cfg_layout_mode): Schedule before jump2.
	(pass_outof_cfg_layout_mode): Schedule after pass_rtl_ifcvt.

Index: tree-pass.h
===================================================================
--- tree-pass.h	(revision 122807)
+++ tree-pass.h	(working copy)
@@ -344,6 +344,9 @@ extern struct tree_opt_pass pass_profili
 extern struct tree_opt_pass pass_rtl_ifcvt;
 extern struct tree_opt_pass pass_tracer;
 
+extern struct tree_opt_pass pass_into_cfg_layout_mode;
+extern struct tree_opt_pass pass_outof_cfg_layout_mode;
+
 extern struct tree_opt_pass pass_loop2;
 extern struct tree_opt_pass pass_rtl_loop_init;
 extern struct tree_opt_pass pass_rtl_move_loop_invariants;
Index: cfglayout.c
===================================================================
--- cfglayout.c	(revision 122807)
+++ cfglayout.c	(working copy)
@@ -347,6 +347,60 @@ struct tree_opt_pass pass_insn_locators_
   0                                     /* letter */
 };
 
+static unsigned int
+into_cfg_layout_mode (void)
+{
+  cfg_layout_initialize (0);
+  return 0;
+}
+
+static unsigned int
+outof_cfg_layout_mode (void)
+{
+  basic_block bb;
+
+  FOR_EACH_BB (bb)
+    if (bb->next_bb != EXIT_BLOCK_PTR)
+      bb->aux = bb->next_bb;
+
+  cfg_layout_finalize ();
+
+  return 0;
+}
+
+struct tree_opt_pass pass_into_cfg_layout_mode =
+{
+  "into_cfglayout",                     /* name */
+  NULL,                                 /* gate */
+  into_cfg_layout_mode,                 /* execute */
+  NULL,                                 /* sub */
+  NULL,                                 /* next */
+  0,                                    /* static_pass_number */
+  0,                                    /* tv_id */
+  0,                                    /* properties_required */
+  0,                                    /* properties_provided */
+  0,                                    /* properties_destroyed */
+  0,                                    /* todo_flags_start */
+  TODO_dump_func,                       /* todo_flags_finish */
+  0                                     /* letter */
+};
+
+struct tree_opt_pass pass_outof_cfg_layout_mode =
+{
+  "outof_cfglayout",                    /* name */
+  NULL,                                 /* gate */
+  outof_cfg_layout_mode,                /* execute */
+  NULL,                                 /* sub */
+  NULL,                                 /* next */
+  0,                                    /* static_pass_number */
+  0,                                    /* tv_id */
+  0,                                    /* properties_required */
+  0,                                    /* properties_provided */
+  0,                                    /* properties_destroyed */
+  0,                                    /* todo_flags_start */
+  TODO_dump_func,                       /* todo_flags_finish */
+  0                                     /* letter */
+};
 
 /* For each lexical block, set BLOCK_NUMBER to the depth at which it is
    found in the block tree.  */
Index: passes.c
===================================================================
--- passes.c	(revision 122807)
+++ passes.c	(working copy)
@@ -658,6 +658,7 @@ init_optimization_passes (void)
       NEXT_PASS (pass_initial_value_sets);
       NEXT_PASS (pass_unshare_all_rtl);
       NEXT_PASS (pass_instantiate_virtual_regs);
+      NEXT_PASS (pass_into_cfg_layout_mode);
       NEXT_PASS (pass_jump2);
       NEXT_PASS (pass_lower_subreg);
       NEXT_PASS (pass_cse);
@@ -665,6 +666,7 @@ init_optimization_passes (void)
       NEXT_PASS (pass_gcse);
       NEXT_PASS (pass_jump_bypass);
       NEXT_PASS (pass_rtl_ifcvt);
+      NEXT_PASS (pass_outof_cfg_layout_mode);
       NEXT_PASS (pass_tracer);
       /* Perform loop optimizations.  It might be better to do them a bit
 	 sooner, but we want the profile feedback to work more


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