/* GAS interface for targets using CGEN: Cpu tools GENerator.
- Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
static void
queue_fixup (opindex, opinfo, expP)
int opindex;
+ int opinfo;
expressionS * expP;
{
/* We need to generate a fixup for this expression. */
CGEN_OPERAND_ATTR_VALUE (operand, CGEN_OPERAND_PCREL_ADDR),
(bfd_reloc_code_real_type)
((int) BFD_RELOC_UNUSED
- + CGEN_OPERAND_INDEX (gas_cgen_cpu_desc, operand)));
- fixP->tc_fix_data.insn = (PTR) insn;
- fixP->tc_fix_data.opinfo = opinfo;
+ + (int) operand->type));
+ fixP->fx_cgen.insn = insn;
+ fixP->fx_cgen.opinfo = opinfo;
return fixP;
}
CGEN_OPERAND_ATTR_VALUE (operand, CGEN_OPERAND_PCREL_ADDR),
(bfd_reloc_code_real_type)
((int) BFD_RELOC_UNUSED
- + CGEN_OPERAND_INDEX (gas_cgen_cpu_desc, operand)));
- fixP->tc_fix_data.insn = (PTR) insn;
- fixP->tc_fix_data.opinfo = opinfo;
+ + (int) operand->type));
+ fixP->fx_cgen.insn = insn;
+ fixP->fx_cgen.opinfo = opinfo;
return fixP;
}
/* Used for communication between the next two procedures. */
static jmp_buf expr_jmp_buf;
+static int expr_jmp_buf_p;
/* Callback for cgen interface. Parse the expression at *STRP.
The result is an error message or NULL for success (in which case
const char *
gas_cgen_parse_operand (cd, want, strP, opindex, opinfo, resultP, valueP)
- CGEN_CPU_DESC cd;
+ CGEN_CPU_DESC cd ATTRIBUTE_UNUSED;
enum cgen_parse_operand_type want;
const char ** strP;
int opindex;
This is done via gas_cgen_md_operand. */
if (setjmp (expr_jmp_buf) != 0)
{
+ expr_jmp_buf_p = 0;
input_line_pointer = (char *) hold;
* resultP_1 = CGEN_PARSE_OPERAND_RESULT_ERROR;
return "illegal operand";
}
+ expr_jmp_buf_p = 1;
expression (& exp);
+ expr_jmp_buf_p = 0;
* strP = input_line_pointer;
input_line_pointer = hold;
void
gas_cgen_md_operand (expressionP)
- expressionS * expressionP;
+ expressionS * expressionP ATTRIBUTE_UNUSED;
{
- longjmp (expr_jmp_buf, 1);
+ /* Don't longjmp if we're not called from within cgen_parse_operand(). */
+ if (expr_jmp_buf_p)
+ longjmp (expr_jmp_buf, 1);
}
/* Finish assembling instruction INSN.
for (i = 0; i < num_fixups; ++ i)
{
- if (CGEN_OPERAND_ATTR_VALUE (& CGEN_CPU_OPERAND_TABLE (gas_cgen_cpu_desc) [fixups[i].opindex],
+ if (CGEN_OPERAND_ATTR_VALUE (cgen_operand_lookup_by_num (gas_cgen_cpu_desc, fixups[i].opindex),
CGEN_OPERAND_RELAX))
{
relax_operand = i;
/* Create any fixups. */
for (i = 0; i < num_fixups; ++i)
{
- fixS * fixP;
+ fixS *fixP;
+ const CGEN_OPERAND *operand =
+ cgen_operand_lookup_by_num (gas_cgen_cpu_desc, fixups[i].opindex);
/* Don't create fixups for these. That's done during relaxation.
We don't need to test for CGEN_INSN_RELAX as they can't get here
(see above). */
if (relax_p
&& CGEN_INSN_ATTR_VALUE (insn, CGEN_INSN_RELAXABLE)
- && CGEN_OPERAND_ATTR_VALUE (& CGEN_CPU_OPERAND_TABLE (gas_cgen_cpu_desc) [fixups[i].opindex],
- CGEN_OPERAND_RELAX))
+ && CGEN_OPERAND_ATTR_VALUE (operand, CGEN_OPERAND_RELAX))
continue;
#ifndef md_cgen_record_fixup_exp
#endif
fixP = md_cgen_record_fixup_exp (frag_now, f - frag_now->fr_literal,
- insn, length,
- & CGEN_CPU_OPERAND_TABLE (gas_cgen_cpu_desc) [fixups[i].opindex],
+ insn, length, operand,
fixups[i].opinfo,
& fixups[i].exp);
if (result)
gas_cgen_md_apply_fix3 (fixP, valueP, seg)
fixS * fixP;
valueT * valueP;
- segT seg;
+ segT seg ATTRIBUTE_UNUSED;
{
char * where = fixP->fx_frag->fr_literal + fixP->fx_where;
valueT value;
if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
{
int opindex = (int) fixP->fx_r_type - (int) BFD_RELOC_UNUSED;
- const CGEN_OPERAND *operand = & CGEN_CPU_OPERAND_TABLE (cd) [opindex];
+ const CGEN_OPERAND *operand = cgen_operand_lookup_by_num (cd, opindex);
const char *errmsg;
bfd_reloc_code_real_type reloc_type;
CGEN_FIELDS *fields = alloca (CGEN_CPU_SIZEOF_FIELDS (cd));
- const CGEN_INSN *insn = (CGEN_INSN *) fixP->tc_fix_data.insn;
+ const CGEN_INSN *insn = fixP->fx_cgen.insn;
/* If the reloc has been fully resolved finish the operand here. */
/* FIXME: This duplicates the capabilities of code in BFD. */
|| fixP->fx_pcrel)
{
CGEN_CPU_SET_FIELDS_BITSIZE (cd) (fields, CGEN_INSN_BITSIZE (insn));
- CGEN_CPU_SET_VMA_OPERAND (cd) (opindex, fields, (bfd_vma) value);
+ CGEN_CPU_SET_VMA_OPERAND (cd) (cd, opindex, fields, (bfd_vma) value);
#if CGEN_INT_INSN_P
{
arelent *
gas_cgen_tc_gen_reloc (section, fixP)
- asection * section;
+ asection * section ATTRIBUTE_UNUSED;
fixS * fixP;
{
arelent * reloc;
assert (!fixP->fx_pcrel == !reloc->howto->pc_relative);
- reloc->sym_ptr_ptr = & fixP->fx_addsy->bsym;
+ reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+ *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
/* Use fx_offset for these cases */
if ( fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY