include ChangeLog

* xtensa-isa.h: Update a comment and whitespace.
bfd ChangeLog
	* xtensa-isa.c (xtensa_opcode_lookup, xtensa_state_lookup,
	xtensa_sysreg_lookup_name, xtensa_interface_lookup,
	xtensa_funcUnit_lookup): Skip bsearch call if count is zero.
	(xtensa_opcode_decode): Rearrange code.
This commit is contained in:
Bob Wilson
2005-03-22 19:31:28 +00:00
parent afe94956ca
commit 1fbc7e7aee
4 changed files with 77 additions and 32 deletions

View File

@ -1,3 +1,10 @@
2005-03-22 Bob Wilson <bob.wilson@acm.org>
* xtensa-isa.c (xtensa_opcode_lookup, xtensa_state_lookup,
xtensa_sysreg_lookup_name, xtensa_interface_lookup,
xtensa_funcUnit_lookup): Skip bsearch call if count is zero.
(xtensa_opcode_decode): Rearrange code.
2005-03-22 Nick Clifton <nickc@redhat.com> 2005-03-22 Nick Clifton <nickc@redhat.com>
* binary.c: Convert to ISO C90 formatting. * binary.c: Convert to ISO C90 formatting.
@ -5216,7 +5223,7 @@
between include sections when have the same sum but which between include sections when have the same sum but which
nevertheless are still unique. nevertheless are still unique.
2004-03-31 Mattias Engdeg<EFBFBD>rd <mattias@virtutech.se> 2004-03-31 Mattias Engdegård <mattias@virtutech.se>
* stabs.c (_bfd_link_section_stabs): Do not skip N_EXCL stabs. * stabs.c (_bfd_link_section_stabs): Do not skip N_EXCL stabs.

View File

