2005-09-01 Dmitry Diky <diwil@spec.ru>

* config/tc-msp430.c (msp430_operands): Emit dwarf2_emit_insn()
	as appropriate. Change frag_variant() to frag_var() for relaxes.
This commit is contained in:
Dmitry Diky
2005-09-01 12:41:25 +00:00
parent 046aeb7490
commit 2a9a06c144
2 changed files with 30 additions and 11 deletions

View File

@ -1,3 +1,8 @@
2005-09-01 Dmitry Diky <diwil@spec.ru>
* config/tc-msp430.c (msp430_operands): Emit dwarf2_emit_insn()
as appropriate. Change frag_variant() to frag_var() for relaxes.
2005-08-29 Nick Clifton <nickc@redhat.com> 2005-08-29 Nick Clifton <nickc@redhat.com>
* write.c (generic_force_reloc): Do not call S_FORCE_RELOC if * write.c (generic_force_reloc): Do not call S_FORCE_RELOC if

View File

@ -30,6 +30,7 @@
#include "subsegs.h" #include "subsegs.h"
#include "opcode/msp430.h" #include "opcode/msp430.h"
#include "safe-ctype.h" #include "safe-ctype.h"
#include "dwarf2dbg.h"
/* /*
We will disable polymorphs by default because it is dangerous. We will disable polymorphs by default because it is dangerous.
@ -1422,7 +1423,7 @@ static unsigned int
msp430_operands (struct msp430_opcode_s * opcode, char * line) msp430_operands (struct msp430_opcode_s * opcode, char * line)
{ {
int bin = opcode->bin_opcode; /* Opcode mask. */ int bin = opcode->bin_opcode; /* Opcode mask. */
int __is; int __is = 0;
char l1[MAX_OP_LEN], l2[MAX_OP_LEN]; char l1[MAX_OP_LEN], l2[MAX_OP_LEN];
char *frag; char *frag;
int where; int where;
@ -1474,6 +1475,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
__is = 2; __is = 2;
frag = frag_more (__is); frag = frag_more (__is);
bfd_putl16 ((bfd_vma) bin, frag); bfd_putl16 ((bfd_vma) bin, frag);
dwarf2_emit_insn (__is);
break; break;
case 1: case 1:
/* Something which works with destination operand. */ /* Something which works with destination operand. */
@ -1487,6 +1489,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
frag = frag_more (2 * __is); frag = frag_more (2 * __is);
where = frag - frag_now->fr_literal; where = frag - frag_now->fr_literal;
bfd_putl16 ((bfd_vma) bin, frag); bfd_putl16 ((bfd_vma) bin, frag);
dwarf2_emit_insn (2 * __is);
if (op1.mode == OP_EXP) if (op1.mode == OP_EXP)
{ {
@ -1520,6 +1523,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
frag = frag_more (2 * __is); frag = frag_more (2 * __is);
where = frag - frag_now->fr_literal; where = frag - frag_now->fr_literal;
bfd_putl16 ((bfd_vma) bin, frag); bfd_putl16 ((bfd_vma) bin, frag);
dwarf2_emit_insn (2 * __is);
if (op1.mode == OP_EXP) if (op1.mode == OP_EXP)
{ {
@ -1564,6 +1568,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
frag = frag_more (2 * __is); frag = frag_more (2 * __is);
where = frag - frag_now->fr_literal; where = frag - frag_now->fr_literal;
bfd_putl16 ((bfd_vma) bin, frag); bfd_putl16 ((bfd_vma) bin, frag);
dwarf2_emit_insn (2 * __is);
if (op1.mode == OP_EXP) if (op1.mode == OP_EXP)
{ {
@ -1596,6 +1601,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
frag = frag_more (2 * __is); frag = frag_more (2 * __is);
where = frag - frag_now->fr_literal; where = frag - frag_now->fr_literal;
bfd_putl16 ((bfd_vma) bin, frag); bfd_putl16 ((bfd_vma) bin, frag);
dwarf2_emit_insn (2 * __is);
if (op1.mode == OP_EXP) if (op1.mode == OP_EXP)
{ {
@ -1630,6 +1636,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
/* reti instruction. */ /* reti instruction. */
frag = frag_more (2); frag = frag_more (2);
bfd_putl16 ((bfd_vma) bin, frag); bfd_putl16 ((bfd_vma) bin, frag);
dwarf2_emit_insn (2);
break; break;
} }
@ -1643,6 +1650,7 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
frag = frag_more (2 * __is); frag = frag_more (2 * __is);
where = frag - frag_now->fr_literal; where = frag - frag_now->fr_literal;
bfd_putl16 ((bfd_vma) bin, frag); bfd_putl16 ((bfd_vma) bin, frag);
dwarf2_emit_insn (2 * __is);
if (op1.mode == OP_EXP) if (op1.mode == OP_EXP)
{ {
@ -1727,14 +1735,14 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
else if (*l1 == '$') else if (*l1 == '$')
{ {
as_bad (_("instruction requires label sans '$'")); as_bad (_("instruction requires label sans '$'"));
break;
} }
else else
{ {
as_bad (_ as_bad (_
("instruction requires label or value in range -511:512")); ("instruction requires label or value in range -511:512"));
break;
} }
dwarf2_emit_insn (2 * __is);
break;
} }
else else
{ {
@ -1766,13 +1774,18 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
/* Relaxation required. */ /* Relaxation required. */
struct rcodes_s rc = msp430_rcodes[opcode->insn_opnumb]; struct rcodes_s rc = msp430_rcodes[opcode->insn_opnumb];
frag = frag_more (8); /* The parameter to dwarf2_emit_insn is actually the offset to the start
bfd_putl16 ((bfd_vma) rc.sop, frag); of the insn from the fix piece of instruction that was emitted.
frag = frag_variant (rs_machine_dependent, 8, 2, Since next fragments may have variable size we tie debug info
to the beginning of the instruction. */
frag = frag_more (0);
dwarf2_emit_insn (0);
frag = frag_var/*iant*/ (rs_machine_dependent, 8, 2,
ENCODE_RELAX (rc.lpos, STATE_BITS10), /* Wild guess. */ ENCODE_RELAX (rc.lpos, STATE_BITS10), /* Wild guess. */
exp.X_add_symbol, exp.X_add_symbol,
0, /* Offset is zero if jump dist less than 1K. */ 0, /* Offset is zero if jump dist less than 1K. */
(char *) frag); (char *) frag);
bfd_putl16 ((bfd_vma) rc.sop, frag);
break; break;
} }
} }
@ -1802,14 +1815,15 @@ msp430_operands (struct msp430_opcode_s * opcode, char * line)
/* Relaxation required. */ /* Relaxation required. */
struct hcodes_s hc = msp430_hcodes[opcode->insn_opnumb]; struct hcodes_s hc = msp430_hcodes[opcode->insn_opnumb];
frag = frag_more (8); frag = frag_more (0);
bfd_putl16 ((bfd_vma) hc.op0, frag); dwarf2_emit_insn (0);
bfd_putl16 ((bfd_vma) hc.op1, frag+2); frag = frag_var/*iant*/ (rs_machine_dependent, 8, 2,
frag = frag_variant (rs_machine_dependent, 8, 2,
ENCODE_RELAX (STATE_EMUL_BRANCH, STATE_BITS10), /* Wild guess. */ ENCODE_RELAX (STATE_EMUL_BRANCH, STATE_BITS10), /* Wild guess. */
exp.X_add_symbol, exp.X_add_symbol,
0, /* Offset is zero if jump dist less than 1K. */ 0, /* Offset is zero if jump dist less than 1K. */
(char *) frag); (char *) frag);
bfd_putl16 ((bfd_vma) hc.op0, frag);
bfd_putl16 ((bfd_vma) hc.op1, frag+2);
break; break;
} }
} }