diff options
Diffstat (limited to 'sim')
-rw-r--r-- | sim/common/ChangeLog | 15 | ||||
-rw-r--r-- | sim/common/sim-gx-run.c | 7 | ||||
-rw-r--r-- | sim/common/sim-gx.c | 57 | ||||
-rw-r--r-- | sim/common/sim-gx.h | 4 | ||||
-rw-r--r-- | sim/m32r-gx/ChangeLog | 24 | ||||
-rw-r--r-- | sim/m32r-gx/Makefile.in | 2 | ||||
-rw-r--r-- | sim/m32r-gx/config.in | 3 | ||||
-rwxr-xr-x | sim/m32r-gx/configure | 382 | ||||
-rw-r--r-- | sim/m32r-gx/configure.in | 2 | ||||
-rw-r--r-- | sim/m32r-gx/gx-translate.c | 345 | ||||
-rw-r--r-- | sim/m32r-gx/m32r-sim.h | 1 | ||||
-rw-r--r-- | sim/m32r-gx/sim-if.c | 4 | ||||
-rw-r--r-- | sim/m32r-gx/sim-main.c | 1 | ||||
-rw-r--r-- | sim/m32r-gx/sim-main.h | 31 |
14 files changed, 614 insertions, 264 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 */ diff --git a/sim/m32r-gx/ChangeLog b/sim/m32r-gx/ChangeLog index 9905bf3..ad03dac 100644 --- a/sim/m32r-gx/ChangeLog +++ b/sim/m32r-gx/ChangeLog @@ -1,3 +1,27 @@ +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. + 1998-11-13 Frank Ch. Eigler <fche@elastic.org> * (*): New files: snapshot of gx simulator prototype. diff --git a/sim/m32r-gx/Makefile.in b/sim/m32r-gx/Makefile.in index d3c651e..6ce7893 100644 --- a/sim/m32r-gx/Makefile.in +++ b/sim/m32r-gx/Makefile.in @@ -29,7 +29,6 @@ SIM_OBJS = \ sim-bits.o \ sim-break.o \ sim-config.o \ - sim-core.o \ sim-endian.o \ sim-events.o \ sim-fpu.o \ @@ -46,7 +45,6 @@ SIM_OBJS = \ sim-watch.o \ sim-cpu.o \ sim-engine.o \ - sim-core.o \ sim-hload.o \ sim-hrw.o \ sim-reason.o \ diff --git a/sim/m32r-gx/config.in b/sim/m32r-gx/config.in index f0f9414..a83f3a3 100644 --- a/sim/m32r-gx/config.in +++ b/sim/m32r-gx/config.in @@ -80,6 +80,9 @@ /* Define if you have the getcwd function. */ #undef HAVE_GETCWD +/* Define if you have the getenv function. */ +#undef HAVE_GETENV + /* Define if you have the getpagesize function. */ #undef HAVE_GETPAGESIZE diff --git a/sim/m32r-gx/configure b/sim/m32r-gx/configure index 1423a06..b9a71be 100755 --- a/sim/m32r-gx/configure +++ b/sim/m32r-gx/configure @@ -171,6 +171,8 @@ ac_help="$ac_help --enable-sim-default-model=model Specify default model to simulate." ac_help="$ac_help --enable-sim-environment=environment Specify mixed, user, virtual or operating environment." +ac_help="$ac_help + --enable-sim-inline=inlines Specify which functions should be inlined." # Initialize some variables set by options. # The variables have the same names as the options, with @@ -684,7 +686,7 @@ fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:688: checking how to run the C preprocessor" >&5 +echo "configure:690: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -699,13 +701,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 703 "configure" +#line 705 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:709: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:711: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -716,13 +718,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 720 "configure" +#line 722 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:726: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:728: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -733,13 +735,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 737 "configure" +#line 739 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:743: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:745: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -764,7 +766,7 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:768: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:770: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -791,7 +793,7 @@ else fi echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:795: checking for POSIXized ISC" >&5 +echo "configure:797: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -812,12 +814,12 @@ else fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:816: checking for ANSI C header files" >&5 +echo "configure:818: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 821 "configure" +#line 823 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -825,7 +827,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:829: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:831: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -842,7 +844,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 846 "configure" +#line 848 "configure" #include "confdefs.h" #include <string.h> EOF @@ -860,7 +862,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 864 "configure" +#line 866 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -881,7 +883,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 885 "configure" +#line 887 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -892,7 +894,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:896: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:898: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -916,12 +918,12 @@ EOF fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:920: checking for working const" >&5 +echo "configure:922: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 925 "configure" +#line 927 "configure" #include "confdefs.h" int main() { @@ -970,7 +972,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:974: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:976: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -991,21 +993,21 @@ EOF fi echo $ac_n "checking for inline""... $ac_c" 1>&6 -echo "configure:995: checking for inline" >&5 +echo "configure:997: checking for inline" >&5 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat > conftest.$ac_ext <<EOF -#line 1002 "configure" +#line 1004 "configure" #include "confdefs.h" int main() { } $ac_kw foo() { ; return 0; } EOF -if { (eval echo configure:1009: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1011: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_inline=$ac_kw; break else @@ -1031,12 +1033,12 @@ EOF esac echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:1035: checking for off_t" >&5 +echo "configure:1037: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1040 "configure" +#line 1042 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1064,12 +1066,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1068: checking for size_t" >&5 +echo "configure:1070: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1073 "configure" +#line 1075 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1099,19 +1101,19 @@ fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:1103: checking for working alloca.h" >&5 +echo "configure:1105: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1108 "configure" +#line 1110 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:1115: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1117: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -1132,12 +1134,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:1136: checking for alloca" >&5 +echo "configure:1138: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1141 "configure" +#line 1143 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -1165,7 +1167,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:1169: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1171: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -1197,12 +1199,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:1201: checking whether alloca needs Cray hooks" >&5 +echo "configure:1203: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1206 "configure" +#line 1208 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -1227,12 +1229,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1231: checking for $ac_func" >&5 +echo "configure:1233: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1236 "configure" +#line 1238 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1255,7 +1257,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1259: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1261: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1282,7 +1284,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:1286: checking stack direction for C alloca" >&5 +echo "configure:1288: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1290,7 +1292,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 1294 "configure" +#line 1296 "configure" #include "confdefs.h" find_stack_direction () { @@ -1309,7 +1311,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:1313: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1315: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -1334,17 +1336,17 @@ for ac_hdr in unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1338: checking for $ac_hdr" >&5 +echo "configure:1340: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1343 "configure" +#line 1345 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1348: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1350: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1373,12 +1375,12 @@ done for ac_func in getpagesize do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1377: checking for $ac_func" >&5 +echo "configure:1379: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1382 "configure" +#line 1384 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1401,7 +1403,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1407: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1426,7 +1428,7 @@ fi done echo $ac_n "checking for working mmap""... $ac_c" 1>&6 -echo "configure:1430: checking for working mmap" >&5 +echo "configure:1432: checking for working mmap" >&5 if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1434,7 +1436,7 @@ else ac_cv_func_mmap_fixed_mapped=no else cat > conftest.$ac_ext <<EOF -#line 1438 "configure" +#line 1440 "configure" #include "confdefs.h" /* Thanks to Mike Haertel and Jim Avera for this test. @@ -1574,7 +1576,7 @@ main() } EOF -if { (eval echo configure:1578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_mmap_fixed_mapped=yes else @@ -1647,7 +1649,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:1651: checking host system type" >&5 +echo "configure:1653: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -1668,7 +1670,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$host" 1>&6 echo $ac_n "checking target system type""... $ac_c" 1>&6 -echo "configure:1672: checking target system type" >&5 +echo "configure:1674: checking target system type" >&5 target_alias=$target case "$target_alias" in @@ -1686,7 +1688,7 @@ target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$ac_t""$target" 1>&6 echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:1690: checking build system type" >&5 +echo "configure:1692: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -1730,7 +1732,7 @@ test "$program_transform_name" = "" && program_transform_name="s,x,x," # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1734: checking for $ac_word" >&5 +echo "configure:1736: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1759,7 +1761,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1763: checking for $ac_word" >&5 +echo "configure:1765: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1809,7 +1811,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1813: checking for $ac_word" >&5 +echo "configure:1815: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1840,7 +1842,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1844: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1846: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1850,11 +1852,11 @@ ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$a cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <<EOF -#line 1854 "configure" +#line 1856 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1858: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1874,12 +1876,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1878: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1880: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1883: checking whether we are using GNU C" >&5 +echo "configure:1885: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1888,7 +1890,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1892: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1894: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1907,7 +1909,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1911: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1913: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1950,7 +1952,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1954: checking for a BSD compatible install" >&5 +echo "configure:1956: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2016,7 +2018,7 @@ AR=${AR-ar} # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2020: checking for $ac_word" >&5 +echo "configure:2022: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2050,17 +2052,17 @@ unistd.h values.h sys/param.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2054: checking for $ac_hdr" >&5 +echo "configure:2056: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2059 "configure" +#line 2061 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2064: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2066: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2090,12 +2092,12 @@ done __argz_count __argz_stringify __argz_next do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2094: checking for $ac_func" >&5 +echo "configure:2096: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2099 "configure" +#line 2101 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2118,7 +2120,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2122: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2124: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2147,12 +2149,12 @@ done for ac_func in stpcpy do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2151: checking for $ac_func" >&5 +echo "configure:2153: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2156 "configure" +#line 2158 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2175,7 +2177,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2181: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2209,19 +2211,19 @@ EOF if test $ac_cv_header_locale_h = yes; then echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 -echo "configure:2213: checking for LC_MESSAGES" >&5 +echo "configure:2215: checking for LC_MESSAGES" >&5 if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2218 "configure" +#line 2220 "configure" #include "confdefs.h" #include <locale.h> int main() { return LC_MESSAGES ; return 0; } EOF -if { (eval echo configure:2225: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* am_cv_val_LC_MESSAGES=yes else @@ -2242,7 +2244,7 @@ EOF fi fi echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 -echo "configure:2246: checking whether NLS is requested" >&5 +echo "configure:2248: checking whether NLS is requested" >&5 # Check whether --enable-nls or --disable-nls was given. if test "${enable_nls+set}" = set; then enableval="$enable_nls" @@ -2262,7 +2264,7 @@ fi EOF echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 -echo "configure:2266: checking whether included gettext is requested" >&5 +echo "configure:2268: checking whether included gettext is requested" >&5 # Check whether --with-included-gettext or --without-included-gettext was given. if test "${with_included_gettext+set}" = set; then withval="$with_included_gettext" @@ -2281,17 +2283,17 @@ fi ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 -echo "configure:2285: checking for libintl.h" >&5 +echo "configure:2287: checking for libintl.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2290 "configure" +#line 2292 "configure" #include "confdefs.h" #include <libintl.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2295: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2297: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2308,19 +2310,19 @@ fi if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 -echo "configure:2312: checking for gettext in libc" >&5 +echo "configure:2314: checking for gettext in libc" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2317 "configure" +#line 2319 "configure" #include "confdefs.h" #include <libintl.h> int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:2324: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2326: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libc=yes else @@ -2336,7 +2338,7 @@ echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 if test "$gt_cv_func_gettext_libc" != "yes"; then echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 -echo "configure:2340: checking for bindtextdomain in -lintl" >&5 +echo "configure:2342: checking for bindtextdomain in -lintl" >&5 ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2344,7 +2346,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <<EOF -#line 2348 "configure" +#line 2350 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -2355,7 +2357,7 @@ int main() { bindtextdomain() ; return 0; } EOF -if { (eval echo configure:2359: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2361: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2371,19 +2373,19 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 -echo "configure:2375: checking for gettext in libintl" >&5 +echo "configure:2377: checking for gettext in libintl" >&5 if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2380 "configure" +#line 2382 "configure" #include "confdefs.h" int main() { return (int) gettext ("") ; return 0; } EOF -if { (eval echo configure:2387: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* gt_cv_func_gettext_libintl=yes else @@ -2411,7 +2413,7 @@ EOF # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2415: checking for $ac_word" >&5 +echo "configure:2417: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2445,12 +2447,12 @@ fi for ac_func in dcgettext do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2449: checking for $ac_func" >&5 +echo "configure:2451: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2454 "configure" +#line 2456 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2473,7 +2475,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2477: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2500,7 +2502,7 @@ done # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2504: checking for $ac_word" >&5 +echo "configure:2506: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2535,7 +2537,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2539: checking for $ac_word" >&5 +echo "configure:2541: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2567,7 +2569,7 @@ else fi cat > conftest.$ac_ext <<EOF -#line 2571 "configure" +#line 2573 "configure" #include "confdefs.h" int main() { @@ -2575,7 +2577,7 @@ extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr ; return 0; } EOF -if { (eval echo configure:2579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2581: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* CATOBJEXT=.gmo DATADIRNAME=share @@ -2607,7 +2609,7 @@ fi # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2611: checking for $ac_word" >&5 +echo "configure:2613: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2641,7 +2643,7 @@ fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2645: checking for $ac_word" >&5 +echo "configure:2647: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2676,7 +2678,7 @@ fi # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2680: checking for $ac_word" >&5 +echo "configure:2682: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2766,7 +2768,7 @@ fi LINGUAS= else echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 -echo "configure:2770: checking for catalogs to be installed" >&5 +echo "configure:2772: checking for catalogs to be installed" >&5 NEW_LINGUAS= for lang in ${LINGUAS=$ALL_LINGUAS}; do case "$ALL_LINGUAS" in @@ -2794,17 +2796,17 @@ echo "configure:2770: checking for catalogs to be installed" >&5 if test "$CATOBJEXT" = ".cat"; then ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 -echo "configure:2798: checking for linux/version.h" >&5 +echo "configure:2800: checking for linux/version.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2803 "configure" +#line 2805 "configure" #include "confdefs.h" #include <linux/version.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2808: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2810: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2873,17 +2875,17 @@ for ac_hdr in stdlib.h string.h strings.h unistd.h time.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2877: checking for $ac_hdr" >&5 +echo "configure:2879: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2882 "configure" +#line 2884 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2887: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2889: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2913,17 +2915,17 @@ for ac_hdr in sys/time.h sys/resource.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2917: checking for $ac_hdr" >&5 +echo "configure:2919: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2922 "configure" +#line 2924 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2927: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2929: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2953,17 +2955,17 @@ for ac_hdr in fcntl.h fpu_control.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2957: checking for $ac_hdr" >&5 +echo "configure:2959: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2962 "configure" +#line 2964 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2967: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2969: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2993,17 +2995,17 @@ for ac_hdr in dlfcn.h errno.h sys/stat.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2997: checking for $ac_hdr" >&5 +echo "configure:2999: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3002 "configure" +#line 3004 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3007: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3009: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3032,12 +3034,12 @@ done for ac_func in getrusage time sigaction __setfpucw do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3036: checking for $ac_func" >&5 +echo "configure:3038: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3041 "configure" +#line 3043 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3060,7 +3062,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3064: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3087,7 +3089,7 @@ done # Check for socket libraries echo $ac_n "checking for bind in -lsocket""... $ac_c" 1>&6 -echo "configure:3091: checking for bind in -lsocket" >&5 +echo "configure:3093: checking for bind in -lsocket" >&5 ac_lib_var=`echo socket'_'bind | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3095,7 +3097,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <<EOF -#line 3099 "configure" +#line 3101 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3106,7 +3108,7 @@ int main() { bind() ; return 0; } EOF -if { (eval echo configure:3110: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3112: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3134,7 +3136,7 @@ else fi echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:3138: checking for gethostbyname in -lnsl" >&5 +echo "configure:3140: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3142,7 +3144,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <<EOF -#line 3146 "configure" +#line 3148 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3153,7 +3155,7 @@ int main() { gethostbyname() ; return 0; } EOF -if { (eval echo configure:3157: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3159: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3329,12 +3331,12 @@ fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:3333: checking return type of signal handlers" >&5 +echo "configure:3335: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3338 "configure" +#line 3340 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -3351,7 +3353,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:3355: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3357: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -3371,7 +3373,7 @@ EOF echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:3375: checking for executable suffix" >&5 +echo "configure:3377: checking for executable suffix" >&5 if eval "test \"`echo '$''{'am_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3531,14 +3533,14 @@ else if test "x$cross_compiling" = "xno"; then echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:3535: checking whether byte ordering is bigendian" >&5 +echo "configure:3537: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext <<EOF -#line 3542 "configure" +#line 3544 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> @@ -3549,11 +3551,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:3553: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3555: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext <<EOF -#line 3557 "configure" +#line 3559 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> @@ -3564,7 +3566,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:3568: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3570: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -3584,7 +3586,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 3588 "configure" +#line 3590 "configure" #include "confdefs.h" main () { /* Are we little or big endian? From Harbison&Steele. */ @@ -3597,7 +3599,7 @@ main () { exit (u.c[sizeof (long) - 1] == 1); } EOF -if { (eval echo configure:3601: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3603: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -3667,8 +3669,53 @@ else fi +default_sim_inline="" +# Check whether --enable-sim-inline or --disable-sim-inline was given. +if test "${enable_sim_inline+set}" = set; then + enableval="$enable_sim_inline" + sim_inline="" +case "$enableval" in + no) sim_inline="-DDEFAULT_INLINE=0";; + 0) sim_inline="-DDEFAULT_INLINE=0";; + yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_C_INLINE";; + 1) sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS";; + *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do + new_flag="" + case "$x" in + *_INLINE=*) new_flag="-D$x";; + *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;; + *_INLINE) new_flag="-D$x=ALL_C_INLINE";; + *) new_flag="-D$x""_INLINE=ALL_C_INLINE";; + esac + if test x"$sim_inline" = x""; then + sim_inline="$new_flag" + else + sim_inline="$sim_inline $new_flag" + fi + done;; +esac +if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then + echo "Setting inline flags = $sim_inline" 6>&1 +fi +else + +if test "x$cross_compiling" = "xno"; then + if test x"$GCC" != "x" -a x"${default_sim_inline}" != "x" ; then + sim_inline="${default_sim_inline}" + if test x"$silent" != x"yes"; then + echo "Setting inline flags = $sim_inline" 6>&1 + fi + else + sim_inline="" + fi +else + sim_inline="-DDEFAULT_INLINE=0" +fi +fi + + echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:3672: checking for dlopen in -ldl" >&5 +echo "configure:3719: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3676,7 +3723,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 3680 "configure" +#line 3727 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3687,7 +3734,7 @@ int main() { dlopen() ; return 0; } EOF -if { (eval echo configure:3691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3738: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3714,6 +3761,61 @@ else echo "$ac_t""no" 1>&6 fi +for ac_func in getenv +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3768: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3773 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + diff --git a/sim/m32r-gx/configure.in b/sim/m32r-gx/configure.in index ce1851b..bcfdd8c 100644 --- a/sim/m32r-gx/configure.in +++ b/sim/m32r-gx/configure.in @@ -17,8 +17,10 @@ SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT) SIM_AC_OPTION_HOSTENDIAN SIM_AC_OPTION_DEFAULT_MODEL(m32r/d) SIM_AC_OPTION_ENVIRONMENT +SIM_AC_OPTION_INLINE AC_CHECK_LIB(dl, dlopen) +AC_CHECK_FUNCS(getenv) SIM_AC_OUTPUT diff --git a/sim/m32r-gx/gx-translate.c b/sim/m32r-gx/gx-translate.c index 0a43477..461417c 100644 --- a/sim/m32r-gx/gx-translate.c +++ b/sim/m32r-gx/gx-translate.c @@ -10,6 +10,7 @@ #include "sim-main.h" #include "sim-base.h" #include "sim-core.h" +#include "sim-inline.c" #include "sim-gx.h" #include "sim-assert.h" #include "targ-vals.h" @@ -20,13 +21,13 @@ void m32r_emit_long_insn(sim_gx_block* block, PCADDR pc, unsigned insn, int opti void m32r_emit_short_insn(sim_gx_block* block, PCADDR pc, unsigned insn, int optimized); /* callback functions */ -unsigned m32r_gx_load(unsigned pc, unsigned addr); -void m32r_gx_store(unsigned pc, unsigned addr, unsigned data); -signed char m32r_gx_load1(unsigned pc, unsigned addr); -void m32r_gx_store1(unsigned pc, unsigned addr, signed char data); -signed short m32r_gx_load2(unsigned pc, unsigned addr); -void m32r_gx_store2(unsigned pc, unsigned addr, signed short data); -void m32r_gx_syscall(tgx_syscall_data* data); +unsigned m32r_gx_load(tgx_info* info, unsigned pc, unsigned addr); +void m32r_gx_store(tgx_info* info, unsigned pc, unsigned addr, unsigned data); +signed char m32r_gx_load1(tgx_info* info, unsigned pc, unsigned addr); +void m32r_gx_store1(tgx_info* info, unsigned pc, unsigned addr, signed char data); +signed short m32r_gx_load2(tgx_info* info, unsigned pc, unsigned addr); +void m32r_gx_store2(tgx_info* info, unsigned pc, unsigned addr, signed short data); +void m32r_gx_syscall(tgx_info* info, tgx_syscall_data* data); @@ -106,16 +107,33 @@ tgx_emit_pre_function(sim_gx_block* gx, int optimized) "} tgx_syscall_data;\n"); fprintf(block->source_file, /* match with definition in sim-main.h! */ + "struct tgx_info;\n" "typedef struct tgx_callbacks\n" "{\n" - " unsigned (*load)(unsigned pc, unsigned addr);\n" - " void (*store)(unsigned pc, unsigned addr, unsigned data);\n" - " signed char (*load1)(unsigned pc, unsigned addr);\n" - " void (*store1)(unsigned pc, unsigned addr, signed char data);\n" - " signed short (*load2)(unsigned pc, unsigned addr);\n" - " void (*store2)(unsigned pc, unsigned addr, signed short data);\n" - " void (*syscall)(tgx_syscall_data* data);\n" + " unsigned (*load)(struct tgx_info* info, unsigned pc, unsigned addr);\n" + " void (*store)(struct tgx_info* info, unsigned pc, unsigned addr, unsigned data);\n" + " signed char (*load1)(struct tgx_info* info, unsigned pc, unsigned addr);\n" + " void (*store1)(struct tgx_info* info, unsigned pc, unsigned addr, signed char data);\n" + " signed short (*load2)(struct tgx_info* info, unsigned pc, unsigned addr);\n" + " void (*store2)(struct tgx_info* info, unsigned pc, unsigned addr, signed short data);\n" + " void (*syscall)(struct tgx_info* info, tgx_syscall_data* data);\n" "} tgx_callbacks;\n"); + + fprintf(block->source_file, /* match with definition in sim-main.h! */ + "typedef struct tgx_mapping_cache\n" + "{\n" + " unsigned base;\n" + " unsigned bound;\n" + " void* buffer;\n" + "} tgx_mapping_cache;\n"); + + fprintf(block->source_file, /* match with definition in sim-main.h! */ + "typedef struct tgx_info\n" + "{\n" + " struct tgx_cpu_regs* regs;\n" + " char* pc_flags;\n" + " struct tgx_callbacks* callbacks;\n" + "} tgx_info;\n"); } @@ -127,6 +145,10 @@ tgx_emit_load_block(sim_gx_block* gx, int optimized) ASSERT(block->source_file != NULL); fprintf(block->source_file, /* match with definition above */ + " tgx_cpu_regs* regs = info->regs;\n" + " tgx_callbacks* callbacks = info->callbacks;\n" + " char* pc_flags = info->pc_flags;\n" + "\n" " unsigned int pc = regs->h_pc;\n" " unsigned int npc = pc;\n" " signed int temp;\n" @@ -252,12 +274,20 @@ tgx_optimize_test(sim_gx_block* block) unsigned_4 current_time = time(NULL); unsigned_4 constant_time = current_time - block->learn_last_change; int opt; + char* env; /* try another optimize run if the system has settled down */ opt = (block->compile_time != 0 && block->learn_last_change != 0 && constant_time > block->compile_time); + /* allow override by environment variable */ +#ifdef HAVE_GETENV + env = getenv("GX_OPTIMIZE"); + if(env) + opt = atoi(env); +#endif + /* if(opt) printf("optimize_test: now: %d, chg: %d, comp: %d, count: %d => opt %d\n", @@ -271,7 +301,7 @@ tgx_optimize_test(sim_gx_block* block) unsigned -m32r_gx_load(unsigned pc, unsigned addr) +m32r_gx_load(struct tgx_info* info, unsigned pc, unsigned addr) { SIM_DESC sd = CURRENT_STATE; sim_cpu* cpu = STATE_CPU (sd, 0); @@ -282,7 +312,7 @@ m32r_gx_load(unsigned pc, unsigned addr) void -m32r_gx_store(unsigned pc, unsigned addr, unsigned data) +m32r_gx_store(struct tgx_info* info, unsigned pc, unsigned addr, unsigned data) { SIM_DESC sd = CURRENT_STATE; sim_cpu* cpu = STATE_CPU (sd, 0); @@ -292,18 +322,19 @@ m32r_gx_store(unsigned pc, unsigned addr, unsigned data) signed char -m32r_gx_load1(unsigned pc, unsigned addr) +m32r_gx_load1(struct tgx_info* info, unsigned pc, unsigned addr) { SIM_DESC sd = CURRENT_STATE; sim_cpu* cpu = STATE_CPU (sd, 0); + signed char data = 0; - signed char data = sim_core_read_unaligned_1 (cpu, pc, read_map, addr); + data = sim_core_read_unaligned_1 (cpu, pc, read_map, addr); return data; } void -m32r_gx_store1(unsigned pc, unsigned addr, signed char data) +m32r_gx_store1(struct tgx_info* info, unsigned pc, unsigned addr, signed char data) { SIM_DESC sd = CURRENT_STATE; sim_cpu* cpu = STATE_CPU (sd, 0); @@ -313,7 +344,7 @@ m32r_gx_store1(unsigned pc, unsigned addr, signed char data) signed short -m32r_gx_load2(unsigned pc, unsigned addr) +m32r_gx_load2(struct tgx_info* info, unsigned pc, unsigned addr) { SIM_DESC sd = CURRENT_STATE; sim_cpu* cpu = STATE_CPU (sd, 0); @@ -324,7 +355,7 @@ m32r_gx_load2(unsigned pc, unsigned addr) void -m32r_gx_store2(unsigned pc, unsigned addr, signed short data) +m32r_gx_store2(struct tgx_info* info, unsigned pc, unsigned addr, signed short data) { SIM_DESC sd = CURRENT_STATE; sim_cpu* cpu = STATE_CPU (sd, 0); @@ -356,7 +387,7 @@ syscall_write_mem (host_callback *cb, struct cb_syscall *sc, void -m32r_gx_syscall(tgx_syscall_data* data) +m32r_gx_syscall(struct tgx_info* info, tgx_syscall_data* data) { SIM_DESC sd = CURRENT_STATE; sim_cpu* cpu = STATE_CPU (sd, 0); @@ -384,6 +415,8 @@ m32r_gx_syscall(tgx_syscall_data* data) data->errcode = s.errcode; data->result = s.result; data->result2 = s.result2; + + /* XXX: clear read/write cache in info */ } @@ -488,42 +521,42 @@ m32r_emit_long_insn(sim_gx_block* gx, PCADDR pc, unsigned insn, int optimized) else if(op1 == 0xa && op2 == 0x0) { fprintf(f, " /* STB R%d,@(%d,R%d) */\n", r1, lit2, r2); - fprintf(f, " (*(callbacks->store1))(0x%08x, gr%d + %d, gr%d & 0xff);\n", (unsigned)pc, r2, lit2, r1); + fprintf(f, " (*(callbacks->store1))(info, 0x%08x, gr%d + %d, gr%d & 0xff);\n", (unsigned)pc, r2, lit2, r1); } else if(op1 == 0xa && op2 == 0x2) { fprintf(f, " /* STH R%d,@(%d,R%d) */\n", r1, lit2, r2); - fprintf(f, " (*(callbacks->store2))(0x%08x, gr%d + %d, gr%d & 0xffff);\n", (unsigned)pc, r2, lit2, r1); + fprintf(f, " (*(callbacks->store2))(info, 0x%08x, gr%d + %d, gr%d & 0xffff);\n", (unsigned)pc, r2, lit2, r1); } else if(op1 == 0xa && op2 == 0x4) { fprintf(f, " /* ST R%d,@(%d,R%d) */\n", r1, lit2, r2); - fprintf(f, " (*(callbacks->store))(0x%08x, gr%d + %d, gr%d);\n", (unsigned)pc, r2, lit2, r1); + fprintf(f, " (*(callbacks->store))(info, 0x%08x, gr%d + %d, gr%d);\n", (unsigned)pc, r2, lit2, r1); } else if(op1 == 0xa && op2 == 0x8) { fprintf(f, " /* LDB R%d,@(%d,R%d) */\n", r1, lit2, r2); - fprintf(f, " gr%d = (*(callbacks->load1))(0x%08x, gr%d + %d);\n", r1, (unsigned)pc, r2, lit2); + fprintf(f, " gr%d = (*(callbacks->load1))(info, 0x%08x, gr%d + %d);\n", r1, (unsigned)pc, r2, lit2); } else if(op1 == 0xa && op2 == 0x9) { fprintf(f, " /* LDUB R%d,@(%d,R%d) */\n", r1, lit2, r2); - fprintf(f, " gr%d = (unsigned char)(*(callbacks->load1))(0x%08x, gr%d + %d);\n", r1, (unsigned)pc, r2, lit2); + fprintf(f, " gr%d = (unsigned char)(*(callbacks->load1))(info, 0x%08x, gr%d + %d);\n", r1, (unsigned)pc, r2, lit2); } else if(op1 == 0xa && op2 == 0xa) { fprintf(f, " /* LDH R%d,@(%d,R%d) */\n", r1, lit2, r2); - fprintf(f, " gr%d = (*(callbacks->load2))(0x%08x, gr%d + %d);\n", r1, (unsigned)pc, r2, lit2); + fprintf(f, " gr%d = (*(callbacks->load2))(info, 0x%08x, gr%d + %d);\n", r1, (unsigned)pc, r2, lit2); } else if(op1 == 0xa && op2 == 0xb) { fprintf(f, " /* LDUH R%d,@(%d,R%d) */\n", r1, lit2, r2); - fprintf(f, " gr%d = (unsigned short)(*(callbacks->load2))(0x%08x, gr%d + %d);\n", r1, (unsigned)pc, r2, lit2); + fprintf(f, " gr%d = (unsigned short)(*(callbacks->load2))(info, 0x%08x, gr%d + %d);\n", r1, (unsigned)pc, r2, lit2); } else if(op1 == 0xa && op2 == 0xc) { fprintf(f, " /* LD R%d,@(%d,R%d) */\n", r1, lit2, r2); - fprintf(f, " gr%d = (*(callbacks->load))(0x%08x, gr%d + %d);\n", r1, (unsigned)pc, r2, lit2); + fprintf(f, " gr%d = (*(callbacks->load))(info, 0x%08x, gr%d + %d);\n", r1, (unsigned)pc, r2, lit2); } else if(op1 == 0xb && op2 == 0x0) @@ -532,8 +565,18 @@ m32r_emit_long_insn(sim_gx_block* gx, PCADDR pc, unsigned insn, int optimized) fprintf(f, " /* BEQ R%d,R%d,%d */\n", r1, r2, lit2); fprintf(f, " if (gr%d == gr%d)\n", r1, r2); fprintf(f, " {\n"); - fprintf(f, " npc = 0x%08x;\n", newpc); - fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + if (optimized && + (GX_PC_INCLUDES(gx,newpc)) && + (GX_PC_FLAGS(gx, newpc) & GX_PCF_JUMPTARGET)) + { + fprintf(f, " goto gx_label_%ld;\n", + ((newpc - gx->origin) / gx->divisor)); + } + else + { + fprintf(f, " npc = 0x%08x;\n", newpc); + fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + } fprintf(f, " }\n"); } else if(op1 == 0xb && op2 == 0x1) @@ -542,8 +585,18 @@ m32r_emit_long_insn(sim_gx_block* gx, PCADDR pc, unsigned insn, int optimized) fprintf(f, " /* BNE R%d,R%d,%d */\n", r1, r2, lit2); fprintf(f, " if (gr%d != gr%d)\n", r1, r2); fprintf(f, " {\n"); - fprintf(f, " npc = 0x%08x;\n", newpc); - fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + if (optimized && + (GX_PC_INCLUDES(gx,newpc)) && + (GX_PC_FLAGS(gx, newpc) & GX_PCF_JUMPTARGET)) + { + fprintf(f, " goto gx_label_%ld;\n", + ((newpc - gx->origin) / gx->divisor)); + } + else + { + fprintf(f, " npc = 0x%08x;\n", newpc); + fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + } fprintf(f, " }\n"); } else if(op1 == 0xb && op2 == 0x8 && r1 == 0) @@ -552,8 +605,18 @@ m32r_emit_long_insn(sim_gx_block* gx, PCADDR pc, unsigned insn, int optimized) fprintf(f, " /* BEQZ R%d,%d */\n", r2, lit2); fprintf(f, " if (gr%d == 0)\n", r2); fprintf(f, " {\n"); - fprintf(f, " npc = 0x%08x;\n", newpc); - fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + if (optimized && + (GX_PC_INCLUDES(gx,newpc)) && + (GX_PC_FLAGS(gx, newpc) & GX_PCF_JUMPTARGET)) + { + fprintf(f, " goto gx_label_%ld;\n", + ((newpc - gx->origin) / gx->divisor)); + } + else + { + fprintf(f, " npc = 0x%08x;\n", newpc); + fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + } fprintf(f, " }\n"); } else if(op1 == 0xb && op2 == 0x9 && r1 == 0) @@ -562,8 +625,18 @@ m32r_emit_long_insn(sim_gx_block* gx, PCADDR pc, unsigned insn, int optimized) fprintf(f, " /* BNEZ R%d,%d */\n", r2, lit2); fprintf(f, " if (gr%d != 0)\n", r2); fprintf(f, " {\n"); - fprintf(f, " npc = 0x%08x;\n", newpc); - fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + if (optimized && + (GX_PC_INCLUDES(gx,newpc)) && + (GX_PC_FLAGS(gx, newpc) & GX_PCF_JUMPTARGET)) + { + fprintf(f, " goto gx_label_%ld;\n", + ((newpc - gx->origin) / gx->divisor)); + } + else + { + fprintf(f, " npc = 0x%08x;\n", newpc); + fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + } fprintf(f, " }\n"); } else if(op1 == 0xb && op2 == 0xa && r1 == 0x0) @@ -572,8 +645,18 @@ m32r_emit_long_insn(sim_gx_block* gx, PCADDR pc, unsigned insn, int optimized) fprintf(f, " /* BLTZ R%d,%d */\n", r2, lit2); fprintf(f, " if (gr%d < 0)\n", r2); fprintf(f, " {\n"); - fprintf(f, " npc = 0x%08x;\n", newpc); - fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + if (optimized && + (GX_PC_INCLUDES(gx,newpc)) && + (GX_PC_FLAGS(gx, newpc) & GX_PCF_JUMPTARGET)) + { + fprintf(f, " goto gx_label_%ld;\n", + ((newpc - gx->origin) / gx->divisor)); + } + else + { + fprintf(f, " npc = 0x%08x;\n", newpc); + fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + } fprintf(f, " }\n"); } else if(op1 == 0xb && op2 == 0xb && r1 == 0x0) @@ -582,8 +665,18 @@ m32r_emit_long_insn(sim_gx_block* gx, PCADDR pc, unsigned insn, int optimized) fprintf(f, " /* BGEZ R%d,%d */\n", r2, lit2); fprintf(f, " if (gr%d >= 0)\n", r2); fprintf(f, " {\n"); - fprintf(f, " npc = 0x%08x;\n", newpc); - fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + if (optimized && + (GX_PC_INCLUDES(gx,newpc)) && + (GX_PC_FLAGS(gx, newpc) & GX_PCF_JUMPTARGET)) + { + fprintf(f, " goto gx_label_%ld;\n", + ((newpc - gx->origin) / gx->divisor)); + } + else + { + fprintf(f, " npc = 0x%08x;\n", newpc); + fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + } fprintf(f, " }\n"); } else if(op1 == 0xb && op2 == 0xc && r1 == 0x0) @@ -592,8 +685,18 @@ m32r_emit_long_insn(sim_gx_block* gx, PCADDR pc, unsigned insn, int optimized) fprintf(f, " /* BLEZ R%d,%d */\n", r2, lit2); fprintf(f, " if (gr%d <= 0)\n", r2); fprintf(f, " {\n"); - fprintf(f, " npc = 0x%08x;\n", newpc); - fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + if (optimized && + (GX_PC_INCLUDES(gx,newpc)) && + (GX_PC_FLAGS(gx, newpc) & GX_PCF_JUMPTARGET)) + { + fprintf(f, " goto gx_label_%ld;\n", + ((newpc - gx->origin) / gx->divisor)); + } + else + { + fprintf(f, " npc = 0x%08x;\n", newpc); + fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + } fprintf(f, " }\n"); } else if(op1 == 0xb && op2 == 0xd && r1 == 0x0) @@ -602,8 +705,18 @@ m32r_emit_long_insn(sim_gx_block* gx, PCADDR pc, unsigned insn, int optimized) fprintf(f, " /* BGTZ R%d,%d */\n", r2, lit2); fprintf(f, " if (gr%d > 0)\n", r2); fprintf(f, " {\n"); - fprintf(f, " npc = 0x%08x;\n", newpc); - fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + if (optimized && + (GX_PC_INCLUDES(gx,newpc)) && + (GX_PC_FLAGS(gx, newpc) & GX_PCF_JUMPTARGET)) + { + fprintf(f, " goto gx_label_%ld;\n", + ((newpc - gx->origin) / gx->divisor)); + } + else + { + fprintf(f, " npc = 0x%08x;\n", newpc); + fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + } fprintf(f, " }\n"); } @@ -625,8 +738,18 @@ m32r_emit_long_insn(sim_gx_block* gx, PCADDR pc, unsigned insn, int optimized) fprintf(f, " /* BC %d */\n", lit3); fprintf(f, " if (cond)\n"); fprintf(f, " {\n"); - fprintf(f, " npc = 0x%08x;\n", newpc); - fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + if (optimized && + (GX_PC_INCLUDES(gx,newpc)) && + (GX_PC_FLAGS(gx, newpc) & GX_PCF_JUMPTARGET)) + { + fprintf(f, " goto gx_label_%ld;\n", + ((newpc - gx->origin) / gx->divisor)); + } + else + { + fprintf(f, " npc = 0x%08x;\n", newpc); + fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + } fprintf(f, " }\n"); } else if(op1 == 0xf && r1 == 0xd) @@ -635,8 +758,18 @@ m32r_emit_long_insn(sim_gx_block* gx, PCADDR pc, unsigned insn, int optimized) fprintf(f, " /* BNC %d */\n", lit3); fprintf(f, " if (! cond)\n"); fprintf(f, " {\n"); - fprintf(f, " npc = 0x%08x;\n", newpc); - fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + if (optimized && + (GX_PC_INCLUDES(gx,newpc)) && + (GX_PC_FLAGS(gx, newpc) & GX_PCF_JUMPTARGET)) + { + fprintf(f, " goto gx_label_%ld;\n", + ((newpc - gx->origin) / gx->divisor)); + } + else + { + fprintf(f, " npc = 0x%08x;\n", newpc); + fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + } fprintf(f, " }\n"); } else if(op1 == 0xf && r1 == 0xe) @@ -645,15 +778,35 @@ m32r_emit_long_insn(sim_gx_block* gx, PCADDR pc, unsigned insn, int optimized) unsigned retpc = (pc & 0xfffffffc) + 4; fprintf(f, " /* BL %d */\n", lit3); fprintf(f, " gr14 = 0x%08x;\n", retpc); - fprintf(f, " npc = 0x%08x;\n", newpc); - fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + if (optimized && + (GX_PC_INCLUDES(gx,newpc)) && + (GX_PC_FLAGS(gx, newpc) & GX_PCF_JUMPTARGET)) + { + fprintf(f, " goto gx_label_%ld;\n", + ((newpc - gx->origin) / gx->divisor)); + } + else + { + fprintf(f, " npc = 0x%08x;\n", newpc); + fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + } } else if(op1 == 0xf && r1 == 0xf) { unsigned newpc = (pc & 0xfffffffc) + (((lit3 << 8) >> 8) << 2); fprintf(f, " /* BRA %d */\n", lit3); - fprintf(f, " npc = 0x%08x;\n", newpc); - fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + if (optimized && + (GX_PC_INCLUDES(gx,newpc)) && + (GX_PC_FLAGS(gx, newpc) & GX_PCF_JUMPTARGET)) + { + fprintf(f, " goto gx_label_%ld;\n", + ((newpc - gx->origin) / gx->divisor)); + } + else + { + fprintf(f, " npc = 0x%08x;\n", newpc); + fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + } } else @@ -862,7 +1015,7 @@ m32r_emit_short_insn(sim_gx_block* gx, PCADDR pc, unsigned insn, int optimized) { fprintf(f, " {\n"); fprintf(f, " tgx_syscall_data d = { 0x%08x, gr0, gr1, gr2, gr3 };\n", (unsigned) pc); - fprintf(f, " (*(callbacks->syscall))(&d);\n"); + fprintf(f, " (*(callbacks->syscall))(info, &d);\n"); fprintf(f, " gr2 = d.errcode;\n"); fprintf(f, " gr1 = d.result;\n"); fprintf(f, " gr0 = d.result2;\n"); @@ -886,17 +1039,17 @@ m32r_emit_short_insn(sim_gx_block* gx, PCADDR pc, unsigned insn, int optimized) else if(op1 == 0x2 && op2 == 0x0) { fprintf(f, " /* STB R%d,@R%d */\n", r1, r2); - fprintf(f, " (*(callbacks->store1))(0x%08x, gr%d, gr%d & 0xff);\n", (unsigned)pc, r2, r1); + fprintf(f, " (*(callbacks->store1))(info, 0x%08x, gr%d, gr%d & 0xff);\n", (unsigned)pc, r2, r1); } else if(op1 == 0x2 && op2 == 0x2) { fprintf(f, " /* STH R%d,@R%d */\n", r1, r2); - fprintf(f, " (*(callbacks->store2))(0x%08x, gr%d, gr%d & 0x0000ffff);\n", (unsigned)pc, r2, r1); + fprintf(f, " (*(callbacks->store2))(info, 0x%08x, gr%d, gr%d & 0x0000ffff);\n", (unsigned)pc, r2, r1); } else if(op1 == 0x2 && op2 == 0x4) { fprintf(f, " /* ST R%d,@R%d */\n", r1, r2); - fprintf(f, " (*(callbacks->store))(0x%08x, gr%d, gr%d);\n", (unsigned)pc, r2, r1); + fprintf(f, " (*(callbacks->store))(info, 0x%08x, gr%d, gr%d);\n", (unsigned)pc, r2, r1); } else if(op1 == 0x2 && op2 == 0x5) { @@ -904,56 +1057,56 @@ m32r_emit_short_insn(sim_gx_block* gx, PCADDR pc, unsigned insn, int optimized) fprintf(f, " if(lock)\n"); fprintf(f, " {\n"); fprintf(f, " lock = 0;\n"); - fprintf(f, " (*(callbacks->store))(0x%08x, gr%d, gr%d);\n", (unsigned)pc, r2, r1); + fprintf(f, " (*(callbacks->store))(info, 0x%08x, gr%d, gr%d);\n", (unsigned)pc, r2, r1); fprintf(f, " }\n"); } else if(op1 == 0x2 && op2 == 0x6) { fprintf(f, " /* ST R%d,@+R%d */\n", r1, r2); fprintf(f, " gr%d = gr%d + 4;\n", r2, r2); - fprintf(f, " (*(callbacks->store))(0x%08x, gr%d, gr%d);\n", (unsigned)pc, r2, r1); + fprintf(f, " (*(callbacks->store))(info, 0x%08x, gr%d, gr%d);\n", (unsigned)pc, r2, r1); } else if(op1 == 0x2 && op2 == 0x7) { fprintf(f, " /* ST R%d,@-R%d */\n", r1, r2); fprintf(f, " gr%d = gr%d - 4;\n", r2, r2); - fprintf(f, " (*(callbacks->store))(0x%08x, gr%d, gr%d);\n", (unsigned)pc, r2, r1); + fprintf(f, " (*(callbacks->store))(info, 0x%08x, gr%d, gr%d);\n", (unsigned)pc, r2, r1); } else if(op1 == 0x2 && op2 == 0x8) { fprintf(f, " /* LDB R%d,@R%d */\n", r1, r2); - fprintf(f, " gr%d = (*(callbacks->load1))(0x%08x, gr%d);\n", r1, (unsigned)pc, r2); + fprintf(f, " gr%d = (*(callbacks->load1))(info, 0x%08x, gr%d);\n", r1, (unsigned)pc, r2); } else if(op1 == 0x2 && op2 == 0x9) { fprintf(f, " /* LDUB R%d,@R%d */\n", r1, r2); - fprintf(f, " gr%d = (unsigned char)(*(callbacks->load1))(0x%08x, gr%d);\n", r1, (unsigned)pc, r2); + fprintf(f, " gr%d = (unsigned char)(*(callbacks->load1))(info, 0x%08x, gr%d);\n", r1, (unsigned)pc, r2); } else if(op1 == 0x2 && op2 == 0xa) { fprintf(f, " /* LDH R%d,@R%d */\n", r1, r2); - fprintf(f, " gr%d = (*(callbacks->load2))(0x%08x, gr%d);\n", r1, (unsigned)pc, r2); + fprintf(f, " gr%d = (*(callbacks->load2))(info, 0x%08x, gr%d);\n", r1, (unsigned)pc, r2); } else if(op1 == 0x2 && op2 == 0xb) { fprintf(f, " /* LDUH R%d,@R%d */\n", r1, r2); - fprintf(f, " gr%d = (unsigned short)(*(callbacks->load2))(0x%08x, gr%d);\n", r1, (unsigned)pc, r2); + fprintf(f, " gr%d = (unsigned short)(*(callbacks->load2))(info, 0x%08x, gr%d);\n", r1, (unsigned)pc, r2); } else if(op1 == 0x2 && op2 == 0xc) { fprintf(f, " /* LD R%d,@R%d */\n", r1, r2); - fprintf(f, " gr%d = (*(callbacks->load))(0x%08x, gr%d);\n", r1, (unsigned)pc, r2); + fprintf(f, " gr%d = (*(callbacks->load))(info, 0x%08x, gr%d);\n", r1, (unsigned)pc, r2); } else if(op1 == 0x2 && op2 == 0xd) { fprintf(f, " /* LOCK R%d,@R%d */\n", r1, r2); fprintf(f, " lock = 1;\n"); - fprintf(f, " gr%d = (*(callbacks->load))(0x%08x, gr%d);\n", r1, (unsigned)pc, r2); + fprintf(f, " gr%d = (*(callbacks->load))(info, 0x%08x, gr%d);\n", r1, (unsigned)pc, r2); } else if(op1 == 0x2 && op2 == 0xe) { fprintf(f, " /* LD R%d,@R%d+ */\n", r1, r2); - fprintf(f, " gr%d = (*(callbacks->load))(0x%08x, gr%d);\n", r1, (unsigned)pc, r2); + fprintf(f, " gr%d = (*(callbacks->load))(info, 0x%08x, gr%d);\n", r1, (unsigned)pc, r2); fprintf(f, " gr%d = gr%d + 4;\n", r2, r2); } @@ -991,8 +1144,18 @@ m32r_emit_short_insn(sim_gx_block* gx, PCADDR pc, unsigned insn, int optimized) fprintf(f, " /* BC %d */\n", c); fprintf(f, " if (cond)\n"); fprintf(f, " {\n"); - fprintf(f, " npc = 0x%08x;\n", newpc); - fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + if (optimized && + (GX_PC_INCLUDES(gx,newpc)) && + (GX_PC_FLAGS(gx, newpc) & GX_PCF_JUMPTARGET)) + { + fprintf(f, " goto gx_label_%ld;\n", + ((newpc - gx->origin) / gx->divisor)); + } + else + { + fprintf(f, " npc = 0x%08x;\n", newpc); + fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + } fprintf(f, " }\n"); } else if(op1 == 0x7 && r1 == 0xd) @@ -1001,8 +1164,18 @@ m32r_emit_short_insn(sim_gx_block* gx, PCADDR pc, unsigned insn, int optimized) fprintf(f, " /* BNC %d */\n", c); fprintf(f, " if (! cond)\n"); fprintf(f, " {\n"); - fprintf(f, " npc = 0x%08x;\n", newpc); - fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + if (optimized && + (GX_PC_INCLUDES(gx,newpc)) && + (GX_PC_FLAGS(gx, newpc) & GX_PCF_JUMPTARGET)) + { + fprintf(f, " goto gx_label_%ld;\n", + ((newpc - gx->origin) / gx->divisor)); + } + else + { + fprintf(f, " npc = 0x%08x;\n", newpc); + fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + } fprintf(f, " }\n"); } else if(op1 == 0x7 && r1 == 0xe) @@ -1011,15 +1184,35 @@ m32r_emit_short_insn(sim_gx_block* gx, PCADDR pc, unsigned insn, int optimized) unsigned retpc = (pc & 0xfffffffc) + 4; fprintf(f, " /* BL %d */\n", c); fprintf(f, " gr14 = 0x%08x;\n", retpc); - fprintf(f, " npc = 0x%08x;\n", newpc); - fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + if (optimized && + (GX_PC_INCLUDES(gx,newpc)) && + (GX_PC_FLAGS(gx, newpc) & GX_PCF_JUMPTARGET)) + { + fprintf(f, " goto gx_label_%ld;\n", + ((newpc - gx->origin) / gx->divisor)); + } + else + { + fprintf(f, " npc = 0x%08x;\n", newpc); + fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + } } else if(op1 == 0x7 && r1 == 0xf) { unsigned newpc = (pc & 0xfffffffc) + (((int) c) << 2); fprintf(f, " /* BRA %d */\n", c); - fprintf(f, " npc = 0x%08x;\n", newpc); - fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + if (optimized && + (GX_PC_INCLUDES(gx,newpc)) && + (GX_PC_FLAGS(gx, newpc) & GX_PCF_JUMPTARGET)) + { + fprintf(f, " goto gx_label_%ld;\n", + ((newpc - gx->origin) / gx->divisor)); + } + else + { + fprintf(f, " npc = 0x%08x;\n", newpc); + fprintf(f, " goto %s;\n", (GX_PC_INCLUDES(gx,newpc)) ? "shortjump" : "longjump"); + } } else if(op1 == 0x7 && op2 == 0x0 && r1 == 0x0 && r1 == 0x0) diff --git a/sim/m32r-gx/m32r-sim.h b/sim/m32r-gx/m32r-sim.h index e69de29..4b723fe 100644 --- a/sim/m32r-gx/m32r-sim.h +++ b/sim/m32r-gx/m32r-sim.h @@ -0,0 +1 @@ +/* place holder */ diff --git a/sim/m32r-gx/sim-if.c b/sim/m32r-gx/sim-if.c index fcb7f77..ded59a9 100644 --- a/sim/m32r-gx/sim-if.c +++ b/sim/m32r-gx/sim-if.c @@ -142,8 +142,8 @@ sim_create_inferior (sd, abfd, argv, envp) CPU_PC_STORE (current_cpu) = m32r_h_pc_set; CPU_PC_FETCH (current_cpu) = m32r_h_pc_get; - CPU_REG_STORE (current_cpu) = & abort; - CPU_REG_FETCH (current_cpu) = & abort; + CPU_REG_STORE (current_cpu) = NULL; + CPU_REG_FETCH (current_cpu) = NULL; if (abfd != NULL) addr = bfd_get_start_address (abfd); diff --git a/sim/m32r-gx/sim-main.c b/sim/m32r-gx/sim-main.c new file mode 100644 index 0000000..4b723fe --- /dev/null +++ b/sim/m32r-gx/sim-main.c @@ -0,0 +1 @@ +/* place holder */ diff --git a/sim/m32r-gx/sim-main.h b/sim/m32r-gx/sim-main.h index 2d425da..3367dcb 100644 --- a/sim/m32r-gx/sim-main.h +++ b/sim/m32r-gx/sim-main.h @@ -1,4 +1,7 @@ -/* Main header for the m32r. */ +/* Main header for the m32r-gx. */ + +#ifndef SIM_MAIN_H +#define SIM_MAIN_H #define USING_SIM_BASE_H /* FIXME: quick hack */ @@ -56,19 +59,28 @@ typedef struct tgx_syscall_data } tgx_syscall_data; +struct tgx_info; + /* match with definition in gx-translate.c! */ typedef struct tgx_callbacks { - unsigned (*load)(unsigned pc, unsigned addr); - void (*store)(unsigned pc, unsigned addr, unsigned data); - signed char (*load1)(unsigned pc, unsigned addr); - void (*store1)(unsigned pc, unsigned addr, signed char data); - signed short (*load2)(unsigned pc, unsigned addr); - void (*store2)(unsigned pc, unsigned addr, signed short data); - void (*syscall)(tgx_syscall_data* data); + unsigned (*load)(struct tgx_info* info, unsigned pc, unsigned addr); + void (*store)(struct tgx_info* info, unsigned pc, unsigned addr, unsigned data); + signed char (*load1)(struct tgx_info* info, unsigned pc, unsigned addr); + void (*store1)(struct tgx_info* info, unsigned pc, unsigned addr, signed char data); + signed short (*load2)(struct tgx_info* info, unsigned pc, unsigned addr); + void (*store2)(struct tgx_info* info, unsigned pc, unsigned addr, signed short data); + void (*syscall)(struct tgx_info* info, tgx_syscall_data* data); } tgx_callbacks; +typedef struct tgx_info +{ + struct tgx_cpu_regs* regs; + char* pc_flags; + struct tgx_callbacks* callbacks; +} tgx_info; + struct _sim_cpu { @@ -92,3 +104,6 @@ struct sim_state { appropriate handler. */ SI h_gr_get (SIM_CPU *, UINT); void h_gr_set (SIM_CPU *, UINT, SI); + + +#endif /* SIM_MAIN_H */ |