+start-sanitize-tic80
+Thu Jul 24 12:13:19 1997 Fred Fish <fnf@cygnus.com>
+
+ * config/tc-tic80.c (build_insn): Remove "extended" and replace with
+ "fx" and "fxfrag". Add "ffrag". Change code to initialize and use
+ the right f/ffrag and fx/fxfrag pairs since instruction may be split
+ across frags.
+
+end-sanitize-tic80
Tue Jul 22 18:38:56 1997 Robert Hoehne <robert.hoehne@Mathematik.TU-Chemnitz.DE>
* config/te-go32.h (USE_ALIGN_PTWO): Define.
}
/* build_insn takes a pointer to the opcode entry in the opcode table
- and the array of operand expressions and writes out the instruction. */
+ and the array of operand expressions and writes out the instruction.
+
+ Note that the opcode word and extended word may be written to different
+ frags, with the opcode at the end of one frag and the extension at the
+ beginning of the next. */
static void
build_insn (opcode, opers)
int expi; /* Index of current expression to match */
int opi; /* Index of current operand to match */
unsigned long insn[2]; /* Instruction and long immediate (if any) */
- int extended = 0; /* Nonzero if instruction is 8 bytes */
- char *f; /* Temporary pointer to output location */
+ char *f; /* Pointer to frag location for insn[0] */
+ fragS *ffrag; /* Frag containing location f */
+ char *fx = NULL; /* Pointer to frag location for insn[1] */
+ fragS *fxfrag; /* Frag containing location fx */
/* Start with the raw opcode bits from the opcode table. */
insn[0] = opcode -> opcode;
frag now. */
f = frag_more (4);
+ ffrag = frag_now;
/* For each operand expression, insert the appropriate bits into the
instruction . */
}
else
{
- extended++;
+ fx = frag_more (4);
+ fxfrag = frag_now;
insn[1] = num;
}
break;
case O_symbol:
if (flags & TIC80_OPERAND_PCREL)
{
- fix_new_exp (frag_now,
- f - (frag_now -> fr_literal),
+ fix_new_exp (ffrag,
+ f - (ffrag -> fr_literal),
4, /* FIXME! how is this used? */
&opers[expi],
1,
}
else if (bits == 32) /* was (flags & TIC80_OPERAND_BASEREL) */
{
- extended++;
+ fx = frag_more (4);
+ fxfrag = frag_now;
insn[1] = 0;
- fix_new_exp (frag_now,
- (f + 4) - (frag_now -> fr_literal),
+ fix_new_exp (fxfrag,
+ fx - (fxfrag -> fr_literal),
4,
&opers[expi],
0,
}
break;
case O_big:
- extended++;
+ fx = frag_more (4);
+ fxfrag = frag_now;
{
int precision = 2;
long exponent_bits = 8L;
/* Write out the instruction, either 4 or 8 bytes. */
md_number_to_chars (f, insn[0], 4);
- if (extended)
+ if (fx != NULL)
{
- f = frag_more (4);
- md_number_to_chars (f, insn[1], 4);
+ md_number_to_chars (fx, insn[1], 4);
}
}