aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-03-30 00:08:46 -0400
committerMike Frysinger <vapier@gentoo.org>2015-03-30 00:08:46 -0400
commit1e504675bdabc1861f2b2f515b6be3d99189e165 (patch)
treeebee8ae3e48d25ee374e04ee113b001c0711288b
parent5aedb83b9cbf22ce09719584479a21d905f438ff (diff)
downloadgdb-1e504675bdabc1861f2b2f515b6be3d99189e165.zip
gdb-1e504675bdabc1861f2b2f515b6be3d99189e165.tar.gz
gdb-1e504675bdabc1861f2b2f515b6be3d99189e165.tar.bz2
sim: cr16: delete dead code
This code is getting in the way of porting to nrun, so just drop it. If anyone actually cares about this cpu, they can revive it.
-rw-r--r--sim/cr16/ChangeLog10
-rw-r--r--sim/cr16/interp.c238
2 files changed, 10 insertions, 238 deletions
diff --git a/sim/cr16/ChangeLog b/sim/cr16/ChangeLog
index 20ac0b1..184d803 100644
--- a/sim/cr16/ChangeLog
+++ b/sim/cr16/ChangeLog
@@ -1,5 +1,15 @@
2015-03-29 Mike Frysinger <vapier@gentoo.org>
+ * interp.c (old_segment_mapping, ins_type_counters, add_commas,
+ set_dmap_register, set_imap_register, HELD_SPI_IDX, HELD_SPU_IDX,
+ spu_register, spi_register, set_spi_register, set_spu_register):
+ Delete.
+ (sim_cr16_translate_addr): Delete old_segment_mapping handling.
+ (sim_open): Likewise.
+ (sim_info): Delete function body.
+
+2015-03-29 Mike Frysinger <vapier@gentoo.org>
+
* Makefile.in (gencode.o, cr16-opc.o): Add $(WARN_CFLAGS).
(gencode): Add $(BUILD_LDFLAGS).
* endian.c (get_word, get_longword, get_longlong, write_word,
diff --git a/sim/cr16/interp.c b/sim/cr16/interp.c
index 338d9b7..c6d55f5 100644
--- a/sim/cr16/interp.c
+++ b/sim/cr16/interp.c
@@ -36,12 +36,7 @@ static char *myname;
static SIM_OPEN_KIND sim_kind;
int cr16_debug;
-/* Set this to true to get the previous segment layout. */
-
-int old_segment_mapping;
-
host_callback *cr16_callback;
-unsigned long ins_type_counters[ (int)INS_MAX ];
uint32 OP[4];
uint32 sign_flag;
@@ -426,28 +421,6 @@ do_run(uint64 mcode)
return h->size;
}
-#if 0
-static char *
-add_commas(char *buf, int sizeof_buf, unsigned long value)
-{
- int comma = 3;
- char *endbuf = buf + sizeof_buf - 1;
-
- *--endbuf = '\0';
- do {
- if (comma-- == 0)
- {
- *--endbuf = ',';
- comma = 2;
- }
-
- *--endbuf = (value % 10) + '0';
- } while ((value /= 10) != 0);
-
- return endbuf;
-}
-#endif
-
void
sim_size (int power)
{
@@ -485,23 +458,6 @@ enum
DMAP2_OFFSET = 0xff0c
};
-#if 0
-static void
-set_dmap_register (int reg_nr, unsigned long value)
-{
- uint8 *raw = map_memory (SIM_CR16_MEMORY_DATA
- + DMAP0_OFFSET + 2 * reg_nr);
- WRITE_16 (raw, value);
-#ifdef DEBUG
- if ((cr16_debug & DEBUG_MEMORY))
- {
- (*cr16_callback->printf_filtered)
- (cr16_callback, "mem: dmap%d=0x%04lx\n", reg_nr, value);
- }
-#endif
-}
-#endif
-
static unsigned long
dmap_register (void *regcache, int reg_nr)
{
@@ -510,23 +466,6 @@ dmap_register (void *regcache, int reg_nr)
return READ_16 (raw);
}
-#if 0
-static void
-set_imap_register (int reg_nr, unsigned long value)
-{
- uint8 *raw = map_memory (SIM_CR16_MEMORY_DATA
- + IMAP0_OFFSET + 2 * reg_nr);
- WRITE_16 (raw, value);
-#ifdef DEBUG
- if ((cr16_debug & DEBUG_MEMORY))
- {
- (*cr16_callback->printf_filtered)
- (cr16_callback, "mem: imap%d=0x%04lx\n", reg_nr, value);
- }
-#endif
-}
-#endif
-
static unsigned long
imap_register (void *regcache, int reg_nr)
{
@@ -535,38 +474,6 @@ imap_register (void *regcache, int reg_nr)
return READ_16 (raw);
}
-#if 0
-enum
- {
- HELD_SPI_IDX = 0,
- HELD_SPU_IDX = 1
- };
-
-static unsigned long
-spu_register (void)
-{
- return GPR (SP_IDX);
-}
-
-static unsigned long
-spi_register (void)
-{
- return GPR (SP_IDX);
-}
-
-static void
-set_spi_register (unsigned long value)
-{
- SET_GPR (SP_IDX, value);
-}
-
-static void
-set_spu_register (unsigned long value)
-{
- SET_GPR (SP_IDX, value);
-}
-#endif
-
/* Given a virtual address in the DMAP address space, translate it
into a physical address. */
@@ -704,31 +611,6 @@ sim_cr16_translate_addr (unsigned long memaddr, int nr_bytes,
seg = (memaddr >> 24);
off = (memaddr & 0xffffffL);
- /* However, if we've asked to use the previous generation of segment
- mapping, rearrange the segments as follows. */
-
- if (old_segment_mapping)
- {
- switch (seg)
- {
- case 0x00: /* DMAP translated memory */
- seg = 0x10;
- break;
- case 0x01: /* IMAP translated memory */
- seg = 0x11;
- break;
- case 0x10: /* On-chip data memory */
- seg = 0x02;
- break;
- case 0x11: /* On-chip insn memory */
- seg = 0x01;
- break;
- case 0x12: /* Unified memory */
- seg = 0x00;
- break;
- }
- }
-
switch (seg)
{
case 0x00: /* Physical unified memory */
@@ -916,27 +798,7 @@ sim_open (SIM_OPEN_KIND kind, struct host_callback_struct *callback, struct bfd
sim_kind = kind;
cr16_callback = callback;
myname = argv[0];
- old_segment_mapping = 0;
- /* NOTE: This argument parsing is only effective when this function
- is called by GDB. Standalone argument parsing is handled by
- sim/common/run.c. */
-#if 0
- for (p = argv + 1; *p; ++p)
- {
- if (strcmp (*p, "-oldseg") == 0)
- old_segment_mapping = 1;
-#ifdef DEBUG
- else if (strcmp (*p, "-t") == 0)
- cr16_debug = DEBUG;
- else if (strncmp (*p, "-t", 2) == 0)
- cr16_debug = atoi (*p + 2);
-#endif
- else
- (*cr16_callback->printf_filtered) (cr16_callback, "ERROR: unsupported option(s): %s\n",*p);
- }
-#endif
-
/* put all the opcodes in the hash table. */
if (!init_p++)
{
@@ -1259,106 +1121,6 @@ sim_set_trace (void)
void
sim_info (SIM_DESC sd, int verbose)
{
- char buf1[40];
- char buf2[40];
- char buf3[40];
- char buf4[40];
- char buf5[40];
-#if 0
- unsigned long left = ins_type_counters[ (int)INS_LEFT ] + ins_type_counters[ (int)INS_LEFT_COND_EXE ];
- unsigned long left_nops = ins_type_counters[ (int)INS_LEFT_NOPS ];
- unsigned long left_parallel = ins_type_counters[ (int)INS_LEFT_PARALLEL ];
- unsigned long left_cond = ins_type_counters[ (int)INS_LEFT_COND_TEST ];
- unsigned long left_total = left + left_parallel + left_cond + left_nops;
-
- unsigned long right = ins_type_counters[ (int)INS_RIGHT ] + ins_type_counters[ (int)INS_RIGHT_COND_EXE ];
- unsigned long right_nops = ins_type_counters[ (int)INS_RIGHT_NOPS ];
- unsigned long right_parallel = ins_type_counters[ (int)INS_RIGHT_PARALLEL ];
- unsigned long right_cond = ins_type_counters[ (int)INS_RIGHT_COND_TEST ];
- unsigned long right_total = right + right_parallel + right_cond + right_nops;
-
- unsigned long unknown = ins_type_counters[ (int)INS_UNKNOWN ];
- unsigned long ins_long = ins_type_counters[ (int)INS_LONG ];
- unsigned long parallel = ins_type_counters[ (int)INS_PARALLEL ];
- unsigned long leftright = ins_type_counters[ (int)INS_LEFTRIGHT ];
- unsigned long rightleft = ins_type_counters[ (int)INS_RIGHTLEFT ];
- unsigned long cond_true = ins_type_counters[ (int)INS_COND_TRUE ];
- unsigned long cond_false = ins_type_counters[ (int)INS_COND_FALSE ];
- unsigned long cond_jump = ins_type_counters[ (int)INS_COND_JUMP ];
- unsigned long cycles = ins_type_counters[ (int)INS_CYCLES ];
- unsigned long total = (unknown + left_total + right_total + ins_long);
-
- int size = strlen (add_commas (buf1, sizeof (buf1), total));
- int parallel_size = strlen (add_commas (buf1, sizeof (buf1),
- (left_parallel > right_parallel) ? left_parallel : right_parallel));
- int cond_size = strlen (add_commas (buf1, sizeof (buf1), (left_cond > right_cond) ? left_cond : right_cond));
- int nop_size = strlen (add_commas (buf1, sizeof (buf1), (left_nops > right_nops) ? left_nops : right_nops));
- int normal_size = strlen (add_commas (buf1, sizeof (buf1), (left > right) ? left : right));
-
- (*cr16_callback->printf_filtered) (cr16_callback,
- "executed %*s left instruction(s), %*s normal, %*s parallel, %*s EXExxx, %*s nops\n",
- size, add_commas (buf1, sizeof (buf1), left_total),
- normal_size, add_commas (buf2, sizeof (buf2), left),
- parallel_size, add_commas (buf3, sizeof (buf3), left_parallel),
- cond_size, add_commas (buf4, sizeof (buf4), left_cond),
- nop_size, add_commas (buf5, sizeof (buf5), left_nops));
-
- (*cr16_callback->printf_filtered) (cr16_callback,
- "executed %*s right instruction(s), %*s normal, %*s parallel, %*s EXExxx, %*s nops\n",
- size, add_commas (buf1, sizeof (buf1), right_total),
- normal_size, add_commas (buf2, sizeof (buf2), right),
- parallel_size, add_commas (buf3, sizeof (buf3), right_parallel),
- cond_size, add_commas (buf4, sizeof (buf4), right_cond),
- nop_size, add_commas (buf5, sizeof (buf5), right_nops));
-
- if (ins_long)
- (*cr16_callback->printf_filtered) (cr16_callback,
- "executed %*s long instruction(s)\n",
- size, add_commas (buf1, sizeof (buf1), ins_long));
-
- if (parallel)
- (*cr16_callback->printf_filtered) (cr16_callback,
- "executed %*s parallel instruction(s)\n",
- size, add_commas (buf1, sizeof (buf1), parallel));
-
- if (leftright)
- (*cr16_callback->printf_filtered) (cr16_callback,
- "executed %*s instruction(s) encoded L->R\n",
- size, add_commas (buf1, sizeof (buf1), leftright));
-
- if (rightleft)
- (*cr16_callback->printf_filtered) (cr16_callback,
- "executed %*s instruction(s) encoded R->L\n",
- size, add_commas (buf1, sizeof (buf1), rightleft));
-
- if (unknown)
- (*cr16_callback->printf_filtered) (cr16_callback,
- "executed %*s unknown instruction(s)\n",
- size, add_commas (buf1, sizeof (buf1), unknown));
-
- if (cond_true)
- (*cr16_callback->printf_filtered) (cr16_callback,
- "executed %*s instruction(s) due to EXExxx condition being true\n",
- size, add_commas (buf1, sizeof (buf1), cond_true));
-
- if (cond_false)
- (*cr16_callback->printf_filtered) (cr16_callback,
- "skipped %*s instruction(s) due to EXExxx condition being false\n",
- size, add_commas (buf1, sizeof (buf1), cond_false));
-
- if (cond_jump)
- (*cr16_callback->printf_filtered) (cr16_callback,
- "skipped %*s instruction(s) due to conditional branch succeeding\n",
- size, add_commas (buf1, sizeof (buf1), cond_jump));
-
- (*cr16_callback->printf_filtered) (cr16_callback,
- "executed %*s cycle(s)\n",
- size, add_commas (buf1, sizeof (buf1), cycles));
-
- (*cr16_callback->printf_filtered) (cr16_callback,
- "executed %*s total instructions\n",
- size, add_commas (buf1, sizeof (buf1), total));
-#endif
}
SIM_RC