aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@redhat.com>1998-12-01 13:28:53 +0000
committerFrank Ch. Eigler <fche@redhat.com>1998-12-01 13:28:53 +0000
commit3d7075f5f52a06393d1566a31bb1f6f6117775ce (patch)
treecb3a2a4de250201e80a7e1a22e62cad9a50ba8c0 /sim/common
parent1ab49c8481a99a4c1338c4d4cbc26887a0c85ad4 (diff)
downloadgdb-3d7075f5f52a06393d1566a31bb1f6f6117775ce.zip
gdb-3d7075f5f52a06393d1566a31bb1f6f6117775ce.tar.gz
gdb-3d7075f5f52a06393d1566a31bb1f6f6117775ce.tar.bz2
* A few more improvements to gx jit prototype.
[common/ChangeLog] 1998-12-01 Frank Ch. Eigler <fche@elastic.org> * sim-gx-run.c (sim_engine_run): Use new tgx_info struct to collect run-time arguments to gx block. * sim-gx.h (sim_gx_function): Corresponding signature change. * sim-gx.c (sim_gx_compiled_block_f): Remove nonfunctional code to again compile a gx block source file. (sim_gx_compiled_block_dispose): Uninstall obsoleted gx block shared libraries. (sim_gx_block_translate): Always emit new "gx_label_NNNN" labels, for basic block entry points, even if !__GNUC__. [m32r-gx/ChangeLog] 1998-12-01 Frank Ch. Eigler <fche@elastic.org> * Makefile.in (SIM_OBJS): Don't build sim-core.o. * configure.in: Added --enable-sim-inline support. Look for "getenv()" function. * configure: Rebuilt. * config.in: Rebuilt. * gx-translate.c: Include "sim-inline.c" for sim-core inlining. (m32r_gx_{load,store}*): Update signature. (tgx_emit_pre_function): Emit new "tgx_info" struct, update callback function signatures. (m32r_emit_*_insn): Use new callback signatures. For all short branches in optimized mode, emit direct "goto gx_label_NNNN". (tgx_optimize_test): If the GX_OPTIMIZE environment variable is set, allow its integer value to override the optimization heuristic. * m32r-sim.h: New empty placeholder file. * sim-main.c: New empty placeholder file. * sim-if.c (sim_create_inferior): Use NULL instead of &abort for unimplemented register fondling functions. * sim-main.h: Add multiple inclusion guard. Update callback function signatures. (tgx_info): New struct for collecting gx block invocation arguments.
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog15
-rw-r--r--sim/common/sim-gx-run.c7
-rw-r--r--sim/common/sim-gx.c57
-rw-r--r--sim/common/sim-gx.h4
4 files changed, 47 insertions, 36 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index b6356d7..daba533 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,18 @@
+start-sanitize-gxsim
+1998-12-01 Frank Ch. Eigler <fche@elastic.org>
+
+ * sim-gx-run.c (sim_engine_run): Use new tgx_info struct to
+ collect run-time arguments to gx block.
+ * sim-gx.h (sim_gx_function): Corresponding signature change.
+
+ * sim-gx.c (sim_gx_compiled_block_f): Remove nonfunctional code to
+ again compile a gx block source file.
+ (sim_gx_compiled_block_dispose): Uninstall obsoleted gx block
+ shared libraries.
+ (sim_gx_block_translate): Always emit new "gx_label_NNNN" labels,
+ for basic block entry points, even if !__GNUC__.
+
+end-sanitize-gxsim
1998-11-30 Doug Evans <devans@casey.cygnus.com>
* cgen-utils.c (cgen_virtual_opcode_table): Update.
diff --git a/sim/common/sim-gx-run.c b/sim/common/sim-gx-run.c
index a4d8865..ecd8716 100644
--- a/sim/common/sim-gx-run.c
+++ b/sim/common/sim-gx-run.c
@@ -88,7 +88,12 @@ sim_engine_run (SIM_DESC sd,
}
/* call into gx function */
- rc = (*f)(& cpu->regs, block->pc_flags, block->callbacks);
+ {
+ struct tgx_info info = {& cpu->regs,
+ block->pc_flags,
+ block->callbacks };
+ rc = (*f)(& info);
+ }
/* compute pc_flags checksum */
if(! optimized)
diff --git a/sim/common/sim-gx.c b/sim/common/sim-gx.c
index c2966fe..b8cbbbd 100644
--- a/sim/common/sim-gx.c
+++ b/sim/common/sim-gx.c
@@ -54,33 +54,6 @@ sim_gx_compiled_block_f(sim_gx_compiled_block* gx)
if(f == NULL)
{
- /* compile object */
- if(gx->object_name == NULL && gx->source_name != NULL)
- {
- char compile_command[2000];
-
- gx->object_name = strdup(gx->source_name);
- /* turn *.c into *.o */
- gx->object_name[strlen(gx->object_name)]='o';
-
- /* compute command string to compile object */
- sprintf(compile_command,
- "make -f %s OBJ=%s SRC=%s gx",
-#define GX_MAKEFILE "--no-makefile-yet--"
- GX_MAKEFILE,
- gx->object_name,
- gx->source_name);
-
- rc = system(compile_command);
- if(rc != 0)
- {
- sim_io_error(sd, "Compile error rc %d for GX source %s: %s",
- rc,
- gx->source_name,
- strerror(errno));
- }
- }
-
/* load object */
if(gx->object_dlhandle == NULL && gx->object_name != NULL)
{
@@ -119,6 +92,8 @@ sim_gx_compiled_block_dispose(sim_gx_compiled_block* gx)
{
SIM_DESC sd = current_state;
int rc;
+ char compile_command[2000];
+ char la_name[2000];
/* forget dl information */
gx->function_dlhandle = NULL;
@@ -136,6 +111,23 @@ sim_gx_compiled_block_dispose(sim_gx_compiled_block* gx)
gx->object_dlhandle = NULL;
}
+ /* uninstall shared object */
+
+ strcpy(la_name, gx->object_name);
+ strcpy(strstr(la_name, ".so.0"), ".la");
+ sprintf(compile_command, "gxtool --mode=uninstall rm -f %s", la_name);
+
+ rc = system(compile_command);
+ if(rc != 0)
+ {
+ sim_io_error(sd, "Error during finish: `%s' rc %d",
+ compile_command, rc);
+ }
+
+
+ /* erase source */
+ /* sprintf(compile_command, "rm -f %s", block->source_name); */
+
/* final gasps */
zfree(gx->source_name);
zfree(gx->object_name);
@@ -363,7 +355,7 @@ sim_gx_read_block_list()
sim_gx_block_add(gx);
}
- print_gx_blocks(STATE_BLOCKS(sd), "after restoring state");
+ /* print_gx_blocks(STATE_BLOCKS(sd), "after restoring state"); */
}
@@ -569,7 +561,7 @@ sim_gx_block_translate(sim_gx_block* gx, int optimized)
fprintf(block->source_file, "\n\n");
fprintf(block->source_file, "extern int\n");
fprintf(block->source_file, "%s", block->symbol_name);
- fprintf(block->source_file, "(struct tgx_cpu_regs* regs, char* pc_flags, struct tgx_callbacks* callbacks)\n");
+ fprintf(block->source_file, "(struct tgx_info* info)\n");
fprintf(block->source_file, "{\n");
fprintf(block->source_file, " int rc = 0;\n");
if(! optimized)
@@ -684,13 +676,12 @@ 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, "#ifndef __GNUC__\n");
fprintf(block->source_file, " case %ld:\n",
((gx_cia - gx->origin) / gx->divisor));
- fprintf(block->source_file, "#endif /*__GNUC__*/\n");
+ fprintf(block->source_file, "#endif /* !__GNUC__ */\n");
}
/* translate breakpoint check & exit */
@@ -821,7 +812,7 @@ sim_gx_block_translate(sim_gx_block* gx, int optimized)
/* clean up */
- sprintf(compile_command, "rm -f lib%s.la %s.lo", base_name, base_name);
+ sprintf(compile_command, "gxtool --silent --mode=uninstall rm -f lib%s.la %s.lo", base_name, base_name);
rc = system(compile_command);
if(rc != 0)
{
diff --git a/sim/common/sim-gx.h b/sim/common/sim-gx.h
index b0d0673..b7a815e 100644
--- a/sim/common/sim-gx.h
+++ b/sim/common/sim-gx.h
@@ -92,8 +92,8 @@ typedef struct sim_gx_block_list
/* actual gx function pointer type */
-struct tgx_cpu_regs;
-typedef int (*sim_gx_function)(struct tgx_cpu_regs* cpu, char* pc_flags, struct tgx_callbacks* callbacks);
+struct tgx_info;
+typedef int (*sim_gx_function)(struct tgx_info* info);
/* return values from gx function */