mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-07-01 18:32:32 +08:00
* config/bfin-parse.y (binary): Do some more constant folding for
additions.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2006-09-15 Bernd Schmidt <bernd.schmidt@analog.com>
|
||||||
|
|
||||||
|
* config/bfin-parse.y (binary): Do some more constant folding for
|
||||||
|
additions.
|
||||||
|
|
||||||
2006-09-13 Jan Beulich <jbeulich@novell.com>
|
2006-09-13 Jan Beulich <jbeulich@novell.com>
|
||||||
|
|
||||||
* input-file.c (input_file_give_next_buffer): Demote as_bad to
|
* input-file.c (input_file_give_next_buffer): Demote as_bad to
|
||||||
|
@ -4270,6 +4270,8 @@ value_match (Expr_Node *expr, int sz, int sign, int mul, int issigned)
|
|||||||
static Expr_Node *
|
static Expr_Node *
|
||||||
binary (Expr_Op_Type op, Expr_Node *x, Expr_Node *y)
|
binary (Expr_Op_Type op, Expr_Node *x, Expr_Node *y)
|
||||||
{
|
{
|
||||||
|
Expr_Node_Value val;
|
||||||
|
|
||||||
if (x->type == Expr_Node_Constant && y->type == Expr_Node_Constant)
|
if (x->type == Expr_Node_Constant && y->type == Expr_Node_Constant)
|
||||||
{
|
{
|
||||||
switch (op)
|
switch (op)
|
||||||
@ -4319,14 +4321,27 @@ binary (Expr_Op_Type op, Expr_Node *x, Expr_Node *y)
|
|||||||
}
|
}
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
else
|
/* Canonicalize order to EXPR OP CONSTANT. */
|
||||||
|
if (x->type == Expr_Node_Constant)
|
||||||
{
|
{
|
||||||
|
Expr_Node *t = x;
|
||||||
|
x = y;
|
||||||
|
y = t;
|
||||||
|
}
|
||||||
|
if (y->type == Expr_Node_Constant && x->type == Expr_Node_Binop
|
||||||
|
&& x->Right_Child->type == Expr_Node_Constant)
|
||||||
|
{
|
||||||
|
if (op == x->value.op_value && x->value.op_value == Expr_Op_Type_Add)
|
||||||
|
{
|
||||||
|
x->Right_Child->value.i_value += y->value.i_value;
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Create a new expression structure. */
|
/* Create a new expression structure. */
|
||||||
Expr_Node_Value val;
|
|
||||||
val.op_value = op;
|
val.op_value = op;
|
||||||
return Expr_Node_Create (Expr_Node_Binop, val, x, y);
|
return Expr_Node_Create (Expr_Node_Binop, val, x, y);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static Expr_Node *
|
static Expr_Node *
|
||||||
unary (Expr_Op_Type op, Expr_Node *x)
|
unary (Expr_Op_Type op, Expr_Node *x)
|
||||||
|
Reference in New Issue
Block a user