From 5a918ce730bca784591cef4b3696269510c5f814 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Wed, 26 Sep 2007 08:34:24 +0000 Subject: gas/ 2007-09-26 Jan Beulich * config/tc-i386.h (md_register_arithmetic): Define. * config/tc-ia64.h (md_register_arithmetic): Likewise. * doc/internals.texi: Document md_register_arithmetic. * expr.c (make_expr_symbol): Force O_register expressions into reg_section. (expr): Provide default for md_register_arithmetic. Don't resolve adding/subtracting constants to/from registers if md_register_arithmetic is zero. --- gas/expr.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'gas/expr.c') diff --git a/gas/expr.c b/gas/expr.c index b883285..4f4d380 100644 --- a/gas/expr.c +++ b/gas/expr.c @@ -95,7 +95,9 @@ make_expr_symbol (expressionS *expressionP) symbolP = symbol_create (FAKE_LABEL_NAME, (expressionP->X_op == O_constant ? absolute_section - : expr_section), + : expressionP->X_op == O_register + ? reg_section + : expr_section), 0, &zero_address_frag); symbol_set_value_expression (symbolP, expressionP); @@ -1722,7 +1724,11 @@ expr (int rankarg, /* Larger # is higher rank. */ } else #endif - if (op_left == O_add && right.X_op == O_constant) +#ifndef md_register_arithmetic +# define md_register_arithmetic 1 +#endif + if (op_left == O_add && right.X_op == O_constant + && (md_register_arithmetic || resultP->X_op != O_register)) { /* X + constant. */ resultP->X_add_number += right.X_add_number; @@ -1745,12 +1751,14 @@ expr (int rankarg, /* Larger # is higher rank. */ resultP->X_op = O_constant; resultP->X_add_symbol = 0; } - else if (op_left == O_subtract && right.X_op == O_constant) + else if (op_left == O_subtract && right.X_op == O_constant + && (md_register_arithmetic || resultP->X_op != O_register)) { /* X - constant. */ resultP->X_add_number -= right.X_add_number; } - else if (op_left == O_add && resultP->X_op == O_constant) + else if (op_left == O_add && resultP->X_op == O_constant + && (md_register_arithmetic || right.X_op != O_register)) { /* Constant + X. */ resultP->X_op = right.X_op; -- cgit v1.1