tic54x: rename typedef of struct symbol_

generic gas code has a struct symbol, and tic54x typedefs a struct to symbol.
This seems at least rather confusing, and it seems like target specific headers
shouldn't  put such generic names in the global namespace preventing other
generic code from using them.

opcodes/ChangeLog:

2016-05-23  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* tic54x-dis.c (sprint_mmr): Adjust.
	* tic54x-opc.c: Likewise.

gas/ChangeLog:

2016-05-23  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* config/tc-tic54x.c (tic54x_mmregs): Adjust.
	(md_begin): Likewise.
	(encode_condition): Likewise.
	(encode_cc3): Likewise.
	(encode_cc2): Likewise.
	(encode_operand): Likewise.
	(tic54x_undefined_symbol): Likewise.

include/ChangeLog:

2016-05-23  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* opcode/tic54x.h (struct symbol_): typedef to tic54x_symbol instead of
	plain symbol.
This commit is contained in:
Trevor Saunders 2016-05-18 23:48:48 -04:00
parent 82418e18f8
commit 3d207518c1
7 changed files with 55 additions and 34 deletions

View file

@ -1,3 +1,13 @@
2016-05-23 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* config/tc-tic54x.c (tic54x_mmregs): Adjust.
(md_begin): Likewise.
(encode_condition): Likewise.
(encode_cc3): Likewise.
(encode_cc2): Likewise.
(encode_operand): Likewise.
(tic54x_undefined_symbol): Likewise.
2016-05-20 Matthew Fortune <matthew.fortune@imgtec.com>
* config/tc-mips.c (mips_cpu_info_table): Update comment. Add

View file

