This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Blackfin gas patch for constant folding


I've installed this patch, which lets the Blackfin assembler fold constant expressions of the form ((sym + const) + const).


Bernd
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gas/ChangeLog,v
retrieving revision 1.3003
diff -c -p -r1.3003 ChangeLog
*** ChangeLog	13 Sep 2006 10:15:59 -0000	1.3003
--- ChangeLog	15 Sep 2006 17:02:04 -0000
***************
*** 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>
  
  	* input-file.c (input_file_give_next_buffer): Demote as_bad to
Index: config/bfin-parse.y
===================================================================
RCS file: /cvs/src/src/gas/config/bfin-parse.y,v
retrieving revision 1.9
diff -c -p -r1.9 bfin-parse.y
*** config/bfin-parse.y	7 Jun 2006 11:27:57 -0000	1.9
--- config/bfin-parse.y	15 Sep 2006 17:02:05 -0000
*************** value_match (Expr_Node *expr, int sz, in
*** 4270,4275 ****
--- 4270,4277 ----
  static Expr_Node *
  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)
      {
        switch (op)
*************** binary (Expr_Op_Type op, Expr_Node *x, E
*** 4319,4331 ****
  	}
        return x;
      }
!   else
      {
!     /* Create a new expression structure.  */
!     Expr_Node_Value val;
!     val.op_value = op;
!     return Expr_Node_Create (Expr_Node_Binop, val, x, y);
!   }
  }
  
  static Expr_Node *
--- 4321,4346 ----
  	}
        return x;
      }
!   /* 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.  */
!   val.op_value = op;
!   return Expr_Node_Create (Expr_Node_Binop, val, x, y);
  }
  
  static Expr_Node *

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]