@ -63,6 +63,7 @@ xtensa_isa_error_msg (xtensa_isa isa __attribute__ ((unused)))
} \ } \
} while (0) } while (0)
/* Instruction buffers. */ /* Instruction buffers. */
@ -406,9 +407,9 @@ xtensa_isa_length_from_chars (xtensa_isa isa, const unsigned char *cp)
int int
xtensa_isa_num_pipe_stages (xtensa_isa isa) xtensa_isa_num_pipe_stages (xtensa_isa isa)
{ {
int num_opcodes, num_uses;
xtensa_opcode opcode; xtensa_opcode opcode;
xtensa_funcUnit_use *use; xtensa_funcUnit_use *use;
int num_opcodes, num_uses;
int i, stage, max_stage = XTENSA_UNDEFINED; int i, stage, max_stage = XTENSA_UNDEFINED;
num_opcodes = xtensa_isa_num_opcodes (isa); num_opcodes = xtensa_isa_num_opcodes (isa);
@ -653,7 +654,7 @@ xtensa_opcode
xtensa_opcode_lookup (xtensa_isa isa, const char *opname) xtensa_opcode_lookup (xtensa_isa isa, const char *opname)
{ {
xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa; xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
xtensa_lookup_entry entry, *result; xtensa_lookup_entry entry, *result = 0;
if (!opname || !*opname) if (!opname || !*opname)
{ {
@ -662,9 +663,13 @@ xtensa_opcode_lookup (xtensa_isa isa, const char *opname)
return XTENSA_UNDEFINED; return XTENSA_UNDEFINED;
} }
entry.key = opname; if (intisa->num_opcodes != 0)
result = bsearch (&entry, intisa->opname_lookup_table, intisa->num_opcodes, {
sizeof (xtensa_lookup_entry), xtensa_isa_name_compare); entry.key = opname;
result = bsearch (&entry, intisa->opname_lookup_table,
intisa->num_opcodes, sizeof (xtensa_lookup_entry),
xtensa_isa_name_compare);
}
if (!result) if (!result)
{ {
@ -691,12 +696,12 @@ xtensa_opcode_decode (xtensa_isa isa, xtensa_format fmt, int slot,
slot_id = intisa->formats[fmt].slot_id[slot]; slot_id = intisa->formats[fmt].slot_id[slot];
opc = (intisa->slots[slot_id].opcode_decode_fn) (slotbuf); opc = (intisa->slots[slot_id].opcode_decode_fn) (slotbuf);
if (opc == XTENSA_UNDEFINED) if (opc != XTENSA_UNDEFINED)
{ return opc;
xtisa_errno = xtensa_isa_bad_opcode;
strcpy (xtisa_error_msg, "cannot decode opcode"); xtisa_errno = xtensa_isa_bad_opcode;
} strcpy (xtisa_error_msg, "cannot decode opcode");
return opc; return XTENSA_UNDEFINED;
} }
@ -1288,6 +1293,7 @@ xtensa_stateOperand_inout (xtensa_isa isa, xtensa_opcode opc, int stOp)
return iclass->stateOperands[stOp].inout; return iclass->stateOperands[stOp].inout;
} }
/* Interface Operands. */ /* Interface Operands. */
@ -1438,6 +1444,7 @@ xtensa_regfile_num_entries (xtensa_isa isa, xtensa_regfile rf)
return intisa->regfiles[rf].num_entries; return intisa->regfiles[rf].num_entries;
} }
/* Processor States. */ /* Processor States. */
@ -1457,7 +1464,7 @@ xtensa_state
xtensa_state_lookup (xtensa_isa isa, const char *name) xtensa_state_lookup (xtensa_isa isa, const char *name)
{ {
xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa; xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
xtensa_lookup_entry entry, *result; xtensa_lookup_entry entry, *result = 0;
if (!name || !*name) if (!name || !*name)
{ {
@ -1466,9 +1473,12 @@ xtensa_state_lookup (xtensa_isa isa, const char *name)
return XTENSA_UNDEFINED; return XTENSA_UNDEFINED;
} }
entry.key = name; if (intisa->num_states != 0)
result = bsearch (&entry, intisa->state_lookup_table, intisa->num_states, {
sizeof (xtensa_lookup_entry), xtensa_isa_name_compare); entry.key = name;
result = bsearch (&entry, intisa->state_lookup_table, intisa->num_states,
sizeof (xtensa_lookup_entry), xtensa_isa_name_compare);
}
if (!result) if (!result)
{ {
@ -1509,6 +1519,7 @@ xtensa_state_is_exported (xtensa_isa isa, xtensa_state st)
return 0; return 0;
} }
/* Sysregs. */ /* Sysregs. */
@ -1548,7 +1559,7 @@ xtensa_sysreg
xtensa_sysreg_lookup_name (xtensa_isa isa, const char *name) xtensa_sysreg_lookup_name (xtensa_isa isa, const char *name)
{ {
xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa; xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
xtensa_lookup_entry entry, *result; xtensa_lookup_entry entry, *result = 0;
if (!name || !*name) if (!name || !*name)
{ {
@ -1557,9 +1568,13 @@ xtensa_sysreg_lookup_name (xtensa_isa isa, const char *name)
return XTENSA_UNDEFINED; return XTENSA_UNDEFINED;
} }
entry.key = name; if (intisa->num_sysregs != 0)
result = bsearch (&entry, intisa->sysreg_lookup_table, intisa->num_sysregs, {
sizeof (xtensa_lookup_entry), xtensa_isa_name_compare); entry.key = name;
result = bsearch (&entry, intisa->sysreg_lookup_table,
intisa->num_sysregs, sizeof (xtensa_lookup_entry),
xtensa_isa_name_compare);
}
if (!result) if (!result)
{ {
@ -1600,6 +1615,7 @@ xtensa_sysreg_is_user (xtensa_isa isa, xtensa_sysreg sysreg)
return 0; return 0;
} }
/* Interfaces. */ /* Interfaces. */
@ -1619,7 +1635,7 @@ xtensa_interface
xtensa_interface_lookup (xtensa_isa isa, const char *ifname) xtensa_interface_lookup (xtensa_isa isa, const char *ifname)
{ {
xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa; xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
xtensa_lookup_entry entry, *result; xtensa_lookup_entry entry, *result = 0;
if (!ifname || !*ifname) if (!ifname || !*ifname)
{ {
@ -1628,10 +1644,13 @@ xtensa_interface_lookup (xtensa_isa isa, const char *ifname)
return XTENSA_UNDEFINED; return XTENSA_UNDEFINED;
} }
entry.key = ifname; if (intisa->num_interfaces != 0)
result = bsearch (&entry, intisa->interface_lookup_table, {
intisa->num_interfaces, entry.key = ifname;
sizeof (xtensa_lookup_entry), xtensa_isa_name_compare); result = bsearch (&entry, intisa->interface_lookup_table,
intisa->num_interfaces, sizeof (xtensa_lookup_entry),
xtensa_isa_name_compare);
}
if (!result) if (!result)
{ {
@ -1690,6 +1709,7 @@ xtensa_interface_class_id (xtensa_isa isa, xtensa_interface intf)
return intisa->interfaces[intf].class_id; return intisa->interfaces[intf].class_id;
} }
/* Functional Units. */ /* Functional Units. */
@ -1709,7 +1729,7 @@ xtensa_funcUnit
xtensa_funcUnit_lookup (xtensa_isa isa, const char *fname) xtensa_funcUnit_lookup (xtensa_isa isa, const char *fname)
{ {
xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa; xtensa_isa_internal *intisa = (xtensa_isa_internal *) isa;
xtensa_lookup_entry entry, *result; xtensa_lookup_entry entry, *result = 0;
if (!fname || !*fname) if (!fname || !*fname)
{ {
@ -1718,10 +1738,13 @@ xtensa_funcUnit_lookup (xtensa_isa isa, const char *fname)
return XTENSA_UNDEFINED; return XTENSA_UNDEFINED;
} }
entry.key = fname; if (intisa->num_funcUnits != 0)
result = bsearch (&entry, intisa->funcUnit_lookup_table, {
intisa->num_funcUnits, entry.key = fname;
sizeof (xtensa_lookup_entry), xtensa_isa_name_compare); result = bsearch (&entry, intisa->funcUnit_lookup_table,
intisa->num_funcUnits, sizeof (xtensa_lookup_entry),
xtensa_isa_name_compare);
}
if (!result) if (!result)
{ {

View File

@ -1,3 +1,7 @@
2005-03-22 Bob Wilson <bob.wilson@acm.org>
* xtensa-isa.h: Update a comment and whitespace.
2005-03-16 H.J. Lu <hongjiu.lu@intel.com> 2005-03-16 H.J. Lu <hongjiu.lu@intel.com>
* bfdlink.h (bfd_link_info): Add gc_sections. * bfdlink.h (bfd_link_info): Add gc_sections.

View File

@ -65,7 +65,7 @@ extern "C" {
typedef struct xtensa_isa_opaque { int unused; } *xtensa_isa; typedef struct xtensa_isa_opaque { int unused; } *xtensa_isa;
/* Opcodes, formats, regfiles, states, sysregs, ctypes, and protos are /* Most of the Xtensa ISA entities (e.g., opcodes, regfiles, etc.) are
represented here using sequential integers beginning with 0. The represented here using sequential integers beginning with 0. The
specific values are only fixed for a particular instantiation of an specific values are only fixed for a particular instantiation of an
xtensa_isa structure, so these values should only be used xtensa_isa structure, so these values should only be used
@ -168,6 +168,7 @@ xtensa_isa_errno (xtensa_isa isa);
extern char * extern char *
xtensa_isa_error_msg (xtensa_isa isa); xtensa_isa_error_msg (xtensa_isa isa);
/* Instruction buffers. */ /* Instruction buffers. */
@ -215,6 +216,7 @@ extern void
xtensa_insnbuf_from_chars (xtensa_isa isa, xtensa_insnbuf insn, xtensa_insnbuf_from_chars (xtensa_isa isa, xtensa_insnbuf insn,
const unsigned char *cp, int num_chars); const unsigned char *cp, int num_chars);
/* ISA information. */ /* ISA information. */
@ -279,6 +281,7 @@ xtensa_isa_num_interfaces (xtensa_isa isa);
extern int extern int
xtensa_isa_num_funcUnits (xtensa_isa isa); xtensa_isa_num_funcUnits (xtensa_isa isa);
/* Instruction formats. */ /* Instruction formats. */
@ -342,6 +345,7 @@ extern int
xtensa_format_set_slot (xtensa_isa isa, xtensa_format fmt, int slot, xtensa_format_set_slot (xtensa_isa isa, xtensa_format fmt, int slot,
xtensa_insnbuf insn, const xtensa_insnbuf slotbuf); xtensa_insnbuf insn, const xtensa_insnbuf slotbuf);
/* Opcode information. */ /* Opcode information. */
@ -412,7 +416,6 @@ xtensa_opcode_is_call (xtensa_isa isa, xtensa_opcode opc);
extern int extern int
xtensa_opcode_num_operands (xtensa_isa isa, xtensa_opcode opc); xtensa_opcode_num_operands (xtensa_isa isa, xtensa_opcode opc);
extern int extern int
xtensa_opcode_num_stateOperands (xtensa_isa isa, xtensa_opcode opc); xtensa_opcode_num_stateOperands (xtensa_isa isa, xtensa_opcode opc);
@ -438,6 +441,7 @@ xtensa_opcode_num_funcUnit_uses (xtensa_isa isa, xtensa_opcode opc);
extern xtensa_funcUnit_use * extern xtensa_funcUnit_use *
xtensa_opcode_funcUnit_use (xtensa_isa isa, xtensa_opcode opc, int u); xtensa_opcode_funcUnit_use (xtensa_isa isa, xtensa_opcode opc, int u);
/* Operand information. */ /* Operand information. */
@ -572,6 +576,7 @@ extern int
xtensa_operand_undo_reloc (xtensa_isa isa, xtensa_opcode opc, int opnd, xtensa_operand_undo_reloc (xtensa_isa isa, xtensa_opcode opc, int opnd,
uint32 *valp, uint32 pc); uint32 *valp, uint32 pc);
/* State Operands. */ /* State Operands. */
@ -588,6 +593,7 @@ xtensa_stateOperand_state (xtensa_isa isa, xtensa_opcode opc, int stOp);
extern char extern char
xtensa_stateOperand_inout (xtensa_isa isa, xtensa_opcode opc, int stOp); xtensa_stateOperand_inout (xtensa_isa isa, xtensa_opcode opc, int stOp);
/* Interface Operands. */ /* Interface Operands. */
@ -598,6 +604,7 @@ extern xtensa_interface
xtensa_interfaceOperand_interface (xtensa_isa isa, xtensa_opcode opc, xtensa_interfaceOperand_interface (xtensa_isa isa, xtensa_opcode opc,
int ifOp); int ifOp);
/* Register Files. */ /* Register Files. */
@ -651,6 +658,7 @@ xtensa_regfile_num_bits (xtensa_isa isa, xtensa_regfile rf);
extern int extern int
xtensa_regfile_num_entries (xtensa_isa isa, xtensa_regfile rf); xtensa_regfile_num_entries (xtensa_isa isa, xtensa_regfile rf);
/* Processor States. */ /* Processor States. */
@ -680,6 +688,7 @@ xtensa_state_num_bits (xtensa_isa isa, xtensa_state st);
extern int extern int
xtensa_state_is_exported (xtensa_isa isa, xtensa_state st); xtensa_state_is_exported (xtensa_isa isa, xtensa_state st);
/* Sysregs ("special registers" and "user registers"). */ /* Sysregs ("special registers" and "user registers"). */
@ -717,6 +726,7 @@ xtensa_sysreg_number (xtensa_isa isa, xtensa_sysreg sysreg);
extern int extern int
xtensa_sysreg_is_user (xtensa_isa isa, xtensa_sysreg sysreg); xtensa_sysreg_is_user (xtensa_isa isa, xtensa_sysreg sysreg);
/* Interfaces. */ /* Interfaces. */
@ -768,6 +778,7 @@ xtensa_interface_has_side_effect (xtensa_isa isa, xtensa_interface intf);
extern int extern int
xtensa_interface_class_id (xtensa_isa isa, xtensa_interface intf); xtensa_interface_class_id (xtensa_isa isa, xtensa_interface intf);
/* Functional Units. */ /* Functional Units. */