@ -2012,11 +2012,11 @@ tic54x_label (int ignored ATTRIBUTE_UNUSED)
static void
tic54x_mmregs (int ignored ATTRIBUTE_UNUSED)
{
symbol *sym;
tic54x_symbol *sym;
ILLEGAL_WITHIN_STRUCT ();
for (sym = (symbol *) mmregs; sym->name; sym++)
for (sym = (tic54x_symbol *) mmregs; sym->name; sym++)
{
symbolS *symbolP = symbol_new (sym->name, absolute_section,
(valueT) sym->value, &zero_address_frag);
@ -2964,7 +2964,7 @@ void
md_begin (void)
{
insn_template *tm;
symbol *sym;
tic54x_symbol *sym;
const subsym_proc_entry *subsym_proc;
const math_proc_entry *math_proc;
const char *hash_err;
@ -3012,7 +3012,7 @@ md_begin (void)
tm->name, hash_err);
}
reg_hash = hash_new ();
for (sym = (symbol *) regs; sym->name; sym++)
for (sym = (tic54x_symbol *) regs; sym->name; sym++)
{
/* Add basic registers to the symbol table. */
symbolS *symbolP = symbol_new (sym->name, absolute_section,
@ -3021,26 +3021,26 @@ md_begin (void)
symbol_table_insert (symbolP);
hash_err = hash_insert (reg_hash, sym->name, (char *) sym);
}
for (sym = (symbol *) mmregs; sym->name; sym++)
for (sym = (tic54x_symbol *) mmregs; sym->name; sym++)
hash_err = hash_insert (reg_hash, sym->name, (char *) sym);
mmreg_hash = hash_new ();
for (sym = (symbol *) mmregs; sym->name; sym++)
for (sym = (tic54x_symbol *) mmregs; sym->name; sym++)
hash_err = hash_insert (mmreg_hash, sym->name, (char *) sym);
cc_hash = hash_new ();
for (sym = (symbol *) condition_codes; sym->name; sym++)
for (sym = (tic54x_symbol *) condition_codes; sym->name; sym++)
hash_err = hash_insert (cc_hash, sym->name, (char *) sym);
cc2_hash = hash_new ();
for (sym = (symbol *) cc2_codes; sym->name; sym++)
for (sym = (tic54x_symbol *) cc2_codes; sym->name; sym++)
hash_err = hash_insert (cc2_hash, sym->name, (char *) sym);
cc3_hash = hash_new ();
for (sym = (symbol *) cc3_codes; sym->name; sym++)
for (sym = (tic54x_symbol *) cc3_codes; sym->name; sym++)
hash_err = hash_insert (cc3_hash, sym->name, (char *) sym);
sbit_hash = hash_new ();
for (sym = (symbol *) status_bits; sym->name; sym++)
for (sym = (tic54x_symbol *) status_bits; sym->name; sym++)
hash_err = hash_insert (sbit_hash, sym->name, (char *) sym);
misc_symbol_hash = hash_new ();
@ -3651,7 +3651,7 @@ encode_integer (tic54x_insn *insn,
static int
encode_condition (tic54x_insn *insn, struct opstruct *operand)
{
symbol *cc = (symbol *) hash_find (cc_hash, operand->buf);
tic54x_symbol *cc = (tic54x_symbol *) hash_find (cc_hash, operand->buf);
if (!cc)
{
as_bad (_("Unrecognized condition code \"%s\""), operand->buf);
@ -3711,7 +3711,7 @@ encode_condition (tic54x_insn *insn, struct opstruct *operand)
static int
encode_cc3 (tic54x_insn *insn, struct opstruct *operand)
{
symbol *cc3 = (symbol *) hash_find (cc3_hash, operand->buf);
tic54x_symbol *cc3 = (tic54x_symbol *) hash_find (cc3_hash, operand->buf);
int value = cc3 ? cc3->value : operand->exp.X_add_number << 8;
if ((value & 0x0300) != value)
@ -3740,7 +3740,7 @@ encode_arx (tic54x_insn *insn, struct opstruct *operand)
static int
encode_cc2 (tic54x_insn *insn, struct opstruct *operand)
{
symbol *cc2 = (symbol *) hash_find (cc2_hash, operand->buf);
tic54x_symbol *cc2 = (tic54x_symbol *) hash_find (cc2_hash, operand->buf);
if (!cc2)
{
@ -3899,7 +3899,8 @@ encode_operand (tic54x_insn *insn, enum optype type, struct opstruct *operand)
0, 65535, 0xFFFF);
case OP_SBIT:
{
symbol *sbit = (symbol *) hash_find (sbit_hash, operand->buf);
tic54x_symbol *sbit = (tic54x_symbol *)
hash_find (sbit_hash, operand->buf);
int value = is_absolute (operand) ?
operand->exp.X_add_number : (sbit ? sbit->value : -1);
int reg = 0;
@ -3913,7 +3914,7 @@ encode_operand (tic54x_insn *insn, enum optype type, struct opstruct *operand)
}
/* Guess the register based on the status bit; "ovb" is the last
status bit defined for st0. */
if (sbit > (symbol *) hash_find (sbit_hash, "ovb"))
if (sbit > (tic54x_symbol *) hash_find (sbit_hash, "ovb"))
reg = 1;
}
if (value == -1)
@ -5013,22 +5014,22 @@ tic54x_define_label (symbolS *sym)
symbolS *
tic54x_undefined_symbol (char *name)
{
symbol *sym;
tic54x_symbol *sym;
/* Not sure how to handle predefined symbols. */
if ((sym = (symbol *) hash_find (cc_hash, name)) != NULL ||
(sym = (symbol *) hash_find (cc2_hash, name)) != NULL ||
(sym = (symbol *) hash_find (cc3_hash, name)) != NULL ||
(sym = (symbol *) hash_find (misc_symbol_hash, name)) != NULL ||
(sym = (symbol *) hash_find (sbit_hash, name)) != NULL)
if ((sym = (tic54x_symbol *) hash_find (cc_hash, name)) != NULL ||
(sym = (tic54x_symbol *) hash_find (cc2_hash, name)) != NULL ||
(sym = (tic54x_symbol *) hash_find (cc3_hash, name)) != NULL ||
(sym = (tic54x_symbol *) hash_find (misc_symbol_hash, name)) != NULL ||
(sym = (tic54x_symbol *) hash_find (sbit_hash, name)) != NULL)
{
return symbol_new (name, reg_section,
(valueT) sym->value,
&zero_address_frag);
}
if ((sym = (symbol *) hash_find (reg_hash, name)) != NULL ||
(sym = (symbol *) hash_find (mmreg_hash, name)) != NULL ||
if ((sym = (tic54x_symbol *) hash_find (reg_hash, name)) != NULL ||
(sym = (tic54x_symbol *) hash_find (mmreg_hash, name)) != NULL ||
!strcasecmp (name, "a") || !strcasecmp (name, "b"))
{
return symbol_new (name, reg_section,

View file

@ -1,3 +1,8 @@
2016-05-23 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* opcode/tic54x.h (struct symbol_): typedef to tic54x_symbol instead of
plain symbol.
2016-04-29 Tom Tromey <tom@tromey.com>
* dwarf2.h (enum dwarf_source_language) <DW_LANG_Rust,

View file

@ -26,7 +26,7 @@ typedef struct _symbol
{
const char *name;
unsigned short value;
} symbol;
} tic54x_symbol;
enum optype {
OPT = 0x8000,
@ -152,9 +152,9 @@ typedef struct _template
extern const insn_template tic54x_unknown_opcode;
extern const insn_template tic54x_optab[];
extern const insn_template tic54x_paroptab[];
extern const symbol mmregs[], regs[];
extern const symbol condition_codes[], cc2_codes[], status_bits[];
extern const symbol cc3_codes[];
extern const tic54x_symbol mmregs[], regs[];
extern const tic54x_symbol condition_codes[], cc2_codes[], status_bits[];
extern const tic54x_symbol cc3_codes[];
extern const char *misc_symbols[];
struct disassemble_info;
extern const insn_template* tic54x_get_insn (struct disassemble_info *,

View file

@ -1,3 +1,8 @@
2016-05-23 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* tic54x-dis.c (sprint_mmr): Adjust.
* tic54x-opc.c: Likewise.
2016-05-19 Alan Modra <amodra@gmail.com>
* ppc-opc.c (NSISIGNOPT): Use insert_nsi and extract_nsi.

View file

@ -530,7 +530,7 @@ sprint_mmr (disassemble_info *info ATTRIBUTE_UNUSED,
char buf[],
int mmr)
{
symbol *reg = (symbol *) mmregs;
tic54x_symbol *reg = (tic54x_symbol *) mmregs;
while (reg->name != NULL)
{
if (mmr == reg->value)

View file

@ -24,7 +24,7 @@
#include "opcode/tic54x.h"
/* these are the only register names not found in mmregs */
const symbol regs[] = {
const tic54x_symbol regs[] = {
{ "AR0", 16 }, { "ar0", 16 },
{ "AR1", 17 }, { "ar1", 17 },
{ "AR2", 18 }, { "ar2", 18 },
@ -38,7 +38,7 @@ const symbol regs[] = {
/* status bits, MM registers, condition codes, etc */
/* some symbols are only valid for certain chips... */
const symbol mmregs[] = {
const tic54x_symbol mmregs[] = {
{ "IMR", 0 }, { "imr", 0 },
{ "IFR", 1 }, { "ifr", 1 },
{ "ST0", 6 }, { "st0", 6 },
@ -111,7 +111,7 @@ const symbol mmregs[] = {
{ NULL, 0},
};
const symbol condition_codes[] = {
const tic54x_symbol condition_codes[] = {
/* condition codes */
{ "UNC", 0 }, { "unc", 0 },
#define CC1 0x40
@ -155,7 +155,7 @@ const symbol condition_codes[] = {
{ NULL, 0 }
};
const symbol cc2_codes[] = {
const tic54x_symbol cc2_codes[] = {
{ "UNC", 0 }, { "unc", 0 },
{ "AEQ", 5 }, { "aeq", 5 },
{ "ANEQ", 4 }, { "aneq", 4 },
@ -172,7 +172,7 @@ const symbol cc2_codes[] = {
{ NULL, 0 },
};
const symbol cc3_codes[] = {
const tic54x_symbol cc3_codes[] = {
{ "EQ", 0x0000 }, { "eq", 0x0000 },
{ "LT", 0x0100 }, { "lt", 0x0100 },
{ "GT", 0x0200 }, { "gt", 0x0200 },
@ -189,7 +189,7 @@ const symbol cc3_codes[] = {
};
/* FIXME -- also allow decimal digits */
const symbol status_bits[] = {
const tic54x_symbol status_bits[] = {
/* status register 0 */
{ "TC", 12 }, { "tc", 12 },
{ "C", 11 }, { "c", 11 },