[PATCH 05/16] Introduce rtl_data::init_stack_alignment

David Malcolm dmalcolm@redhat.com
Wed Oct 5 15:45:00 GMT 2016


Move this part of "expand"'s initialization of crtl into its own
method so that it can used by the RTL frontend when postprocessing
RTL dumps.

gcc/ChangeLog:
	* cfgexpand.c (pass_expand::execute): Move stack initializations
	to rtl_data::init_stack_alignment and call it.
	* emit-rtl.c (rtl_data::init_stack_alignment): New method.
	* emit-rtl.h (rtl_data::init_stack_alignment): New method.
---
 gcc/cfgexpand.c |  5 +----
 gcc/emit-rtl.c  | 12 ++++++++++++
 gcc/emit-rtl.h  |  2 ++
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 4190f7f..70dfe34 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -6218,10 +6218,7 @@ pass_expand::execute (function *fun)
   discover_nonconstant_array_refs ();
 
   targetm.expand_to_rtl_hook ();
-  crtl->stack_alignment_needed = STACK_BOUNDARY;
-  crtl->max_used_stack_slot_alignment = STACK_BOUNDARY;
-  crtl->stack_alignment_estimated = 0;
-  crtl->preferred_stack_boundary = STACK_BOUNDARY;
+  crtl->init_stack_alignment ();
   fun->cfg->max_jumptable_ents = 0;
 
   /* Resovle the function section.  Some targets, like ARM EABI rely on knowledge
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 2d6d1eb..fdfc790 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -6285,5 +6285,17 @@ need_atomic_barrier_p (enum memmodel model, bool pre)
       gcc_unreachable ();
     }
 }
+
+/* Initialize fields of rtl_data related to stack alignment.  */
+
+void
+rtl_data::init_stack_alignment ()
+{
+  stack_alignment_needed = STACK_BOUNDARY;
+  max_used_stack_slot_alignment = STACK_BOUNDARY;
+  stack_alignment_estimated = 0;
+  preferred_stack_boundary = STACK_BOUNDARY;
+}
+
 
 #include "gt-emit-rtl.h"
diff --git a/gcc/emit-rtl.h b/gcc/emit-rtl.h
index 52c72b1..663b4a0 100644
--- a/gcc/emit-rtl.h
+++ b/gcc/emit-rtl.h
@@ -55,6 +55,8 @@ struct GTY(()) incoming_args {
 
 /* Datastructures maintained for currently processed function in RTL form.  */
 struct GTY(()) rtl_data {
+  void init_stack_alignment ();
+
   struct expr_status expr;
   struct emit_status emit;
   struct varasm_status varasm;
-- 
1.8.5.3



More information about the Gcc-patches mailing list