target.def (output_source_filename): New hook.
authorAnatoly Sokolov <aesok@post.ru>
Mon, 26 Jul 2010 18:00:17 +0000 (22:00 +0400)
committerAnatoly Sokolov <aesok@gcc.gnu.org>
Mon, 26 Jul 2010 18:00:17 +0000 (22:00 +0400)
* target.def (output_source_filename): New hook.
* doc/tm.texi.in (TARGET_ASM_OUTPUT_SOURCE_FILENAME): Document.
* doc/tm.texi: Regenerate.
* toplev.c (output_file_directive) Remove function.
* toplev.h (output_file_directive) Remove.
* output.h (default_asm_output_source_filename,
output_file_directive): Declare.
* varasm.h (default_asm_output_source_filename,
output_file_directive): New functions.

* config/mips/mips.h (ASM_OUTPUT_SOURCE_FILENAME): Remove macro.
* config/mips/mips-protos.h (mips_output_filename): Remove.
* config/mips/mips.c (mips_output_filename): Make Static.
(TARGET_ASM_OUTPUT_SOURCE_FILENAME): Define.

From-SVN: r162542

gcc/ChangeLog
gcc/config/mips/mips-protos.h
gcc/config/mips/mips.c
gcc/config/mips/mips.h
gcc/doc/tm.texi
gcc/doc/tm.texi.in
gcc/output.h
gcc/target.def
gcc/toplev.c
gcc/toplev.h
gcc/varasm.c

index 93d0c7ea0913a7f1ff473059034181801e1a9094..5eb1ae9e60476756d569e4fb84f6af0cd6957b6b 100644 (file)
@@ -1,3 +1,20 @@
+2010-07-26  Anatoly Sokolov  <aesok@post.ru>
+
+       * target.def (output_source_filename): New hook.
+       * doc/tm.texi.in (TARGET_ASM_OUTPUT_SOURCE_FILENAME): Document.
+       * doc/tm.texi: Regenerate.
+       * toplev.c (output_file_directive) Remove function.
+       * toplev.h (output_file_directive) Remove.
+       * output.h (default_asm_output_source_filename,
+       output_file_directive): Declare.
+       * varasm.h (default_asm_output_source_filename,
+       output_file_directive): New functions.
+
+       * config/mips/mips.h (ASM_OUTPUT_SOURCE_FILENAME): Remove macro.
+       * config/mips/mips-protos.h (mips_output_filename): Remove.
+       * config/mips/mips.c (mips_output_filename): Make Static.
+       (TARGET_ASM_OUTPUT_SOURCE_FILENAME): Define.
+
 2010-07-26  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/43784
index 70920fd64a0cb590dcf81394d13f5f11f5aed9c5..dd928e3dc8ffacdd65e14899bf3e2a155260e4bc 100644 (file)
@@ -261,7 +261,6 @@ extern HOST_WIDE_INT mips_debugger_offset (rtx, HOST_WIDE_INT);
 extern void mips_push_asm_switch (struct mips_asm_switch *);
 extern void mips_pop_asm_switch (struct mips_asm_switch *);
 extern void mips_output_external (FILE *, tree, const char *);
-extern void mips_output_filename (FILE *, const char *);
 extern void mips_output_ascii (FILE *, const char *, size_t);
 extern void mips_output_aligned_decl_common (FILE *, tree, const char *,
                                             unsigned HOST_WIDE_INT,
index c2162973393e73db28f099db7ce77b10d03993fd..0892c3e1d9fd040f8b7d1e2789b4140083a6df10 100644 (file)
@@ -7892,9 +7892,9 @@ mips_output_external (FILE *file, tree decl, const char *name)
     }
 }
 
-/* Implement ASM_OUTPUT_SOURCE_FILENAME.  */
+/* Implement TARGET_ASM_OUTPUT_SOURCE_FILENAME.  */
 
-void
+static void
 mips_output_filename (FILE *stream, const char *name)
 {
   /* If we are emitting DWARF-2, let dwarf2out handle the ".file"
@@ -16497,6 +16497,9 @@ void mips_function_profiler (FILE *file)
 #undef TARGET_TRAMPOLINE_INIT
 #define TARGET_TRAMPOLINE_INIT mips_trampoline_init
 
+#undef TARGET_ASM_OUTPUT_SOURCE_FILENAME
+#define TARGET_ASM_OUTPUT_SOURCE_FILENAME mips_output_filename
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 #include "gt-mips.h"
index a75cd578c216fe92c1d836d3c226af8dfbe5156f..ff36a90301a4c21d9209f7c904f1ad5a8f370b7a 100644 (file)
@@ -2666,9 +2666,6 @@ do                                                                        \
   }                                                                    \
 while (0)
 
-/* How to tell the debugger about changes of source files.  */
-#define ASM_OUTPUT_SOURCE_FILENAME mips_output_filename
-
 /* mips-tfile does not understand .stabd directives.  */
 #define DBX_OUTPUT_SOURCE_LINE(STREAM, LINE, COUNTER) do {     \
   dbxout_begin_stabn_sline (LINE);                             \
index 30210ecc0aeb295e48f9e6404f5a3cd7937c62ff..e94fdf6067e88fc4750b6e2b04cbfc8db2b553d5 100644 (file)
@@ -7262,6 +7262,12 @@ This macro need not be defined if the standard form of output
 for the file format in use is appropriate.
 @end defmac
 
+@deftypefn {Target Hook} void TARGET_ASM_OUTPUT_SOURCE_FILENAME (FILE *@var{file}, const char *@var{name})
+Output COFF information or DWARF debugging information which indicates that filename @var{name} is the current source file to the stdio stream @var{file}.
+ This target hook need not be defined if the standard form of output for the file format in use is appropriate.
+@end deftypefn
+
 @defmac OUTPUT_QUOTED_STRING (@var{stream}, @var{string})
 A C statement to output the string @var{string} to the stdio stream
 @var{stream}.  If you do not call the function @code{output_quoted_string}
index b5c75d3ec90fcd63ce5df78dba31b0560762a76b..caa0115c9d663bbcdb72f231648737410ac266e6 100644 (file)
@@ -7262,6 +7262,8 @@ This macro need not be defined if the standard form of output
 for the file format in use is appropriate.
 @end defmac
 
+@hook TARGET_ASM_OUTPUT_SOURCE_FILENAME
+
 @defmac OUTPUT_QUOTED_STRING (@var{stream}, @var{string})
 A C statement to output the string @var{string} to the stdio stream
 @var{stream}.  If you do not call the function @code{output_quoted_string}
index d1e5f245bf624a586b87232008832b2999a3339e..26e6268f6a5a452790be49254aae4358f4fa511b 100644 (file)
@@ -595,6 +595,9 @@ extern bool unlikely_text_section_p (section *);
 extern void switch_to_section (section *);
 extern void output_section_asm_op (const void *);
 
+extern void default_asm_output_source_filename (FILE *, const char *);
+extern void output_file_directive (FILE *, const char *);
+
 extern unsigned int default_section_type_flags (tree, const char *, int);
 
 extern bool have_global_bss_p (void);
index 583e78b48b6182c83c6a24c02bf8f96a5a52d4e8..01ab4782008a1242dc2e97d1543b9828043d1d40 100644 (file)
@@ -404,6 +404,17 @@ DEFHOOK
  void, (FILE *f),
  NULL)
 
