S12Z: opcodes: Replace "operator" with "optr".

opcodes/
	* s12z-dis.c, s12z-opc.c, s12z-opc.h: Replace operator with optr.
This commit is contained in:
John Darrington
2019-04-12 18:39:01 +02:00
parent d04ebfb817
commit e5a557ac01
4 changed files with 34 additions and 29 deletions

View File

@@ -1,3 +1,8 @@
2019-04-12 John Darrington <john@darrington.wattle.id.au>
s12z-dis.c, s12z-opc.c, s12z-opc.h: Replace "operator" with
"optr". ("operator" is a reserved word in c++).
2019-04-11 Sudakshina Das <sudi.das@arm.com> 2019-04-11 Sudakshina Das <sudi.das@arm.com>
* aarch64-opc.c (aarch64_print_operand): Add case for * aarch64-opc.c (aarch64_print_operand): Add case for

View File

@@ -331,7 +331,7 @@ int
print_insn_s12z (bfd_vma memaddr, struct disassemble_info* info) print_insn_s12z (bfd_vma memaddr, struct disassemble_info* info)
{ {
int o; int o;
enum operator operator = OP_INVALID; enum optr operator = OP_INVALID;
int n_operands = 0; int n_operands = 0;
/* The longest instruction in S12Z can have 6 operands. /* The longest instruction in S12Z can have 6 operands.

View File

@@ -36,8 +36,8 @@ typedef int (* insn_bytes_f) (struct mem_read_abstraction_base *);
typedef void (*operands_f) (struct mem_read_abstraction_base *, typedef void (*operands_f) (struct mem_read_abstraction_base *,
int *n_operands, struct operand **operand); int *n_operands, struct operand **operand);
typedef enum operator (*discriminator_f) (struct mem_read_abstraction_base *, typedef enum optr (*discriminator_f) (struct mem_read_abstraction_base *,
enum operator hint); enum optr hint);
enum OPR_MODE enum OPR_MODE
{ {
@@ -969,12 +969,12 @@ static void bit_field_decode (struct mem_read_abstraction_base *mra, int *n_oper
static void exg_sex_decode (struct mem_read_abstraction_base *mra, int *n_operands, struct operand **operands); static void exg_sex_decode (struct mem_read_abstraction_base *mra, int *n_operands, struct operand **operands);
static enum operator shift_discrim (struct mem_read_abstraction_base *mra, enum operator hint); static enum optr shift_discrim (struct mem_read_abstraction_base *mra, enum optr hint);
static enum operator psh_pul_discrim (struct mem_read_abstraction_base *mra, enum operator hint); static enum optr psh_pul_discrim (struct mem_read_abstraction_base *mra, enum optr hint);
static enum operator mul_discrim (struct mem_read_abstraction_base *mra, enum operator hint); static enum optr mul_discrim (struct mem_read_abstraction_base *mra, enum optr hint);
static enum operator loop_primitive_discrim (struct mem_read_abstraction_base *mra, enum operator hint); static enum optr loop_primitive_discrim (struct mem_read_abstraction_base *mra, enum optr hint);
static enum operator bit_field_discrim (struct mem_read_abstraction_base *mra, enum operator hint); static enum optr bit_field_discrim (struct mem_read_abstraction_base *mra, enum optr hint);
static enum operator exg_sex_discrim (struct mem_read_abstraction_base *mra, enum operator hint); static enum optr exg_sex_discrim (struct mem_read_abstraction_base *mra, enum optr hint);
static void static void
@@ -1005,8 +1005,8 @@ sub_d6_y_x (struct mem_read_abstraction_base *mra ATTRIBUTE_UNUSED,
static void ld_18bit_decode (struct mem_read_abstraction_base *mra, int *n_operands, struct operand **operand); static void ld_18bit_decode (struct mem_read_abstraction_base *mra, int *n_operands, struct operand **operand);
static enum operator static enum optr
mul_discrim (struct mem_read_abstraction_base *mra, enum operator hint) mul_discrim (struct mem_read_abstraction_base *mra, enum optr hint)
{ {
uint8_t mb; uint8_t mb;
int status = mra->read (mra, 0, 1, &mb); int status = mra->read (mra, 0, 1, &mb);
@@ -1042,7 +1042,7 @@ mul_discrim (struct mem_read_abstraction_base *mra, enum operator hint)
struct opcode struct opcode
{ {
/* The operation that this opcode performs. */ /* The operation that this opcode performs. */
enum operator operator; enum optr operator;
/* The size of this operation. May be -1 if it is implied /* The size of this operation. May be -1 if it is implied
in the operands or if size is not applicable. */ in the operands or if size is not applicable. */
@@ -2196,8 +2196,8 @@ loop_prim_n_bytes (struct mem_read_abstraction_base *mra)
static enum operator static enum optr
exg_sex_discrim (struct mem_read_abstraction_base *mra, enum operator hint ATTRIBUTE_UNUSED) exg_sex_discrim (struct mem_read_abstraction_base *mra, enum optr hint ATTRIBUTE_UNUSED)
{ {
uint8_t eb; uint8_t eb;
int status = mra->read (mra, 0, 1, &eb); int status = mra->read (mra, 0, 1, &eb);
@@ -2210,7 +2210,7 @@ exg_sex_discrim (struct mem_read_abstraction_base *mra, enum operator hint ATTRI
const struct reg *r0 = registers + ((struct register_operand *) op0)->reg; const struct reg *r0 = registers + ((struct register_operand *) op0)->reg;
const struct reg *r1 = registers + ((struct register_operand *) op1)->reg; const struct reg *r1 = registers + ((struct register_operand *) op1)->reg;
enum operator operator = (r0->bytes < r1->bytes) ? OP_sex : OP_exg; enum optr operator = (r0->bytes < r1->bytes) ? OP_sex : OP_exg;
free (op0); free (op0);
free (op1); free (op1);
@@ -2233,16 +2233,16 @@ exg_sex_decode (struct mem_read_abstraction_base *mra,
operands[(*n_operands)++] = create_register_operand (eb & 0xf); operands[(*n_operands)++] = create_register_operand (eb & 0xf);
} }
static enum operator static enum optr
loop_primitive_discrim (struct mem_read_abstraction_base *mra, loop_primitive_discrim (struct mem_read_abstraction_base *mra,
enum operator hint ATTRIBUTE_UNUSED) enum optr hint ATTRIBUTE_UNUSED)
{ {
uint8_t lb; uint8_t lb;
int status = mra->read (mra, 0, 1, &lb); int status = mra->read (mra, 0, 1, &lb);
if (status < 0) if (status < 0)
return OP_INVALID; return OP_INVALID;
enum operator opbase = (lb & 0x80) ? OP_dbNE : OP_tbNE; enum optr opbase = (lb & 0x80) ? OP_dbNE : OP_tbNE;
return opbase + ((lb & 0x70) >> 4); return opbase + ((lb & 0x70) >> 4);
} }
@@ -2287,8 +2287,8 @@ loop_primitive_decode (struct mem_read_abstraction_base *mra,
} }
static enum operator static enum optr
shift_discrim (struct mem_read_abstraction_base *mra, enum operator hint ATTRIBUTE_UNUSED) shift_discrim (struct mem_read_abstraction_base *mra, enum optr hint ATTRIBUTE_UNUSED)
{ {
size_t i; size_t i;
uint8_t sb; uint8_t sb;
@@ -2474,9 +2474,9 @@ shift_decode (struct mem_read_abstraction_base *mra, int *n_operands, struct op
} }
} }
static enum operator static enum optr
psh_pul_discrim (struct mem_read_abstraction_base *mra, psh_pul_discrim (struct mem_read_abstraction_base *mra,
enum operator hint ATTRIBUTE_UNUSED) enum optr hint ATTRIBUTE_UNUSED)
{ {
uint8_t byte; uint8_t byte;
int status = mra->read (mra, 0, 1, &byte); int status = mra->read (mra, 0, 1, &byte);
@@ -2528,8 +2528,8 @@ psh_pul_decode (struct mem_read_abstraction_base *mra,
} }
} }
static enum operator static enum optr
bit_field_discrim (struct mem_read_abstraction_base *mra, enum operator hint ATTRIBUTE_UNUSED) bit_field_discrim (struct mem_read_abstraction_base *mra, enum optr hint ATTRIBUTE_UNUSED)
{ {
int status; int status;
bfd_byte bb; bfd_byte bb;
@@ -2647,12 +2647,12 @@ bit_field_decode (struct mem_read_abstraction_base *mra,
The operation to be performed is returned. The operation to be performed is returned.
The number of operands, will be placed in N_OPERANDS. The number of operands, will be placed in N_OPERANDS.
The operands themselved into OPERANDS. */ The operands themselved into OPERANDS. */
static enum operator static enum optr
decode_operation (const struct opcode *opc, decode_operation (const struct opcode *opc,
struct mem_read_abstraction_base *mra, struct mem_read_abstraction_base *mra,
int *n_operands, struct operand **operands) int *n_operands, struct operand **operands)
{ {
enum operator op = opc->operator; enum optr op = opc->operator;
if (opc->discriminator) if (opc->discriminator)
op = opc->discriminator (mra, opc->operator); op = opc->discriminator (mra, opc->operator);
@@ -2666,7 +2666,7 @@ decode_operation (const struct opcode *opc,
} }
int int
decode_s12z (enum operator *myoperator, short *osize, decode_s12z (enum optr *myoperator, short *osize,
int *n_operands, struct operand **operands, int *n_operands, struct operand **operands,
struct mem_read_abstraction_base *mra) struct mem_read_abstraction_base *mra)
{ {

View File

@@ -34,7 +34,7 @@ struct mem_read_abstraction_base
/* Machine code operators. /* Machine code operators.
These *roughly* correspond to opcodes. These *roughly* correspond to opcodes.
But describe their purpose rather than their form. */ But describe their purpose rather than their form. */
enum operator enum optr
{ {
OP_INVALID = 0, OP_INVALID = 0,
@@ -259,7 +259,7 @@ struct memory_operand
It is the responsibility of the caller to free all operands It is the responsibility of the caller to free all operands
when they are no longer needed. when they are no longer needed.
Returns the number of bytes read. */ Returns the number of bytes read. */
int decode_s12z (enum operator *myoperator, short *osize, int decode_s12z (enum optr *myoperator, short *osize,
int *n_operands, struct operand **operands, int *n_operands, struct operand **operands,
struct mem_read_abstraction_base *); struct mem_read_abstraction_base *);