From ec1895c1f3567ada2256a82282f5cbf109e63e51 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Sun, 30 Jul 2017 10:51:37 +0200 Subject: [PATCH] i386.h (ASM_PRINTF_EXTENSIONS): New macro. * config/i386/i386.h (ASM_PRINTF_EXTENSIONS): New macro. (ASM_OUTPUT_REG_PUSH): Rewrite with new operand modifiers. (ASM_OUTPUT_REG_POP): Ditto. * config/i386/i386.c (ix86_asm_output_function_label): Use fputs instead of asm_fprintf to output pure string. From-SVN: r250720 --- gcc/ChangeLog | 8 ++++++++ gcc/config/i386/i386.c | 7 +++---- gcc/config/i386/i386.h | 44 +++++++++++++++++++++++------------------- 3 files changed, 35 insertions(+), 24 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ad347ad9754..300857938d1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2017-07-30 Uros Bizjak + + * config/i386/i386.h (ASM_PRINTF_EXTENSIONS): New macro. + (ASM_OUTPUT_REG_PUSH): Rewrite with new operand modifiers. + (ASM_OUTPUT_REG_POP): Ditto. + * config/i386/i386.c (ix86_asm_output_function_label): Use fputs + instead of asm_fprintf to output pure string. + 2017-07-29 Jakub Jelinek * debug.h (struct gcc_debug_hooks): Add IMPLICIT argument diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index f1486ff3750..c0213a66ae0 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -8777,16 +8777,15 @@ ix86_asm_output_function_label (FILE *asm_out_file, const char *fname, if (TARGET_64BIT) { /* leaq [%rsp + 0], %rsp */ - asm_fprintf (asm_out_file, ASM_BYTE - "0x48, 0x8d, 0xa4, 0x24, 0x00, 0x00, 0x00, 0x00\n"); + fputs (ASM_BYTE "0x48, 0x8d, 0xa4, 0x24, 0x00, 0x00, 0x00, 0x00\n", + asm_out_file); } else { /* movl.s %edi, %edi push %ebp movl.s %esp, %ebp */ - asm_fprintf (asm_out_file, ASM_BYTE - "0x8b, 0xff, 0x55, 0x8b, 0xec\n"); + fputs (ASM_BYTE "0x8b, 0xff, 0x55, 0x8b, 0xec\n", asm_out_file); } } } diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 682745ae06b..61501dc8c0b 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2196,29 +2196,33 @@ extern int const svr4_dbx_register_map[FIRST_PSEUDO_REGISTER]; #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \ asm_preferred_eh_data_format ((CODE), (GLOBAL)) -/* This is how to output an insn to push a register on the stack. - It need not be very fast code. */ - -#define ASM_OUTPUT_REG_PUSH(FILE, REGNO) \ -do { \ - if (TARGET_64BIT) \ - asm_fprintf ((FILE), "\tpush{q}\t%%r%s\n", \ - reg_names[(REGNO)] + (REX_INT_REGNO_P (REGNO) != 0)); \ - else \ - asm_fprintf ((FILE), "\tpush{l}\t%%e%s\n", reg_names[(REGNO)]); \ -} while (0) +/* These are a couple of extensions to the formats accepted + by asm_fprintf: + %z prints out opcode suffix for word-mode instruction + %r prints out word-mode name for reg_names[arg] */ +#define ASM_FPRINTF_EXTENSIONS(FILE, ARGS, P) \ + case 'z': \ + fputc (TARGET_64BIT ? 'q' : 'l', (FILE)); \ + break; \ + \ + case 'r': \ + { \ + unsigned int regno = va_arg ((ARGS), int); \ + if (LEGACY_INT_REGNO_P (regno)) \ + fputc (TARGET_64BIT ? 'r' : 'e', (FILE)); \ + fputs (reg_names[regno], (FILE)); \ + break; \ + } + +/* This is how to output an insn to push a register on the stack. */ -/* This is how to output an insn to pop a register from the stack. - It need not be very fast code. */ +#define ASM_OUTPUT_REG_PUSH(FILE, REGNO) \ + asm_fprintf ((FILE), "\tpush%z\t%%%r\n", (REGNO)) + +/* This is how to output an insn to pop a register from the stack. */ #define ASM_OUTPUT_REG_POP(FILE, REGNO) \ -do { \ - if (TARGET_64BIT) \ - asm_fprintf ((FILE), "\tpop{q}\t%%r%s\n", \ - reg_names[(REGNO)] + (REX_INT_REGNO_P (REGNO) != 0)); \ - else \ - asm_fprintf ((FILE), "\tpop{l}\t%%e%s\n", reg_names[(REGNO)]); \ -} while (0) + asm_fprintf ((FILE), "\tpop%z\t%%%r\n", (REGNO)) /* This is how to output an element of a case-vector that is absolute. */ -- 2.30.2