+DEFHOOK
+(output_source_filename,
+ "Output COFF information or DWARF debugging information which indicates\
+ that filename @var{name} is the current source file to the stdio\
+ stream @var{file}.\n\
+ \n\
+ This target hook need not be defined if the standard form of output\
+ for the file format in use is appropriate.",
+ void ,(FILE *file, const char *name),
+ default_asm_output_source_filename)
+
 /* ??? The TARGET_PRINT_OPERAND* hooks are part of the asm_out struct,
    even though that is not reflected in the macro name to override their
    initializers.  */
index 964669fb61580db828771c5440792b888c050a57..740d8c067a0889e486ce8fb9bd66bd7c0d784046 100644 (file)
@@ -620,39 +620,6 @@ output_quoted_string (FILE *asm_file, const char *string)
 #endif
 }
 
-/* Output a file name in the form wanted by System V.  */
-
-void
-output_file_directive (FILE *asm_file, const char *input_name)
-{
-  int len;
-  const char *na;
-
-  if (input_name == NULL)
-    input_name = "<stdin>";
-  else
-    input_name = remap_debug_filename (input_name);
-
-  len = strlen (input_name);
-  na = input_name + len;
-
-  /* NA gets INPUT_NAME sans directory names.  */
-  while (na > input_name)
-    {
-      if (IS_DIR_SEPARATOR (na[-1]))
-       break;
-      na--;
-    }
-
-#ifdef ASM_OUTPUT_SOURCE_FILENAME
-  ASM_OUTPUT_SOURCE_FILENAME (asm_file, na);
-#else
-  fprintf (asm_file, "\t.file\t");
-  output_quoted_string (asm_file, na);
-  putc ('\n', asm_file);
-#endif
-}
-
 /* A subroutine of wrapup_global_declarations.  We've come to the end of
    the compilation unit.  All deferred variables should be undeferred,
    and all incomplete decls should be finalized.  */
index ae08c5579eda63568fa57659b7202663e165e1bf..44920ed7a009d3c6e5f49bafc292421652c6b2fb 100644 (file)
@@ -50,7 +50,6 @@ extern bool parse_optimize_options (tree, bool);
 
 #ifdef BUFSIZ
 extern void output_quoted_string       (FILE *, const char *);
-extern void output_file_directive      (FILE *, const char *);
 #endif
 
 extern void wrapup_global_declaration_1 (tree);
index 9a4c193e2e76bbfcdf1d10b8258c7687d8773397..f43f206e51231e49ab55598a112138bbb1f4fd47 100644 (file)
@@ -7247,6 +7247,47 @@ default_elf_asm_output_external (FILE *file ATTRIBUTE_UNUSED,
     maybe_assemble_visibility (decl);
 }
 
+/* The default hook for TARGET_ASM_OUTPUT_SOURCE_FILENAME.  */
+
+void
+default_asm_output_source_filename (FILE *file, const char *name)
+{
+#ifdef ASM_OUTPUT_SOURCE_FILENAME
+  ASM_OUTPUT_SOURCE_FILENAME (file, name);
+#else
+  fprintf (file, "\t.file\t");
+  output_quoted_string (file, name);
+  putc ('\n', file);
+#endif
+}
+
+/* Output a file name in the form wanted by System V.  */
+
+void
+output_file_directive (FILE *asm_file, const char *input_name)
+{
+  int len;
+  const char *na;
+
+  if (input_name == NULL)
+    input_name = "<stdin>";
+  else
+    input_name = remap_debug_filename (input_name);
+
+  len = strlen (input_name);
+  na = input_name + len;
+
+  /* NA gets INPUT_NAME sans directory names.  */
+  while (na > input_name)
+    {
+      if (IS_DIR_SEPARATOR (na[-1]))
+       break;
+      na--;
+    }
+
+  targetm.asm_out.output_source_filename (asm_file, na);
+}
+
 /* Create a DEBUG_EXPR_DECL / DEBUG_EXPR pair from RTL expression
    EXP.  */
 rtx