diff options
author | aoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-03-09 07:36:43 +0000 |
---|---|---|
committer | aoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-03-09 07:36:43 +0000 |
commit | 09fb10e8536409ff71e3580d00064a9ca99bc3a8 (patch) | |
tree | 48b68219ea2954e8bd644e2a8f092df8fd7a9b90 /gcc/final.c | |
parent | 58d16c5f65a4e27ed9c17f0dd1135a6d9d941bfd (diff) | |
download | gcc-09fb10e8536409ff71e3580d00064a9ca99bc3a8.tar.gz |
* rtl.def (ASM_INPUT): Add location.
* rtl.h (ASM_INPUT_SOURCE_LOCATION): New.
(ASM_INPUT_SOURCE_FILE, ASM_INPUT_SOURCE_LINE): New.
(decode_asm_operands): Add loc operand.
(gen_rtx_ASM_INPUT, gen_rtx_ASM_INPUT_loc): Define.
* stmt.c (expand_asm): Rename to...
(expand_asm_loc): ... this. Add locus argument. Pass it on to
gen_rtx_ASM_INPUT_loc.
(expand_asm_expr): Adjust.
* recog.c (decode_asm_operands): Add loc operand.
(check_asm_operands, extract_insn): Adjust.
* reload1.c (maybe_fix_stack_asms): Likewise.
* final.c (asm_insn_count): Likewise.
(final_scan_insn): Output # line before and after asm.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122742 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/final.c')
-rw-r--r-- | gcc/final.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/gcc/final.c b/gcc/final.c index bd96444ea48..d7d1dafe2a4 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -1,6 +1,6 @@ /* Convert RTL to assembler code and output it, for GNU compiler. Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, - 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of GCC. @@ -1357,7 +1357,7 @@ asm_insn_count (rtx body) if (GET_CODE (body) == ASM_INPUT) template = XSTR (body, 0); else - template = decode_asm_operands (body, NULL, NULL, NULL, NULL); + template = decode_asm_operands (body, NULL, NULL, NULL, NULL, NULL); for (; *template; template++) if (IS_ASM_LOGICAL_LINE_SEPARATOR (*template) || *template == '\n') @@ -2068,12 +2068,25 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED, if (string[0]) { + location_t loc; + if (! app_on) { fputs (ASM_APP_ON, file); app_on = 1; } +#ifdef USE_MAPPED_LOCATION + loc = ASM_INPUT_SOURCE_LOCATION (body); +#else + loc.file = ASM_INPUT_SOURCE_FILE (body); + loc.line = ASM_INPUT_SOURCE_LINE (body); +#endif + if (loc.file && loc.line) + fprintf (asm_out_file, "%s %i \"%s\" 1\n", + ASM_COMMENT_START, loc.line, loc.file); fprintf (asm_out_file, "\t%s\n", string); + if (loc.file && loc.line) + fprintf (asm_out_file, "%s 0 \"\" 2\n", ASM_COMMENT_START); } break; } @@ -2084,12 +2097,13 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED, unsigned int noperands = asm_noperands (body); rtx *ops = alloca (noperands * sizeof (rtx)); const char *string; + location_t loc; /* There's no telling what that did to the condition codes. */ CC_STATUS_INIT; /* Get out the operand values. */ - string = decode_asm_operands (body, ops, NULL, NULL, NULL); + string = decode_asm_operands (body, ops, NULL, NULL, NULL, &loc); /* Inhibit dieing on what would otherwise be compiler bugs. */ insn_noperands = noperands; this_is_asm_operands = insn; @@ -2106,7 +2120,12 @@ final_scan_insn (rtx insn, FILE *file, int optimize ATTRIBUTE_UNUSED, fputs (ASM_APP_ON, file); app_on = 1; } + if (loc.file && loc.line) + fprintf (asm_out_file, "%s %i \"%s\" 1\n", + ASM_COMMENT_START, loc.line, loc.file); output_asm_insn (string, ops); + if (loc.file && loc.line) + fprintf (asm_out_file, "%s 0 \"\" 2\n", ASM_COMMENT_START); } this_is_asm_operands = 0; |