diff options
author | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-10-20 11:30:07 +0000 |
---|---|---|
committer | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-10-20 11:30:07 +0000 |
commit | 0f3163d6f13909e41e001f75257b9a27327b4d4d (patch) | |
tree | dd256731b7f84f35ca5f5cdb17b1f48ff8cc8765 /gcc | |
parent | aaaca12287faaf58738ab5f9baeef9b1b3eb3e55 (diff) | |
download | gcc-0f3163d6f13909e41e001f75257b9a27327b4d4d.tar.gz |
* final.c (output_asm_operand_names): New fcn, from output_asm_insn.
(output_asm_insn): Call it for each line output.
Don't record an operand more than once.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46377 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/final.c | 66 |
2 files changed, 48 insertions, 22 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8c1094ac329..1368558f054 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ Sat Oct 20 07:27:14 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> + * final.c (output_asm_operand_names): New fcn, from output_asm_insn. + (output_asm_insn): Call it for each line output. + Don't record an operand more than once. + * toplev.h (struct lang_hooks): HONOR_READONLY now bool. * main.c: Include config.h and system.h, but not ansidecl.h. * Makefile.in (main.o): Update accordingly. diff --git a/gcc/final.c b/gcc/final.c index 33d2ff68f26..ae3e47323b9 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -245,6 +245,7 @@ static void notice_source_line PARAMS ((rtx)); static rtx walk_alter_subreg PARAMS ((rtx)); static void output_asm_name PARAMS ((void)); static tree get_decl_from_op PARAMS ((rtx, int *)); +static void output_asm_operand_names PARAMS ((rtx *, int *, int)); static void output_operand PARAMS ((rtx, int)); #ifdef LEAF_REGISTERS static void leaf_renumber_regs PARAMS ((rtx)); @@ -3332,6 +3333,34 @@ get_decl_from_op (op, paddressp) return inner_addressp ? 0 : decl; } +/* Output operand names for assembler instructions. OPERANDS is the + operand vector, OPORDER is the order to write the operands, and NOPS + is the number of operands to write. */ + +static void +output_asm_operand_names (operands, oporder, nops) + rtx *operands; + int *oporder; + int nops; +{ + int wrote = 0; + int i; + + for (i = 0; i < nops; i++) + { + int addressp; + tree decl = get_decl_from_op (operands[oporder[i]], &addressp); + + if (decl && DECL_NAME (decl)) + { + fprintf (asm_out_file, "%s %s%s", + wrote ? "," : ASM_COMMENT_START, addressp ? "*" : "", + IDENTIFIER_POINTER (DECL_NAME (decl))); + wrote = 1; + } + } +} + /* Output text from TEMPLATE to the assembler output file, obeying %-directions to substitute operands taken from the vector OPERANDS. @@ -3359,6 +3388,7 @@ output_asm_insn (template, operands) int dialect = 0; #endif int oporder[MAX_RECOG_OPERANDS]; + char opoutput[MAX_RECOG_OPERANDS]; int ops = 0; /* An insn may return a null string template @@ -3366,6 +3396,7 @@ output_asm_insn (template, operands) if (*template == 0) return; + memset (opoutput, 0, sizeof opoutput); p = template; putc ('\t', asm_out_file); @@ -3377,9 +3408,14 @@ output_asm_insn (template, operands) switch (c) { case '\n': + if (flag_verbose_asm) + output_asm_operand_names (operands, oporder, ops); if (flag_print_asm_name) output_asm_name (); + ops = 0; + memset (opoutput, 0, sizeof opoutput); + putc (c, asm_out_file); #ifdef ASM_OUTPUT_OPCODE while ((c = *p) == '\t') @@ -3499,7 +3535,9 @@ output_asm_insn (template, operands) else output_operand (operands[c], letter); - oporder[ops++] = c; + if (!opoutput[c]) + oporder[ops++] = c; + opoutput[c] = 1; while ((c = *p) >= '0' && c <= '9') p++; @@ -3514,7 +3552,10 @@ output_asm_insn (template, operands) else output_operand (operands[c], 0); - oporder[ops++] = c; + if (!opoutput[c]) + oporder[ops++] = c; + opoutput[c] = 1; + while ((c = *p) >= '0' && c <= '9') p++; } @@ -3535,26 +3576,7 @@ output_asm_insn (template, operands) /* Write out the variable names for operands, if we know them. */ if (flag_verbose_asm) - { - int wrote = 0; - int i; - - for (i = 0; i < ops; i++) - { - int addressp; - tree decl = get_decl_from_op (operands[oporder[i]], &addressp); - - if (decl && DECL_NAME (decl)) - { - fprintf (asm_out_file, "%s %s%s", - wrote ? "," : ASM_COMMENT_START, - addressp ? "*" : "", - IDENTIFIER_POINTER (DECL_NAME (decl))); - wrote = 1; - } - } - } - + output_asm_operand_names (operands, oporder, ops); if (flag_print_asm_name) output_asm_name (); |