public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH]: Move frame_pointer_needed to rtl_data
@ 2008-04-17  9:11 Ye, Joey
  0 siblings, 0 replies; only message in thread
From: Ye, Joey @ 2008-04-17  9:11 UTC (permalink / raw)
  To: GCC Patches; +Cc: Lu, Hongjiu, Guo, Xuepeng, Ye, Joey

Related discussion:
http://gcc.gnu.org/ml/gcc-patches/2008-04/msg01102.html

2008-04-17  Joey Ye  <joey.ye@intel.com>
	    H.J. Lu  <hongjiu.lu@intel.com>

	* flags.h (frame_pointer_needed): Removed.
	* final.c (frame_pointer_needed): Likewise.

	* function.h (rtl_data): Add new field frame_pointer_needed and
        frame_pointer_needed_set.
	(frame_pointer_needed): New macro.

	* global.c (compute_regsets): Set frame_pointer_needed and
        frame_pointer_needed_set.

	* reload1.c (init_elim_table): Don't set frame_pointer_needed
here.

Index: flags.h
===================================================================
--- flags.h	(revision 134203)
+++ flags.h	(working copy)
@@ -223,12 +223,6 @@ extern int flag_dump_rtl_in_asm;
 \f
 /* Other basic status info about current function.  */
 
-/* Nonzero means current function must be given a frame pointer.
-   Set in stmt.c if anything is allocated on the stack there.
-   Set in reload1.c if anything is allocated on the stack there.  */
-
-extern int frame_pointer_needed;
-
 /* Nonzero if subexpressions must be evaluated from left-to-right.  */
 extern int flag_evaluation_order;
 
Index: final.c
===================================================================
--- final.c	(revision 134203)
+++ final.c	(working copy)
@@ -178,12 +178,6 @@ CC_STATUS cc_status;
 CC_STATUS cc_prev_status;
 #endif
 
-/* Nonzero means current function must be given a frame pointer.
-   Initialized in function.c to 0.  Set only in reload1.c as per
-   the needs of the function.  */
-
-int frame_pointer_needed;
-
 /* Number of unmatched NOTE_INSN_BLOCK_BEG notes we have seen.  */
 
 static int block_depth;
Index: global.c
===================================================================
--- global.c	(revision 134203)
+++ global.c	(working copy)
@@ -250,8 +250,12 @@ compute_regsets (HARD_REG_SET *elim_set,
   int need_fp
     = (! flag_omit_frame_pointer
        || (current_function_calls_alloca && EXIT_IGNORE_STACK)
+       || current_function_accesses_prior_frames
        || FRAME_POINTER_REQUIRED);
 
+  frame_pointer_needed = need_fp;
+  crtl->need_frame_pointer_set = 1;
+
   max_regno = max_reg_num ();
   compact_blocks ();
 
Index: function.h
===================================================================
--- function.h	(revision 134203)
+++ function.h	(working copy)
@@ -288,6 +288,12 @@ struct rtl_data GTY(())
   /* Current nesting level for temporaries.  */
   int x_temp_slot_level;
 
+  /* Nonzero if current function must be given a frame pointer.
+     Set in global.c if anything is allocated on the stack there.  */
+  unsigned int need_frame_pointer : 1;
+
+  /* Nonzero if need_frame_pointer has been set.  */
+  unsigned int need_frame_pointer_set : 1;
 };
 
 #define return_label (crtl->x_return_label)
@@ -301,6 +307,7 @@ struct rtl_data GTY(())
 #define avail_temp_slots (crtl->x_avail_temp_slots)
 #define temp_slot_level (crtl->x_temp_slot_level)
 #define nonlocal_goto_handler_labels
(crtl->x_nonlocal_goto_handler_labels)
+#define frame_pointer_needed (crtl->need_frame_pointer)
 
 extern GTY(()) struct rtl_data x_rtl;
 
Index: reload1.c
===================================================================
--- reload1.c	(revision 134203)
+++ reload1.c	(working copy)
@@ -3713,18 +3713,8 @@ init_elim_table (void)
   if (!reg_eliminate)
     reg_eliminate = xcalloc (sizeof (struct elim_table),
NUM_ELIMINABLE_REGS);
 
-  /* Does this function require a frame pointer?  */
-
-  frame_pointer_needed = (! flag_omit_frame_pointer
-			  /* ?? If EXIT_IGNORE_STACK is set, we will not
save
-			     and restore sp for alloca.  So we can't
eliminate
-			     the frame pointer in that case.  At some
point,
-			     we should improve this by emitting the
-			     sp-adjusting insns for this case.  */
-			  || (current_function_calls_alloca
-			      && EXIT_IGNORE_STACK)
-			  || current_function_accesses_prior_frames
-			  || FRAME_POINTER_REQUIRED);
+  /* frame_pointer_needed should has been set.  */
+  gcc_assert (crtl->need_frame_pointer_set);
 
   num_eliminable = 0;
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-04-17  8:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-17  9:11 [PATCH]: Move frame_pointer_needed to rtl_data Ye, Joey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).