disas: e2k: Fix alf print.

e2k
Denis Drakhnia 2 years ago committed by Denis Drakhnia
parent 3d49789b53
commit a4b1402861
  1. 97
      disas/e2k.c
  2. 2
      target/e2k/translate.c

@ -24,21 +24,49 @@
#include "disas/dis-asm.h"
#include "e2k.h"
int mcpu;
/* I need MCPU referred to in "e2k-opc.h" here to prevent "e2k-opc.c" from
being linked into OBJDUMP. At the same time I want to prevent "e2k-dis.c"
from being mistakenly linked into GAS because of this variable, which is why
it's made static and renamed here. */
#define mcpu e2k_dis_mcpu
static unsigned long mcpu;
typedef struct e2k_opcode_hash
{
struct e2k_opcode_hash *next;
const e2k_alf_opcode_templ *templ;
} e2k_opcode_hash;
#define MAX_E2K_NUM_OPCODES 16384
struct e2k_opcode_templ *e2k_opcode_templs[MAX_E2K_NUM_OPCODES];
size_t e2k_num_opcodes;
/* Use opcode as a hash key for now. */
static e2k_opcode_hash *opcode_hash_table[128];
/* At STAGE = 0 the hash table's buffer of an appropriate size is allocated,
at STAGE = 1 it is filled in. */
static int build_hash_table_stage = 0;
static int num_opcodes;
static e2k_opcode_hash *hash_buf = NULL;
static void
add_to_insn_table (e2k_opcode_templ *new)
add_to_insn_table (e2k_opcode_templ *t)
{
if (e2k_num_opcodes == MAX_E2K_NUM_OPCODES)
abort ();
const e2k_alf_opcode_templ *alf;
e2k_opcode_hash *h;
e2k_opcode_templs[e2k_num_opcodes++] = new;
}
if (build_hash_table_stage == 0)
{
num_opcodes++;
return;
}
h = &hash_buf[num_opcodes++];
alf = (const e2k_alf_opcode_templ *) t;
assert (alf->opc < 128);
h->next = opcode_hash_table[alf->opc];
h->templ = alf;
opcode_hash_table[alf->opc] = h;
}
static const char *
merge_alopf1_with_alopf11 (e2k_alf1_opcode_templ *l,
@ -293,23 +321,6 @@ init_opcode_templs (void)
E2K_OPCODE_VEC_ENTRY (vfdi, parse_vfdi_args);
}
/* I need MCPU referred to in "e2k-opc.h" here to prevent "e2k-opc.c" from
being linked into OBJDUMP. At the same time I want to prevent "e2k-dis.c"
from being mistakenly linked into GAS because of this variable, which is why
it's made static and renamed here. */
#define mcpu e2k_dis_mcpu
static unsigned long mcpu;
typedef struct e2k_opcode_hash
{
struct e2k_opcode_hash *next;
const e2k_alf_opcode_templ *templ;
} e2k_opcode_hash;
/* Use opcode as a hash key for now. */
static e2k_opcode_hash *opcode_hash_table[128];
static struct unpacked_instr {
unsigned int hs;
unsigned int ss;
@ -2581,40 +2592,6 @@ print_apb_instr (disassemble_info *info)
}
}
/* At STAGE = 0 the hash table's buffer of an appropriate size is allocated,
at STAGE = 1 it is filled in. */
static int build_hash_table_stage = 0;
static int num_opcodes;
static e2k_opcode_hash *hash_buf = NULL;
/*static void
add_to_insn_table (e2k_opcode_templ *t)
{
const e2k_alf_opcode_templ *alf;
e2k_opcode_hash *h;
if (build_hash_table_stage == 0)
{
num_opcodes++;
return;
}
h = &hash_buf[num_opcodes++];
alf = (const e2k_alf_opcode_templ *) t;
assert (alf->opc < 128);
h->next = opcode_hash_table[alf->opc];
h->templ = alf;
opcode_hash_table[alf->opc] = h;
}*/
static void
build_hash_table (void)
{

@ -355,13 +355,11 @@ static void e2k_tr_tb_stop(DisasContextBase *db, CPUState *cs)
case DISAS_NEXT:
case DISAS_TOO_MANY:
gen_goto_tb(dc, 0, dc->npc);
tcg_gen_exit_tb(NULL, 0);
break;
case DISAS_NORETURN:
break;
case DISAS_JUMP_STATIC:
gen_goto_tb(dc, 0, dc->jmp.dest);
tcg_gen_exit_tb(NULL, 0);
break;
case DISAS_BRANCH_STATIC: {
TCGv z = tcg_const_tl(0);

Loading…
Cancel
Save