gas: blackfin: support numeric local labels with LOOP_BEGIN/LOOP_END pseudo insns
authorMike Frysinger <vapier@gentoo.org>
Mon, 11 Oct 2010 08:36:30 +0000 (08:36 +0000)
committerMike Frysinger <vapier@gentoo.org>
Mon, 11 Oct 2010 08:36:30 +0000 (08:36 +0000)
The current LOOP_BEGIN/LOOP_END pseudo insns hit parser errors when trying
to use numeric local labels.  So add support for them.

Signed-off-by: David Gibson <david.gibson@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
gas/ChangeLog
gas/config/bfin-aux.h
gas/config/bfin-parse.y
gas/config/tc-bfin.c

index 66853b9c3b53e0eb9d85c8e895aa685d58583842..ef213458ded3161f020211b4a9e9709458f757b6 100644 (file)
@@ -1,3 +1,9 @@
+2010-09-11  David Gibson  <david.gibson@analog.com>
+
+       * config/bfin-aux.h (bfin_loop_attempt_create_label): New prototype.
+       * config/bfin-parse.y (LOOP_BEGIN, LOOP_END): Handle numeric labels.
+       * config/tc-bfin.c (bfin_loop_attempt_create_label): New funtion.
+
 2010-09-11  David Gibson  <david.gibson@analog.com>
 
        * config/tc-bfin.c (bfin_gen_loop): Check symbol before removing.
index 465a6afc68d6f1567b5b6bf1fce313c27617ca52..e78a4e841cf03886774665dd4c5843752efc2155 100755 (executable)
@@ -56,6 +56,7 @@ INSTR_T bfin_gen_cactrl (REG_T, int, int);
 INSTR_T bfin_gen_progctrl (int, int);
 INSTR_T bfin_gen_loopsetup (Expr_Node *, REG_T, int, Expr_Node *, REG_T);
 INSTR_T bfin_gen_loop (Expr_Node *, REG_T, int, REG_T);
+void bfin_loop_attempt_create_label (Expr_Node *, int);
 void bfin_loop_beginend (Expr_Node *, int);
 INSTR_T bfin_gen_pushpopmultiple (int, int, int, int, int);
 INSTR_T bfin_gen_pushpopreg (REG_T, int);
index 81640aa926caa2cfb5600ba6900e3e8e9524b9c0..c34e84c2100b4c6fe2814d9799e237fe427aada2 100644 (file)
@@ -3573,6 +3573,17 @@ asm_1:
        }
 
 /* LOOP_BEGIN.  */
+       | LOOP_BEGIN NUMBER
+       {
+         Expr_Node_Value val;
+         val.i_value = $2;
+         Expr_Node *tmp = Expr_Node_Create (Expr_Node_Constant, val, NULL, NULL);
+         bfin_loop_attempt_create_label (tmp, 1);
+         if (!IS_RELOC (tmp))
+           return yyerror ("Invalid expression in LOOP_BEGIN statement");
+         bfin_loop_beginend (tmp, 1);
+         $$ = 0;
+       }
        | LOOP_BEGIN expr
        {
          if (!IS_RELOC ($2))
@@ -3583,6 +3594,17 @@ asm_1:
        }
 
 /* LOOP_END.  */
+       | LOOP_END NUMBER
+       {
+         Expr_Node_Value val;
+         val.i_value = $2;
+         Expr_Node *tmp = Expr_Node_Create (Expr_Node_Constant, val, NULL, NULL);
+         bfin_loop_attempt_create_label (tmp, 1);
+         if (!IS_RELOC (tmp))
+           return yyerror ("Invalid expression in LOOP_END statement");
+         bfin_loop_beginend (tmp, 0);
+         $$ = 0;
+       }
        | LOOP_END expr
        {
          if (!IS_RELOC ($2))
index e854dce059e281da905402cab94f9c8178e6912f..3efc4b67a0a9e192dc34578d04a6d132c99f16fe 100644 (file)
@@ -1904,6 +1904,15 @@ bfin_gen_loop (Expr_Node *exp, REG_T reg, int rop, REG_T preg)
   return bfin_gen_loopsetup (lbegin, reg, rop, lend, preg);
 }
 
+void
+bfin_loop_attempt_create_label (Expr_Node *exp, int is_begin)
+{
+  char *name;
+  name = fb_label_name (exp->value.i_value, is_begin);
+  exp->value.s_value = xstrdup (name);
+  exp->type = Expr_Node_Reloc;
+}
+
 void
 bfin_loop_beginend (Expr_Node *exp, int begin)
 {
This page took 0.045461 seconds and 4 git commands to generate.