gas d30v_insn plus other non-const pointers

d30v has a bunch of casts that are only needed due to various types
missing a const.  Fix that.
This commit is contained in:
Alan Modra
2025-07-09 09:02:43 +09:30
parent 60ba816bc1
commit de8acd2005
2 changed files with 14 additions and 14 deletions

View File

@@ -306,11 +306,11 @@ md_section_align (asection *seg, valueT addr)
void void
md_begin (void) md_begin (void)
{ {
struct d30v_opcode *opcode; const struct d30v_opcode *opcode;
d30v_hash = str_htab_create (); d30v_hash = str_htab_create ();
/* Insert opcode names into a hash table. */ /* Insert opcode names into a hash table. */
for (opcode = (struct d30v_opcode *) d30v_opcode_table; opcode->name; opcode++) for (opcode = d30v_opcode_table; opcode->name; opcode++)
str_hash_insert (d30v_hash, opcode->name, opcode, 0); str_hash_insert (d30v_hash, opcode->name, opcode, 0);
fixups = &FixUps[0]; fixups = &FixUps[0];
@@ -484,8 +484,8 @@ build_insn (struct d30v_insn *opcode, expressionS *opers)
int i, bits, shift, flags; int i, bits, shift, flags;
unsigned long number, id = 0; unsigned long number, id = 0;
long long insn; long long insn;
struct d30v_opcode *op = opcode->op; const struct d30v_opcode *op = opcode->op;
struct d30v_format *form = opcode->form; const struct d30v_format *form = opcode->form;
insn = insn =
opcode->ecc << 28 | op->op1 << 25 | op->op2 << 20 | form->modifier << 18; opcode->ecc << 28 | op->op1 << 25 | op->op2 << 20 | form->modifier << 18;
@@ -682,8 +682,8 @@ parallel_ok (struct d30v_insn *op1,
int i, j, shift, regno, bits, ecc; int i, j, shift, regno, bits, ecc;
unsigned long flags, mask, flags_set1, flags_set2, flags_used1, flags_used2; unsigned long flags, mask, flags_set1, flags_set2, flags_used1, flags_used2;
unsigned long ins, mod_reg[2][3], used_reg[2][3], flag_reg[2]; unsigned long ins, mod_reg[2][3], used_reg[2][3], flag_reg[2];
struct d30v_format *f; const struct d30v_format *f;
struct d30v_opcode *op; const struct d30v_opcode *op;
/* Section 4.3: Both instructions must not be IU or MU only. */ /* Section 4.3: Both instructions must not be IU or MU only. */
if ((op1->op->unit == IU && op2->op->unit == IU) if ((op1->op->unit == IU && op2->op->unit == IU)
@@ -1122,14 +1122,14 @@ write_2_short (struct d30v_insn *opcode1,
It must look at all formats for an opcode and use the operands It must look at all formats for an opcode and use the operands
to choose the correct one. Return NULL on error. */ to choose the correct one. Return NULL on error. */
static struct d30v_format * static const struct d30v_format *
find_format (struct d30v_opcode *opcode, find_format (const struct d30v_opcode *opcode,
expressionS myops[], expressionS myops[],
int fsize, int fsize,
int cmp_hack) int cmp_hack)
{ {
int match, opcode_index, i = 0, j, k; int match, opcode_index, i = 0, j, k;
struct d30v_format *fm; const struct d30v_format *fm;
if (opcode == NULL) if (opcode == NULL)
return NULL; return NULL;
@@ -1145,7 +1145,7 @@ find_format (struct d30v_opcode *opcode,
if (fsize == FORCE_LONG && opcode_index < LONG) if (fsize == FORCE_LONG && opcode_index < LONG)
continue; continue;
fm = (struct d30v_format *) &d30v_format_table[opcode_index]; fm = &d30v_format_table[opcode_index];
k = opcode_index; k = opcode_index;
while (fm->form == opcode_index) while (fm->form == opcode_index)
{ {
@@ -1266,7 +1266,7 @@ find_format (struct d30v_opcode *opcode,
return fm; return fm;
} }
fm = (struct d30v_format *) &d30v_format_table[++k]; fm = &d30v_format_table[++k];
} }
} }
return NULL; return NULL;
@@ -1339,7 +1339,7 @@ do_assemble (char *str,
if (startswith (name, "cmp")) if (startswith (name, "cmp"))
{ {
int p, i; int p, i;
char **d30v_str = (char **) d30v_cc_names; const char **d30v_str = d30v_cc_names;
if (name[3] == 'u') if (name[3] == 'u')
p = 4; p = 4;

View File

@@ -279,8 +279,8 @@ extern const struct d30v_format d30v_format_table[];
/* formats, 2 SHORT_A forms and a LONG form. */ /* formats, 2 SHORT_A forms and a LONG form. */
struct d30v_insn struct d30v_insn
{ {
struct d30v_opcode *op; /* pointer to an entry in the opcode table */ const struct d30v_opcode *op; /* pointer to an entry in the opcode table */
struct d30v_format *form; /* pointer to an entry in the format table */ const struct d30v_format *form; /* pointer to an entry in the format table */
int ecc; /* execution condition code */ int ecc; /* execution condition code */
}; };