Commit d5c724c4 by Richard Kenner

(dialect_number): New variable.

(init_final): Initialize it.
(output_asm_insn, asm_fprintf): Support ASSEMBLER_DIALECT.

From-SVN: r5744
parent bfe3c361
/* Convert RTL to assembler code and output it, for GNU compiler.
Copyright (C) 1987, 1988, 1989, 1992 Free Software Foundation, Inc.
Copyright (C) 1987, 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
This file is part of GNU CC.
......@@ -241,6 +241,12 @@ static int app_on;
rtx final_sequence;
#ifdef ASSEMBLER_DIALECT
/* Number of the assembler dialect to use, starting at 0. */
static int dialect_number;
#endif
/* Indexed by line number, nonzero if there is a note for that line. */
static char *line_note_exists;
......@@ -287,6 +293,10 @@ init_final (filename)
max_block_depth = 20;
pending_blocks = (int *) xmalloc (20 * sizeof *pending_blocks);
final_sequence = 0;
#ifdef ASSEMBLER_DIALECT
dialect_number = ASSEMBLER_DIALECT;
#endif
}
/* Called at end of source file,
......@@ -2298,7 +2308,7 @@ output_asm_insn (template, operands)
rtx *operands;
{
register char *p;
register int c;
register int c, i;
/* An insn may return a null string template
in a case where no assembler code is needed. */
......@@ -2313,10 +2323,10 @@ output_asm_insn (template, operands)
#endif
while (c = *p++)
switch (c)
{
#ifdef ASM_OUTPUT_OPCODE
if (c == '\n')
{
case '\n':
putc (c, asm_out_file);
while ((c = *p) == '\t')
{
......@@ -2324,13 +2334,34 @@ output_asm_insn (template, operands)
p++;
}
ASM_OUTPUT_OPCODE (asm_out_file, p);
}
else
break;
#endif
if (c != '%')
putc (c, asm_out_file);
else
#ifdef ASSEMBLER_DIALECT
case '{':
/* If we want the first dialect, do nothing. Otherwise, skip
DIALECT_NUMBER of strings ending with '|'. */
for (i = 0; i < dialect_number; i++)
{
while (*p && *p++ != '|')
;
if (*p == '|')
p++;
}
break;
case '|':
/* Skip to close brace. */
while (*p && *p++ != '}')
;
break;
case '}':
break;
#endif
case '%':
/* %% outputs a single %. */
if (*p == '%')
{
......@@ -2411,7 +2442,10 @@ output_asm_insn (template, operands)
#endif
else
output_operand_lossage ("invalid %%-code");
}
break;
default:
putc (c, asm_out_file);
}
if (flag_print_asm_name)
......@@ -2640,7 +2674,9 @@ output_addr_const (file, x)
%U prints the value of USER_LABEL_PREFIX.
%I prints the value of IMMEDIATE_PREFIX.
%O runs ASM_OUTPUT_OPCODE to transform what follows in the string.
Also supported are %d, %x, %s, %e, %f, %g and %%. */
Also supported are %d, %x, %s, %e, %f, %g and %%.
We handle alternate assembler dialects here, just like output_asm_insn. */
void
asm_fprintf (va_alist)
......@@ -2650,6 +2686,7 @@ asm_fprintf (va_alist)
FILE *file;
char buf[10];
char *p, *q, c;
int i;
va_start (argptr);
......@@ -2660,6 +2697,30 @@ asm_fprintf (va_alist)
while (c = *p++)
switch (c)
{
#ifdef ASSEMBLER_DIALECT
case '{':
/* If we want the first dialect, do nothing. Otherwise, skip
DIALECT_NUMBER of strings ending with '|'. */
for (i = 0; i < dialect_number; i++)
{
while (*p && *p++ != '|')
;
if (*p == '|')
p++;
}
break;
case '|':
/* Skip to close brace. */
while (*p && *p++ != '}')
;
break;
case '}':
break;
#endif
case '%':
c = *p++;
q = &buf[1];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment