diff options
author | Maxim Kuznetsov <maks.kuznetsov@gmail.com> | 2013-05-06 19:35:44 +0000 |
---|---|---|
committer | H.J. Lu <hjl@gcc.gnu.org> | 2013-05-06 12:35:44 -0700 |
commit | 382522cb0336edecbfa2ee6445cd43407ebc6776 (patch) | |
tree | 91d98365dcceef73b7eaefd2d77bfc60e3759698 /gcc/final.c | |
parent | fb0d5c60f5cbc3ef3689af7ecac566526e31ea14 (diff) | |
download | gcc-382522cb0336edecbfa2ee6445cd43407ebc6776.zip gcc-382522cb0336edecbfa2ee6445cd43407ebc6776.tar.gz gcc-382522cb0336edecbfa2ee6445cd43407ebc6776.tar.bz2 |
Support {, } and | in assembly output
gcc/
2013-05-06 Maxim Kuznetsov <maks.kuznetsov@gmail.com>
* final.c (do_assembler_dialects): Don't handle curly braces and
vertical bar escaped by % as dialect delimiters.
(output_asm_insn): Print curly braces and vertical bar if escaped
by % and ASSEMBLER_DIALECT defined.
* doc/tm.texi.in (ASSEMBLER_DIALECT): Document new standard escapes.
* doc/tm.texi: Regenerated.
gcc/testsuite/
2013-05-06 Maxim Kuznetsov <maks.kuznetsov@gmail.com>
* gcc.target/i386/asm-dialect-2.c: New testcase.
From-SVN: r198641
Diffstat (limited to 'gcc/final.c')
-rw-r--r-- | gcc/final.c | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/gcc/final.c b/gcc/final.c index f6974f4..c836e5d 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -3430,8 +3430,21 @@ do_assembler_dialects (const char *p, int *dialect) DIALECT_NUMBER of strings ending with '|'. */ for (i = 0; i < dialect_number; i++) { - while (*p && *p != '}' && *p++ != '|') - ; + while (*p && *p != '}') + { + if (*p == '|') + { + p++; + break; + } + + /* Skip over any character after a percent sign. */ + if (*p == '%') + p++; + if (*p) + p++; + } + if (*p == '}') break; } @@ -3452,8 +3465,19 @@ do_assembler_dialects (const char *p, int *dialect) output_operand_lossage ("unterminated assembly dialect alternative"); break; } + + /* Skip over any character after a percent sign. */ + if (*p == '%' && p[1]) + { + p += 2; + continue; + } + + if (*p++ == '}') + break; } - while (*p++ != '}'); + while (1); + *dialect = 0; } else @@ -3546,11 +3570,17 @@ output_asm_insn (const char *templ, rtx *operands) #endif case '%': - /* %% outputs a single %. */ - if (*p == '%') + /* %% outputs a single %. %{, %} and %| print {, } and | respectively + if ASSEMBLER_DIALECT defined and these characters have a special + meaning as dialect delimiters.*/ + if (*p == '%' +#ifdef ASSEMBLER_DIALECT + || *p == '{' || *p == '}' || *p == '|' +#endif + ) { + putc (*p, asm_out_file); p++; - putc (c, asm_out_file); } /* %= outputs a number which is unique to each insn in the entire compilation. This is useful for making local labels that are |