diff options
author | Jie Zhang <jie.zhang@analog.com> | 2009-09-03 15:36:02 +0000 |
---|---|---|
committer | Jie Zhang <jie.zhang@analog.com> | 2009-09-03 15:36:02 +0000 |
commit | d3a50e14198b40513ff5cebd62b8161bba9223fa (patch) | |
tree | 3630efb811c205daedd2bcb566d1eab49a81724e /gas/config/tc-bfin.c | |
parent | fcbc2f09401545b9b5a8fc09d421a90377c6aa79 (diff) | |
download | gdb-d3a50e14198b40513ff5cebd62b8161bba9223fa.zip gdb-d3a50e14198b40513ff5cebd62b8161bba9223fa.tar.gz gdb-d3a50e14198b40513ff5cebd62b8161bba9223fa.tar.bz2 |
* config/bfin-parse.y (asm_1): Add LOOP_BEGIN and LOOP_END.
* config/tc-bfin.c (bfin_start_line_hook): Remove.
(bfin_loop_beginend): New.
* config/tc-bfin.h (bfin_start_line_hook): Don't declare.
(md_start_line_hook): Don't define.
* config/bfin-aux.h (bfin_loop_beginend): Declare.
testsuite/
* gas/bfin/loop.s, gas/bfin/loop.d: New test.
* gas/bfin/loop2.s, gas/bfin/loop2.d: New test.
* gas/bfin/loop3.s, gas/bfin/loop3.d: New test.
* gas/bfin/bfin.exp: Add the new tests.
Diffstat (limited to 'gas/config/tc-bfin.c')
-rw-r--r-- | gas/config/tc-bfin.c | 142 |
1 files changed, 25 insertions, 117 deletions
diff --git a/gas/config/tc-bfin.c b/gas/config/tc-bfin.c index 58b7ed1..958f63d 100644 --- a/gas/config/tc-bfin.c +++ b/gas/config/tc-bfin.c @@ -1016,123 +1016,6 @@ bfin_fix_adjustable (fixS *fixP) } } - -/* Handle the LOOP_BEGIN and LOOP_END statements. - Parse the Loop_Begin/Loop_End and create a label. */ -void -bfin_start_line_hook () -{ - bfd_boolean maybe_begin = FALSE; - bfd_boolean maybe_end = FALSE; - - char *c1, *label_name; - symbolS *line_label; - char *c = input_line_pointer; - int cr_num = 0; - - while (ISSPACE (*c)) - { - if (*c == '\n') - cr_num++; - c++; - } - - /* Look for Loop_Begin or Loop_End statements. */ - - if (*c != 'L' && *c != 'l') - return; - - c++; - if (*c != 'O' && *c != 'o') - return; - - c++; - if (*c != 'O' && *c != 'o') - return; - - c++; - if (*c != 'P' && *c != 'p') - return; - - c++; - if (*c != '_') - return; - - c++; - if (*c == 'E' || *c == 'e') - maybe_end = TRUE; - else if (*c == 'B' || *c == 'b') - maybe_begin = TRUE; - else - return; - - if (maybe_end) - { - c++; - if (*c != 'N' && *c != 'n') - return; - - c++; - if (*c != 'D' && *c != 'd') - return; - } - - if (maybe_begin) - { - c++; - if (*c != 'E' && *c != 'e') - return; - - c++; - if (*c != 'G' && *c != 'g') - return; - - c++; - if (*c != 'I' && *c != 'i') - return; - - c++; - if (*c != 'N' && *c != 'n') - return; - } - - c++; - while (ISSPACE (*c)) c++; - c1 = c; - while (ISALPHA (*c) || ISDIGIT (*c) || *c == '_') c++; - - if (input_line_pointer[-1] == '\n') - bump_line_counters (); - - while (cr_num--) - bump_line_counters (); - - input_line_pointer = c; - if (maybe_end) - { - label_name = (char *) xmalloc ((c - c1) + strlen ("__END") + 5); - label_name[0] = 0; - strcat (label_name, "L$L$"); - strncat (label_name, c1, c-c1); - strcat (label_name, "__END"); - } - else /* maybe_begin. */ - { - label_name = (char *) xmalloc ((c - c1) + strlen ("__BEGIN") + 5); - label_name[0] = 0; - strcat (label_name, "L$L$"); - strncat (label_name, c1, c-c1); - strcat (label_name, "__BEGIN"); - } - - line_label = colon (label_name); - - /* Loop_End follows the last instruction in the loop. - Adjust label address. */ - if (maybe_end) - ((struct local_symbol *) line_label)->lsy_value -= last_insn_size; -} - /* Special extra functions that help bfin-parse.y perform its job. */ struct obstack mempool; @@ -2145,6 +2028,31 @@ bfin_gen_loop (Expr_Node *expr, REG_T reg, int rop, REG_T preg) return bfin_gen_loopsetup(lbegin, reg, rop, lend, preg); } +void +bfin_loop_beginend (Expr_Node *expr, int begin) +{ + const char *loopsym; + char *label_name; + symbolS *line_label; + const char *suffix = begin ? "__BEGIN" : "__END"; + + loopsym = expr->value.s_value; + label_name = (char *) xmalloc (strlen (loopsym) + strlen (suffix) + 5); + + label_name[0] = 0; + + strcat (label_name, "L$L$"); + strcat (label_name, loopsym); + strcat (label_name, suffix); + + line_label = colon (label_name); + + /* LOOP_END follows the last instruction in the loop. + Adjust label address. */ + if (!begin) + ((struct local_symbol *) line_label)->lsy_value -= last_insn_size; +} + bfd_boolean bfin_eol_in_insn (char *line) { |