public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* powerpc64 traceback tables
@ 2002-07-26  0:22 Alan Modra
  2002-07-26 11:29 ` David Edelsohn
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Modra @ 2002-07-26  0:22 UTC (permalink / raw)
  To: gcc-patches

From the PowerPC64 ABI:

"To support debuggers and exception handlers, the 64-bit PowerPC ELF
ABI defines traceback tables.  Compilers must support generation of at
least the mandatory part of traceback tables, and system libraries
should contain the mandatory part.  Compilers should provide an option
to turn off traceback table generation to save space when the
information is not needed."

Adds control of traceback table output.  Default is unchanged from
current behaviour.

	* config/rs6000/rs6000.c (rs6000_traceback_name): New var.
	(rs6000_traceback): New var.
	(rs6000_override_options): Set rs6000_traceback.
	(rs6000_output_function_epilogue): Implement traceback options.
	* config/rs6000/rs6000.h (TARGET_OPTIONS): Add "traceback=".
	(rs6000_traceback_name): Declare.

OK mainline?

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

Index: gcc/config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.348
diff -u -p -r1.348 rs6000.c
--- gcc/config/rs6000/rs6000.c	25 Jul 2002 21:00:10 -0000	1.348
+++ gcc/config/rs6000/rs6000.c	26 Jul 2002 06:07:32 -0000
@@ -129,6 +129,14 @@ const char *rs6000_debug_name;
 int rs6000_debug_stack;		/* debug stack applications */
 int rs6000_debug_arg;		/* debug argument handling */
 
+const char *rs6000_traceback_name;
+static enum {
+  traceback_default = 0,
+  traceback_none,
+  traceback_part,
+  traceback_full
+} rs6000_traceback;
+
 /* Flag to say the TOC is initialized */
 int toc_initialized;
 char toc_label_name[10];
@@ -600,6 +608,19 @@ rs6000_override_options (default_cpu)
 	error ("unknown -mdebug-%s switch", rs6000_debug_name);
     }
 
+  if (rs6000_traceback_name)
+    {
+      if (! strcmp (rs6000_traceback_name, "full"))
+	rs6000_traceback = traceback_full;
+      else if (! strncmp (rs6000_traceback_name, "part", 4))
+	rs6000_traceback = traceback_part;
+      else if (! strncmp (rs6000_traceback_name, "no", 2))
+	rs6000_traceback = traceback_none;
+      else
+	error ("unknown -mtraceback arg `%s'; expecting `full', `partial' or `none'",
+	       rs6000_traceback_name);
+    }
+
   /* Set size of long double */
   rs6000_long_double_type_size = 64;
   if (rs6000_long_double_size_string)
@@ -10818,7 +10839,6 @@ rs6000_output_function_epilogue (file, s
      HOST_WIDE_INT size ATTRIBUTE_UNUSED;
 {
   rs6000_stack_t *info = rs6000_stack_info ();
-  int optional_tbtab = (optimize_size || TARGET_ELF) ? 0 : 1;
 
   if (! HAVE_epilogue)
     {
@@ -10871,12 +10891,21 @@ rs6000_output_function_epilogue (file, s
 
      System V.4 Powerpc's (and the embedded ABI derived from it) use a
      different traceback table.  */
-  if (DEFAULT_ABI == ABI_AIX && ! flag_inhibit_size_directive)
+  if (DEFAULT_ABI == ABI_AIX && ! flag_inhibit_size_directive
+      && rs6000_traceback != traceback_none)
     {
       const char *fname = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0);
       const char *language_string = lang_hooks.name;
       int fixed_parms = 0, float_parms = 0, parm_info = 0;
       int i;
+      int optional_tbtab;
+
+      if (rs6000_traceback == traceback_full)
+	optional_tbtab = 1;
+      else if (rs6000_traceback == traceback_part)
+	optional_tbtab = 0;
+      else
+	optional_tbtab = !optimize_size && !TARGET_ELF;
 
       while (*fname == '.')	/* V.4 encodes . in the name */
 	fname++;
@@ -11070,7 +11099,6 @@ rs6000_output_function_epilogue (file, s
 
       fputs ("\t.align 2\n", file);
     }
-  return;
 }
 \f
 /* A C compound statement that outputs the assembler code for a thunk
Index: gcc/config/rs6000/rs6000.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.h,v
retrieving revision 1.214
diff -u -p -r1.214 rs6000.h
--- gcc/config/rs6000/rs6000.h	25 Jul 2002 02:22:47 -0000	1.214
+++ gcc/config/rs6000/rs6000.h	26 Jul 2002 06:17:42 -0000
@@ -392,6 +392,8 @@ extern enum processor_type rs6000_cpu;
    {"tune=", &rs6000_select[2].string,					\
     N_("Schedule code for given CPU") },				\
    {"debug=", &rs6000_debug_name, N_("Enable debug output") },		\
+   {"traceback=", &rs6000_traceback_name,				\
+    N_("Select full, part, or no traceback table") },			\
    {"abi=", &rs6000_abi_string, N_("Specify ABI to use") },		\
    {"long-double-", &rs6000_long_double_size_string,			\
     N_("Specify size of long double (64 or 128 bits)") },		\
@@ -424,6 +426,8 @@ extern int rs6000_debug_arg;		/* debug a
 
 #define	TARGET_DEBUG_STACK	rs6000_debug_stack
 #define	TARGET_DEBUG_ARG	rs6000_debug_arg
+
+extern const char *rs6000_traceback_name; /* Type of traceback table.  */
 
 /* These are separate from target_flags because we've run out of bits
    there.  */

^ permalink raw reply	[flat|nested] 3+ messages in thread

* powerpc64 traceback tables
  2002-07-26  0:22 powerpc64 traceback tables Alan Modra
@ 2002-07-26 11:29 ` David Edelsohn
  2002-07-26 17:03   ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: David Edelsohn @ 2002-07-26 11:29 UTC (permalink / raw)
  To: Alan Modra; +Cc: gcc-patches

	Shouldn't

+      if (! strcmp (rs6000_traceback_name, "full"))
+       rs6000_traceback = traceback_full;

be strncmp as well?


	Also, you really don't like empty return statements, do you?


        * config/rs6000/rs6000.c (rs6000_traceback_name): New var.
        (rs6000_traceback): New var.
        (rs6000_override_options): Set rs6000_traceback.
        (rs6000_output_function_epilogue): Implement traceback options.
        * config/rs6000/rs6000.h (TARGET_OPTIONS): Add "traceback=".
        (rs6000_traceback_name): Declare.

This is with the the strcmp->strncmp change.

David

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: powerpc64 traceback tables
  2002-07-26 11:29 ` David Edelsohn
@ 2002-07-26 17:03   ` Alan Modra
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Modra @ 2002-07-26 17:03 UTC (permalink / raw)
  To: David Edelsohn; +Cc: gcc-patches

On Fri, Jul 26, 2002 at 02:20:12PM -0400, David Edelsohn wrote:
> 	Shouldn't
> 
> +      if (! strcmp (rs6000_traceback_name, "full"))
> +       rs6000_traceback = traceback_full;
> 
> be strncmp as well?

Hmm.

	-mtraceback=part
	-mtraceback=partial

and

	-mtraceback=no
	-mtraceback=none

make sense.  How do you want to extend "full".  Oh well, doesn't matter,
I'll commit with strncmp just for consistency.  Might at well be hitting
hot cache.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-07-26 23:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-26  0:22 powerpc64 traceback tables Alan Modra
2002-07-26 11:29 ` David Edelsohn
2002-07-26 17:03   ` Alan Modra

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).