Blame SOURCES/gcc34-frame-base-loclist.patch

6fdc0f
2006-05-19  Jakub Jelinek  <jakub@redhat.com>
6fdc0f
6fdc0f
	* dwarf2out.c (gen_subprogram_die): If -fno-frame-base-loclist,
6fdc0f
	set frame base to hard fp or stack pointer.
6fdc0f
	* toplev.c (flag_frame_base_loclist): New variable.
6fdc0f
	(f_options): Add -fframe-base-loclist.
6fdc0f
	* flags.h (flag_frame_base_loclist): New extern.
6fdc0f
	* common.opt (frame-base-loclist): New flag.
6fdc0f
	* opts.c (common_handle_option): Handle -f{,no-}frame-base-loclist.
6fdc0f
6fdc0f
--- gcc/dwarf2out.c.jj	2006-05-15 14:02:35.000000000 +0200
6fdc0f
+++ gcc/dwarf2out.c	2006-05-15 14:21:40.000000000 +0200
6fdc0f
@@ -11389,33 +11389,35 @@ gen_subprogram_die (tree decl, dw_die_re
6fdc0f
 #endif
6fdc0f
 
6fdc0f
 #ifdef DWARF2_UNWIND_INFO
6fdc0f
-      /* We define the "frame base" as the function's CFA.  This is more
6fdc0f
-	 convenient for several reasons: (1) It's stable across the prologue
6fdc0f
-	 and epilogue, which makes it better than just a frame pointer,
6fdc0f
-	 (2) With dwarf3, there exists a one-byte encoding that allows us
6fdc0f
-	 to reference the .debug_frame data by proxy, but failing that,
6fdc0f
-	 (3) We can at least reuse the code inspection and interpretation
6fdc0f
-	 code that determines the CFA position at various points in the
6fdc0f
-	 function.  */
6fdc0f
-      /* ??? Use some command-line or configury switch to enable the use
6fdc0f
-	 of dwarf3 DW_OP_call_frame_cfa.  At present there are no dwarf
6fdc0f
-	 consumers that understand it; fall back to "pure" dwarf2 and
6fdc0f
-	 convert the CFA data into a location list.  */
6fdc0f
-      {
6fdc0f
-	dw_loc_list_ref list = convert_cfa_to_loc_list ();
6fdc0f
-	if (list->dw_loc_next)
6fdc0f
-	  add_AT_loc_list (subr_die, DW_AT_frame_base, list);
6fdc0f
-	else
6fdc0f
-	  add_AT_loc (subr_die, DW_AT_frame_base, list->expr);
6fdc0f
-      }
6fdc0f
+      if (flag_frame_base_loclist)
6fdc0f
+	{
6fdc0f
+	  /* We define the "frame base" as the function's CFA.  This is more
6fdc0f
+	     convenient for several reasons: (1) It's stable across the prologue
6fdc0f
+	     and epilogue, which makes it better than just a frame pointer,
6fdc0f
+	     (2) With dwarf3, there exists a one-byte encoding that allows us
6fdc0f
+	     to reference the .debug_frame data by proxy, but failing that,
6fdc0f
+	     (3) We can at least reuse the code inspection and interpretation
6fdc0f
+	     code that determines the CFA position at various points in the
6fdc0f
+	     function.  */
6fdc0f
+	  /* ??? Use some command-line or configury switch to enable the use
6fdc0f
+	     of dwarf3 DW_OP_call_frame_cfa.  At present there are no dwarf
6fdc0f
+	     consumers that understand it; fall back to "pure" dwarf2 and
6fdc0f
+	     convert the CFA data into a location list.  */
6fdc0f
+	  dw_loc_list_ref list = convert_cfa_to_loc_list ();
6fdc0f
+	  if (list->dw_loc_next)
6fdc0f
+	    add_AT_loc_list (subr_die, DW_AT_frame_base, list);
6fdc0f
+	  else
6fdc0f
+	    add_AT_loc (subr_die, DW_AT_frame_base, list->expr);
6fdc0f
 
6fdc0f
-      /* Compute a displacement from the "steady-state frame pointer" to
6fdc0f
-	 the CFA.  The former is what all stack slots and argument slots
6fdc0f
-	 will reference in the rtl; the later is what we've told the
6fdc0f
-	 debugger about.  We'll need to adjust all frame_base references
6fdc0f
-	 by this displacement.  */
6fdc0f
-      compute_frame_pointer_to_cfa_displacement ();
6fdc0f
-#else
6fdc0f
+	  /* Compute a displacement from the "steady-state frame pointer" to
6fdc0f
+	     the CFA.  The former is what all stack slots and argument slots
6fdc0f
+	     will reference in the rtl; the later is what we've told the
6fdc0f
+	     debugger about.  We'll need to adjust all frame_base references
6fdc0f
+	     by this displacement.  */
6fdc0f
+	  compute_frame_pointer_to_cfa_displacement ();
6fdc0f
+	}
6fdc0f
+      else
6fdc0f
+#endif
6fdc0f
       /* For targets which support DWARF2, but not DWARF2 call-frame info,
6fdc0f
 	 we just use the stack pointer or frame pointer.  */
6fdc0f
       /* ??? Should investigate getting better info via callbacks, or else
6fdc0f
@@ -11425,7 +11427,6 @@ gen_subprogram_die (tree decl, dw_die_re
6fdc0f
 	  = frame_pointer_needed ? hard_frame_pointer_rtx : stack_pointer_rtx;
6fdc0f
 	add_AT_loc (subr_die, DW_AT_frame_base, reg_loc_descriptor (fp_reg));
6fdc0f
       }
6fdc0f
-#endif
6fdc0f
 
6fdc0f
 #if 0
6fdc0f
       /* ??? This fails for nested inline functions, because context_display
6fdc0f
--- gcc/toplev.c.jj	2005-11-21 14:55:43.000000000 +0100
6fdc0f
+++ gcc/toplev.c	2006-05-15 14:25:14.000000000 +0200
6fdc0f
@@ -961,6 +961,10 @@ int flag_tracer = 0;
6fdc0f
 
6fdc0f
 int flag_unit_at_a_time = 0;
6fdc0f
 
6fdc0f
+/* Nonzero if DWARF2 DW_AT_frame_base can be a location list.  */
6fdc0f
+
6fdc0f
+int flag_frame_base_loclist = 1;
6fdc0f
+
6fdc0f
 /* Nonzero if we should track variables.  When
6fdc0f
    flag_var_tracking == AUTODETECT_FLAG_VAR_TRACKING it will be set according
6fdc0f
    to optimize, debug_info_level and debug_hooks in process_options ().  */
6fdc0f
@@ -1165,7 +1169,8 @@ static const lang_independent_options f_
6fdc0f
   { "trapv", &flag_trapv, 1 },
6fdc0f
   { "wrapv", &flag_wrapv, 1 },
6fdc0f
   { "new-ra", &flag_new_regalloc, 1 },
6fdc0f
-  { "var-tracking", &flag_var_tracking, 1}
6fdc0f
+  { "var-tracking", &flag_var_tracking, 1},
6fdc0f
+  { "frame-base-loclist", &flag_frame_base_loclist, 1}
6fdc0f
 };
