aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@redhat.com>1998-11-21 19:05:09 +0000
committerFrank Ch. Eigler <fche@redhat.com>1998-11-21 19:05:09 +0000
commit42647d5b8c69603ea53b6c31d19c004a0608d82e (patch)
tree859fdbadae90231e686733ddd196e6564d42b7d3 /sim
parent821b702f92c049761c98c1c98126e49a3c45ac69 (diff)
downloadgdb-42647d5b8c69603ea53b6c31d19c004a0608d82e.zip
gdb-42647d5b8c69603ea53b6c31d19c004a0608d82e.tar.gz
gdb-42647d5b8c69603ea53b6c31d19c004a0608d82e.tar.bz2
* mild gx prototype tweak
start-sanitize-gxsim 1998-11-21 Frank Ch. Eigler <fche@elastic.org> * sim-gx.c (sim_gx_block_translate): Generate computed goto for __GNUC__ instead of plain switch() for gx block entry. Lose "-g" compile option for gx block. end-sanitize-gxsim
Diffstat (limited to 'sim')
-rw-r--r--sim/common/ChangeLog8
-rw-r--r--sim/common/sim-gx.c44
2 files changed, 48 insertions, 4 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index eb82a7b..c2cf5b4 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,11 @@
+start-sanitize-gxsim
+1998-11-21 Frank Ch. Eigler <fche@elastic.org>
+
+ * sim-gx.c (sim_gx_block_translate): Generate computed
+ goto for __GNUC__ instead of plain switch() for gx block
+ entry. Lose "-g" compile option for gx block.
+
+end-sanitize-gxsim
1998-11-18 Doug Evans <devans@casey.cygnus.com>
* Make-common.in (cgen-utils.o): Depend on cgen-engine.h.
diff --git a/sim/common/sim-gx.c b/sim/common/sim-gx.c
index d8d3487..c2966fe 100644
--- a/sim/common/sim-gx.c
+++ b/sim/common/sim-gx.c
@@ -7,7 +7,6 @@
#include "sim-gx.h"
#include "config.h"
-/* #include "cconfig.h" */
/* shared object functions */
#ifdef HAVE_DLFCN_H
@@ -576,6 +575,29 @@ sim_gx_block_translate(sim_gx_block* gx, int optimized)
if(! optimized)
fprintf(block->source_file, " unsigned int insn_count = 0;\n");
+ /* emit threaded goto vector for __GNUC__ */
+ fprintf(block->source_file, "#ifdef __GNUC__\n");
+ fprintf(block->source_file, " static void* jump_table[] =\n");
+ fprintf(block->source_file, " {\n");
+ gx_cia = gx->origin;
+ while(GX_PC_INCLUDES(gx,gx_cia))
+ {
+ sim_cia next_gx_cia;
+ if((! optimized) ||
+ (GX_PC_FLAGS(gx, gx_cia) & GX_PCF_JUMPTARGET))
+ {
+ fprintf(block->source_file, " && gx_label_%ld,\n",
+ ((gx_cia - gx->origin) / gx->divisor));
+ }
+ else
+ {
+ fprintf(block->source_file, " && gx_label_default,\n");
+ }
+ gx_cia = gx_cia + gx->divisor;
+ }
+ fprintf(block->source_file, " };\n");
+ fprintf(block->source_file, "#endif /*__GNUC__*/\n");
+
/* pre-block gunk: register load */
tgx_emit_load_block(gx, optimized);
@@ -605,13 +627,22 @@ sim_gx_block_translate(sim_gx_block* gx, int optimized)
/* emit PC switch, use compressed case numbers */
fprintf(block->source_file, "\n");
+ fprintf(block->source_file, "#ifdef __GNUC__\n");
+ fprintf(block->source_file, " goto * jump_table[((pc - 0x%08x) / %u)];\n",
+ (unsigned)gx->origin, gx->divisor);
+ fprintf(block->source_file, "#else /* ! __GNUC__*/\n");
fprintf(block->source_file, " switch((pc - 0x%08x) / %u)\n",
(unsigned)gx->origin, gx->divisor);
+ fprintf(block->source_file, "#endif /*__GNUC__*/\n");
fprintf(block->source_file, " {\n");
/* handle bad-PC event */
fprintf(block->source_file, " /* handle unknown jump target */\n");
+ fprintf(block->source_file, "#ifdef __GNUC__\n");
+ fprintf(block->source_file, " gx_label_default:\n");
+ fprintf(block->source_file, "#else /* ! __GNUC__*/\n");
fprintf(block->source_file, " default:\n");
+ fprintf(block->source_file, "#endif /*__GNUC__*/\n");
fprintf(block->source_file, " rc = %d;\n", GX_F_NONPC);
fprintf(block->source_file, " npc = pc;\n");
fprintf(block->source_file, " goto save;\n");
@@ -653,8 +684,13 @@ sim_gx_block_translate(sim_gx_block* gx, int optimized)
if((! optimized) ||
(GX_PC_FLAGS(gx, gx_cia) & GX_PCF_JUMPTARGET))
{
+ fprintf(block->source_file, "#ifdef __GNUC__\n");
+ fprintf(block->source_file, " gx_label_%ld:\n",
+ ((gx_cia - gx->origin) / gx->divisor));
+ fprintf(block->source_file, "#else /* ! __GNUC__*/\n");
fprintf(block->source_file, " case %ld:\n",
((gx_cia - gx->origin) / gx->divisor));
+ fprintf(block->source_file, "#endif /*__GNUC__*/\n");
}
/* translate breakpoint check & exit */
@@ -732,8 +768,8 @@ sim_gx_block_translate(sim_gx_block* gx, int optimized)
/* compile source & produce shared object */
sprintf(compile_command,
- "gxtool --silent --mode=compile gcc -c -g %s %s",
- (optimized ? "-O3" : "-O"), block->source_name);
+ "gxtool --silent --mode=compile gcc -c %s %s",
+ (optimized ? "-O9 -fomit-frame-pointer" : "-O"), block->source_name);
rc = system(compile_command);
if(rc != 0)
@@ -745,7 +781,7 @@ sim_gx_block_translate(sim_gx_block* gx, int optimized)
/* link source */
sprintf(compile_command,
- "gxtool --silent --mode=link gcc -export-dynamic -rpath %s -g -o lib%s.la %s.lo",
+ "gxtool --silent --mode=link gcc -export-dynamic -rpath %s -o lib%s.la %s.lo",
dir_name, base_name, base_name);
rc = system(compile_command);