From 2ca3ace5aa841b86ed826a95f417172ba9af6774 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 4 Jan 2007 18:03:31 +0000 Subject: [PATCH 1/1] 2007-01-04 H.J. Lu PR gas/3826 * config/tc-i386.c (register_prefix): New. (set_intel_syntax): Set set_intel_syntax to "" if register prefix is needed. (check_byte_reg): Use register_prefix for error message. (check_long_reg): Likewise. (check_qword_reg): Likewise. (check_word_reg): Likewise. --- gas/ChangeLog | 15 +++++++++++++++ gas/config/tc-i386.c | 31 ++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 5c65646..096ed25 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,14 @@ +2007-01-04 H.J. Lu + + PR gas/3826 + * config/tc-i386.c (register_prefix): New. + (set_intel_syntax): Set set_intel_syntax to "" if register + prefix is needed. + (check_byte_reg): Use register_prefix for error message. + (check_long_reg): Likewise. + (check_qword_reg): Likewise. + (check_word_reg): Likewise. + 2006-01-04 Julian Brown * config/tc-arm.c (do_neon_shl_imm): Swap rN, rM. @@ -13,6 +24,10 @@ 2007-01-03 H.J. Lu + * config/tc-i386.c (swap_operands): Remove branches. + +2007-01-03 H.J. Lu + * config/tc-i386.c: Update copyright year. * config/tc-i386.h: Likewise. diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 6cfb04f..67bd39e 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -291,6 +291,9 @@ static int intel_syntax = 0; /* 1 if register prefix % not required. */ static int allow_naked_reg = 0; +/* Register prefix used for error message. */ +static const char *register_prefix = "%"; + /* Used in 16 bit gcc mode to add an l suffix to call, ret, enter, leave, push, and pop instructions so that gcc has the same stack frame as in 32 bit mode. */ @@ -1102,7 +1105,13 @@ set_intel_syntax (int syntax_flag) else allow_naked_reg = (ask_naked_reg < 0); - identifier_chars['%'] = intel_syntax && allow_naked_reg ? '%' : 0; + if (intel_syntax && allow_naked_reg) + { + identifier_chars['%'] = '%'; + register_prefix = ""; + } + else + identifier_chars['%'] = 0; identifier_chars['$'] = intel_syntax ? '$' : 0; } @@ -3028,8 +3037,8 @@ check_byte_reg (void) if (flag_code == CODE_64BIT && (i.tm.operand_types[op] & InOutPortReg) == 0) { - as_bad (_("Incorrect register `%%%s' used with `%c' suffix"), - i.op[op].regs->reg_name, + as_bad (_("Incorrect register `%s%s' used with `%c' suffix"), + register_prefix, i.op[op].regs->reg_name, i.suffix); return 0; } @@ -3087,8 +3096,8 @@ check_long_reg (void) lowering is more complicated. */ if (flag_code == CODE_64BIT) { - as_bad (_("Incorrect register `%%%s' used with `%c' suffix"), - i.op[op].regs->reg_name, + as_bad (_("Incorrect register `%s%s' used with `%c' suffix"), + register_prefix, i.op[op].regs->reg_name, i.suffix); return 0; } @@ -3104,8 +3113,8 @@ check_long_reg (void) else if ((i.types[op] & Reg64) != 0 && (i.tm.operand_types[op] & (Reg32 | Acc)) != 0) { - as_bad (_("Incorrect register `%%%s' used with `%c' suffix"), - i.op[op].regs->reg_name, + as_bad (_("Incorrect register `%s%s' used with `%c' suffix"), + register_prefix, i.op[op].regs->reg_name, i.suffix); return 0; } @@ -3136,8 +3145,8 @@ check_qword_reg (void) { /* Prohibit these changes in the 64bit mode, since the lowering is more complicated. */ - as_bad (_("Incorrect register `%%%s' used with `%c' suffix"), - i.op[op].regs->reg_name, + as_bad (_("Incorrect register `%s%s' used with `%c' suffix"), + register_prefix, i.op[op].regs->reg_name, i.suffix); return 0; } @@ -3169,8 +3178,8 @@ check_word_reg (void) lowering is more complicated. */ if (flag_code == CODE_64BIT) { - as_bad (_("Incorrect register `%%%s' used with `%c' suffix"), - i.op[op].regs->reg_name, + as_bad (_("Incorrect register `%s%s' used with `%c' suffix"), + register_prefix, i.op[op].regs->reg_name, i.suffix); return 0; } -- 2.7.4