revision 899:18e0cdea76aa
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 899:18e0cdea76aa |
parent | 898:fc3cfc0859fb |
child | 900:609fa702406b |
author | nkeynes |
date | Sat Oct 25 12:36:42 2008 +0000 (15 years ago) |
Add --enable-optimized flag (on by default).
When optimized, add -fomit-frame-pointer -fexceptions on non-Mac x86 (Unwinding doesn't seem to work correctly on Mac)
When optimized, add -fomit-frame-pointer -fexceptions on non-Mac x86 (Unwinding doesn't seem to work correctly on Mac)
config.h.in | view | annotate | diff | log | ||
configure | view | annotate | diff | log | ||
configure.in | view | annotate | diff | log | ||
src/sh4/ia32abi.h | view | annotate | diff | log |
1.1 --- a/config.h.in Fri Oct 24 10:38:43 2008 +00001.2 +++ b/config.h.in Sat Oct 25 12:36:42 2008 +00001.3 @@ -43,6 +43,9 @@1.4 /* Have esound support */1.5 #undef HAVE_ESOUND1.7 +/* Have exception stack-frame information */1.8 +#undef HAVE_EXCEPTIONS1.9 +1.10 /* Define if the GNU gettext() function is already present or preinstalled. */1.11 #undef HAVE_GETTEXT
2.1 --- a/configure Fri Oct 24 10:38:43 2008 +00002.2 +++ b/configure Sat Oct 25 12:36:42 2008 +00002.3 @@ -804,6 +804,7 @@2.4 enable_dependency_tracking2.5 enable_strict_warn2.6 enable_translator2.7 +enable_optimized2.8 enable_trace2.9 enable_watch2.10 enable_sh4stats2.11 @@ -1469,7 +1470,9 @@2.12 --disable-dependency-tracking speeds up one-time build2.13 --enable-dependency-tracking do not reject slow dependency extractors2.14 --enable-strict-warn Enable strict compilation warnings2.15 - --disable-translator Disable the SH4 translator (Enable by default)2.16 + --disable-translator Disable the SH4 translator (Enabled by default)2.17 + --disable-optimized Disable compile-time optimizations (Enabled by2.18 + default)2.19 --enable-trace Enable generation of IO traces (warning: hurts2.20 performance)2.21 --enable-watch Enable watchpoints in the debugger (warning: hurts2.22 @@ -6565,6 +6568,13 @@2.23 enable_translator=yes2.24 fi2.26 +# Check whether --enable-optimized was given.2.27 +if test "${enable_optimized+set}" = set; then2.28 + enableval=$enable_optimized; true2.29 +else2.30 + enable_optimized=yes2.31 +fi2.32 +2.33 # Check whether --enable-trace was given.2.34 if test "${enable_trace+set}" = set; then2.35 enableval=$enable_trace; if test "$enableval" == "yes"; then2.36 @@ -6628,11 +6638,17 @@2.40 +if test "x$enable_optimized" = "xyes"; then2.41 + CFLAGS="-g -O2"2.42 +else2.43 + CFLAGS="-g3"2.44 +fi2.45 if test "x$GCC" = "xyes"; then2.46 CFLAGS="$CFLAGS -fno-strict-aliasing"2.47 fi2.50 +2.51 lxdream_save_cppflags="$CPPFLAGS"2.52 CPPFLAGS="$CPPFLAGS -x objective-c"2.53 cat >conftest.$ac_ext <<_ACEOF2.54 @@ -6849,6 +6865,14 @@2.55 _ACEOF2.57 fi2.58 +if test "x$enable_optimized" = "xyes" -a "x$APPLE_BUILD" != "xyes"; then2.59 + CFLAGS="$CFLAGS -fexceptions -fomit-frame-pointer"2.60 +2.61 +cat >>confdefs.h <<\_ACEOF2.62 +#define HAVE_EXCEPTIONS 12.63 +_ACEOF2.64 +2.65 +fi
3.1 --- a/configure.in Fri Oct 24 10:38:43 2008 +00003.2 +++ b/configure.in Sat Oct 25 12:36:42 2008 +00003.3 @@ -23,8 +23,11 @@3.4 AS_HELP_STRING( [--enable-strict-warn], [Enable strict compilation warnings]),3.5 [CFLAGS="$CFLAGS -Werror -Wall -Wno-unused"], [])3.6 AC_ARG_ENABLE( translator,3.7 - AS_HELP_STRING( [--disable-translator], [Disable the SH4 translator (Enable by default)]),3.8 + AS_HELP_STRING( [--disable-translator], [Disable the SH4 translator (Enabled by default)]),3.9 [true], [enable_translator=yes] )3.10 +AC_ARG_ENABLE( optimized,3.11 + AS_HELP_STRING( [--disable-optimized], [Disable compile-time optimizations (Enabled by default)]),3.12 + [true], [enable_optimized=yes] )3.13 AC_ARG_ENABLE( trace,3.14 AS_HELP_STRING( [--enable-trace], [Enable generation of IO traces (warning: hurts performance)]),3.15 [if test "$enableval" == "yes"; then3.16 @@ -52,10 +55,16 @@3.18 dnl ------------3.20 +if test "x$enable_optimized" = "xyes"; then3.21 + CFLAGS="-g -O2"3.22 +else3.23 + CFLAGS="-g3"3.24 +fi3.25 if test "x$GCC" = "xyes"; then3.26 CFLAGS="$CFLAGS -fno-strict-aliasing"3.27 fi3.29 +3.30 dnl ------------ Check if we're building on Darwin --------------3.32 dnl For starters, do we have a working objective-c compiler?3.33 @@ -82,6 +91,10 @@3.34 if test "x$HAVE_COCOA" = 'xyes' -a "x$with_gtk" = "xno"; then3.35 AC_DEFINE(OSX_BUNDLE, [1], [Generating a bundled application])3.36 fi3.37 +if test "x$enable_optimized" = "xyes" -a "x$APPLE_BUILD" != "xyes"; then3.38 + CFLAGS="$CFLAGS -fexceptions -fomit-frame-pointer"3.39 + AC_DEFINE(HAVE_EXCEPTIONS, [1], [Have exception stack-frame information])3.40 +fi3.42 dnl ----------- Check for mandatory dependencies --------------3.43 dnl Check for libpng (required)
4.1 --- a/src/sh4/ia32abi.h Fri Oct 24 10:38:43 2008 +00004.2 +++ b/src/sh4/ia32abi.h Sat Oct 25 12:36:42 2008 +00004.3 @@ -264,6 +264,46 @@4.4 }4.5 }4.7 +/**4.8 + * The unwind methods only work if we compiled with DWARF2 frame information4.9 + * (ie -fexceptions), otherwise we have to use the direct frame scan.4.10 + */4.11 +#ifdef HAVE_EXCEPTIONS4.12 +#include <unwind.h>4.13 +4.14 +struct UnwindInfo {4.15 + int have_result;4.16 + void *pc;4.17 +};4.18 +4.19 +_Unwind_Reason_Code xlat_check_frame( struct _Unwind_Context *context, void *arg )4.20 +{4.21 + void *ebp = (void *)_Unwind_GetGR(context, 5);4.22 + void *expect = (((uint8_t *)&sh4r) + 128 );4.23 + struct UnwindInfo *info = arg;4.24 + if( ebp == expect ) {4.25 + info->have_result = 1;4.26 + info->pc = (void *)_Unwind_GetIP(context);4.27 + } else if( info->have_result ) {4.28 + return _URC_NORMAL_STOP;4.29 + }4.30 +4.31 + return _URC_NO_REASON;4.32 +}4.33 +4.34 +void *xlat_get_native_pc()4.35 +{4.36 + struct _Unwind_Exception exc;4.37 + struct UnwindInfo info;4.38 +4.39 + info.have_result = 0;4.40 + void *result = NULL;4.41 + _Unwind_Backtrace( xlat_check_frame, &info );4.42 + if( info.have_result )4.43 + return info.pc;4.44 + return NULL;4.45 +}4.46 +#else4.47 void *xlat_get_native_pc()4.48 {4.49 void *result = NULL;4.50 @@ -286,6 +326,7 @@4.51 : "eax", "ecx", "edx" );4.52 return result;4.53 }4.54 +#endif4.56 #endif /* !lxdream_ia32abi_H */
.