6fdc0f
 
6fdc0f
 /* Here is a table, controlled by the tm.h file, listing each -m switch
6fdc0f
--- gcc/flags.h.jj	2005-11-21 14:43:20.000000000 +0100
6fdc0f
+++ gcc/flags.h	2006-05-15 14:25:06.000000000 +0200
6fdc0f
@@ -746,6 +746,9 @@ extern int flag_remove_unreachable_funct
6fdc0f
 /* Nonzero if we should track variables.  */
6fdc0f
 extern int flag_var_tracking;
6fdc0f
 
6fdc0f
+/* Nonzero if DWARF2 DW_AT_frame_base can be a location list.  */
6fdc0f
+extern int flag_frame_base_loclist;
6fdc0f
+
6fdc0f
 /* A string that's used when a random name is required.  NULL means
6fdc0f
    to make it really random.  */
6fdc0f
 
6fdc0f
--- gcc/common.opt.jj	2005-11-21 08:43:20.000000000 -0500
6fdc0f
+++ gcc/common.opt	2006-05-19 06:24:09.000000000 -0400
6fdc0f
@@ -718,6 +718,10 @@ fvar-tracking
6fdc0f
 Common
6fdc0f
 Perform variable tracking
6fdc0f
 
6fdc0f
+fframe-base-loclist
6fdc0f
+Common
6fdc0f
+Allow use of DWARF2 location lists for frame base
6fdc0f
+
6fdc0f
 fverbose-asm
6fdc0f
 Common
6fdc0f
 Add extra commentary to assembler output
6fdc0f
--- gcc/opts.c.jj	2005-11-21 08:43:21.000000000 -0500
6fdc0f
+++ gcc/opts.c	2006-05-19 06:26:26.000000000 -0400
6fdc0f
@@ -1461,6 +1461,10 @@ common_handle_option (size_t scode, cons
6fdc0f
       flag_var_tracking = value;
6fdc0f
       break;
6fdc0f
 
6fdc0f
+    case OPT_fframe_base_loclist:
6fdc0f
+      flag_frame_base_loclist = value;
6fdc0f
+      break;
6fdc0f
+
6fdc0f
     case OPT_fverbose_asm:
6fdc0f
       flag_verbose_asm = value;
6fdc0f
       break;