aboutsummaryrefslogtreecommitdiff
path: root/gas/expr.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2007-09-26 08:34:24 +0000
committerJan Beulich <jbeulich@novell.com>2007-09-26 08:34:24 +0000
commit5a918ce730bca784591cef4b3696269510c5f814 (patch)
tree2ce8a511b710ee981a26018c12295ae8455f00f0 /gas/expr.c
parent06dcabb0579335e3db3825385d41de58e529c7c0 (diff)
downloadgdb-5a918ce730bca784591cef4b3696269510c5f814.zip
gdb-5a918ce730bca784591cef4b3696269510c5f814.tar.gz
gdb-5a918ce730bca784591cef4b3696269510c5f814.tar.bz2
gas/
2007-09-26 Jan Beulich <jbeulich@novell.com> * 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.
Diffstat (limited to 'gas/expr.c')
-rw-r--r--gas/expr.c16
1 files changed, 12 insertions, 4 deletions
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;