diff options
-rw-r--r-- | gcc/ChangeLog | 17 | ||||
-rw-r--r-- | gcc/config/mips/mips-protos.h | 1 | ||||
-rw-r--r-- | gcc/config/mips/mips.c | 7 | ||||
-rw-r--r-- | gcc/config/mips/mips.h | 3 | ||||
-rw-r--r-- | gcc/doc/tm.texi | 6 | ||||
-rw-r--r-- | gcc/doc/tm.texi.in | 2 | ||||
-rw-r--r-- | gcc/output.h | 3 | ||||
-rw-r--r-- | gcc/target.def | 11 | ||||
-rw-r--r-- | gcc/toplev.c | 33 | ||||
-rw-r--r-- | gcc/toplev.h | 1 | ||||
-rw-r--r-- | gcc/varasm.c | 41 |
11 files changed, 85 insertions, 40 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 93d0c7e..5eb1ae9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/config/mips/mips-protos.h b/gcc/config/mips/mips-protos.h index 70920fd..dd928e3 100644 --- a/gcc/config/mips/mips-protos.h +++ b/gcc/config/mips/mips-protos.h @@ -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, diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index c216297..0892c3e 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -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; #include "gt-mips.h" diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index a75cd57..ff36a90 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -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); \ diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 30210ec..e94fdf6 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -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} diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index b5c75d3..caa0115 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -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} diff --git a/gcc/output.h b/gcc/output.h index d1e5f24..26e6268 100644 --- a/gcc/output.h +++ b/gcc/output.h @@ -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); diff --git a/gcc/target.def b/gcc/target.def index 583e78b..01ab478 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -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. */ diff --git a/gcc/toplev.c b/gcc/toplev.c index 964669f..740d8c0 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -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. */ diff --git a/gcc/toplev.h b/gcc/toplev.h index ae08c55..44920ed 100644 --- a/gcc/toplev.h +++ b/gcc/toplev.h @@ -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); diff --git a/gcc/varasm.c b/gcc/varasm.c index 9a4c193..f43f206 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -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 |