target.def (output_source_filename): New hook.
* 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
This commit is contained in:
parent
114e33e1e6
commit
b5f5d41d1a
11 changed files with 85 additions and 40 deletions
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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); \
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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. */
|
||||
|
|
33
gcc/toplev.c
33
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. */
|
||||
|
|
|
@ -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);
|
||||
|
|
41
gcc/varasm.c
41
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
|
||||
|
|
Loading…
Add table
Reference in a new issue