diff --git a/TODO b/TODO index fde95e0..c0ddd1c 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,17 @@ + May be able to avoid dce problems if we use && for labels (that + may also get rid of our need for the cleanup code, too) + + Need to make it so that the minimal required compilation options for + x86_64 (-fno-dce) are set up by default + + should probably report dead code elimination bug before I + forget the details (I've probably already lost the minimal + test case) (the details being that if you update a global + register and then use a label pointer to jump away, the + update can get eliminated even though the register can + still be accessed + + cleanup and optimize shouldn't be done via environment variables; they should be done with AC_ARG_ENABLE and default to be turned on on the architectures where they work (and should be made to work on diff --git a/configure.ac b/configure.ac index c845fdf..681a311 100644 --- a/configure.ac +++ b/configure.ac @@ -28,21 +28,6 @@ AC_ARG_VAR(CC_FOR_BUILD,[C compiler for building tools]) CFLAGS_FOR_BUILD="${CFLAGS_FOR_BUILD-}" AC_ARG_VAR(CFLAGS_FOR_BUILD,[C flags for building tools]) -AC_MSG_CHECKING([Syn68k C flags (TODO: FIXME)]) -SYN68K_CFLAGS="${SYN68K_CFLAGS--O2 -fomit-frame-pointer}" -AC_MSG_RESULT([$SYN68K_CFLAGS]) -AC_ARG_VAR(SYN68K_CFLAGS,[Syn68k C flags (TODO: FIXME)]) - -AC_MSG_CHECKING([cleanup script]) -CLEANUP="${CLEANUP-./i486-cleanup.pl}" -AC_MSG_RESULT([$CLEANUP]) -AC_ARG_VAR(CLEANUP,[cleanup script]) - -AC_MSG_CHECKING([optimization script]) -OPTIMIZE="${OPTIMIZE-./i486-optimize.pl}" -AC_MSG_RESULT([$OPTIMIZE]) -AC_ARG_VAR(OPTIMIZE,[optimization script]) - if test "$host_alias" = ""; then host=i486-linux-glibc fi @@ -57,6 +42,11 @@ esac AC_SUBST(host_cpu_class) +AC_MSG_CHECKING([Syn68k C flags (TODO: FIXME)]) +SYN68K_CFLAGS="${SYN68K_CFLAGS--O2 -fomit-frame-pointer}" +AC_MSG_RESULT([$SYN68K_CFLAGS]) +AC_ARG_VAR(SYN68K_CFLAGS,[Syn68k C flags (TODO: FIXME)]) + AC_ARG_ENABLE([native], AC_HELP_STRING([--enable-native], [recompile into x86 code (default enabled for x86)]), @@ -82,6 +72,40 @@ AC_MSG_RESULT([$enable_native]) AC_SUBST(NONNATIVE) AC_SUBST(HOST_NATIVE) +AC_ARG_ENABLE([assembly-cleanup], + AC_HELP_STRING([--enable-assembly-cleanup], + [remove unneeded assembler instructions (default enabled for x86)]), + [], [if test x$host_cpu_class = xi386; then + enable_assembly_cleanup=yes + else + enable_assembly_cleanup=no + fi]) + +AC_MSG_CHECKING([assembler cleanup]) +if test x$enable_assembly_cleanup = xyes; then + assembly_cleanup_script=./i486-cleanup.pl +else + assembly_cleanup_script= +fi +AC_MSG_RESULT([$enable_assembly_cleanup]) +AC_SUBST(assembly_cleanup_script) + + +# TODO: finish this +AC_ARG_ENABLE([assembly-optimization], + AC_HELP_STRING([--enable-assembly-optimization], + [reorder assembly instructions (x86 only; default is no]), + [], [enable_assembly_optimization=no]) + +AC_MSG_CHECKING([assembly optimization]) +if test x$enable_assembly_optimization = xyes; then + assembly_optimization_script=./i486-optimize.pl +else + assembly_optimization_script= +fi +AC_MSG_RESULT($enable_assembly_optimization) +AC_SUBST(assembly_optimization_script) + AC_ARG_ENABLE([debug], AC_HELP_STRING([--enable-debug], [use debug -g (default is yes)]), diff --git a/runtime/Makefile.am b/runtime/Makefile.am index 74b2676..32af2e1 100644 --- a/runtime/Makefile.am +++ b/runtime/Makefile.am @@ -4,8 +4,8 @@ include_HEADERS = ../include/syn68k_public.h host_native=@HOST_NATIVE@ SYN68K_CFLAGS=@SYN68K_CFLAGS@ -CLEANUP=@CLEANUP@ -OPTIMIZE=@OPTIMIZE@ +CLEANUP=@assembly_cleanup_script@ +OPTIMIZE=@assembly_optimization_script@ AM_CFLAGS = -DRUNTIME