revision 1147:e04e4af64626
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 1147:e04e4af64626 |
parent | 1146:76c5d1064262 |
child | 1148:8e75fab17be8 |
author | nkeynes |
date | Mon Nov 08 22:10:47 2010 +1000 (13 years ago) |
Suggest to the compiler a little more firmly that it inline the x86op
functions (as these are nearly always called with constants, they can
usually be reduced down pretty dramatically)
functions (as these are nearly always called with constants, they can
usually be reduced down pretty dramatically)
acinclude.m4 | view | annotate | diff | log | ||
config.h.in | view | annotate | diff | log | ||
configure | view | annotate | diff | log | ||
configure.in | view | annotate | diff | log | ||
src/xlat/x86/x86op.h | view | annotate | diff | log |
1.1 --- a/acinclude.m4 Mon Nov 08 18:56:11 2010 +10001.2 +++ b/acinclude.m4 Mon Nov 08 22:10:47 2010 +10001.3 @@ -18,6 +18,27 @@1.4 $2 ])1.5 ])1.7 +# AC_CHECK_FORCEINLINE([if-ok],[if-notok])1.8 +# Test if the compiler recognizes __attribute__((always_inline))1.9 +# -----------------------1.10 +AC_DEFUN([AC_CHECK_FORCEINLINE], [1.11 +AC_MSG_CHECKING([support for force inlining]);1.12 +AC_COMPILE_IFELSE([1.13 + AC_LANG_SOURCE([[1.14 +static int __attribute__((always_inline)) foo(int a, int b) { return a+b; }1.15 +1.16 +int main(int argc, char *argv[])1.17 +{1.18 + return foo( 1, 2 ) == 3 ? 0 : 1;1.19 +}]])], [1.20 + FORCEINLINE="__attribute__((always_inline))"1.21 + AC_MSG_RESULT([$FORCEINLINE])1.22 + $1 ], [1.23 + FORCEINLINE=""1.24 + AC_MSG_RESULT([no])1.25 + $2 ])1.26 +])1.27 +1.28 # AC_CHECK_FRAME_ADDRESS([if-ok],[if-notok])1.29 # Test if the compiler will let us modify the return address on the stack1.30 # via __builtin_frame_address()
2.1 --- a/config.h.in Mon Nov 08 18:56:11 2010 +10002.2 +++ b/config.h.in Mon Nov 08 22:10:47 2010 +10002.3 @@ -25,6 +25,9 @@2.4 /* Enable watchpoints */2.5 #undef ENABLE_WATCH2.7 +/* Forcibly inline code */2.8 +#undef FORCEINLINE2.9 +2.10 /* translation domain */2.11 #undef GETTEXT_PACKAGE2.13 @@ -76,9 +79,6 @@2.14 /* Define if your <locale.h> file defines LC_MESSAGES. */2.15 #undef HAVE_LC_MESSAGES2.17 -/* Define to 1 if you have the `GL' library (-lGL). */2.18 -#undef HAVE_LIBGL2.19 -2.20 /* Define to 1 if you have the `OSMesa' library (-lOSMesa). */2.21 #undef HAVE_LIBOSMESA
3.1 --- a/configure Mon Nov 08 18:56:11 2010 +10003.2 +++ b/configure Mon Nov 08 22:10:47 2010 +10003.3 @@ -8124,6 +8124,64 @@3.7 +{ echo "$as_me:$LINENO: checking support for force inlining" >&53.8 +echo $ECHO_N "checking support for force inlining... $ECHO_C" >&6; };3.9 +cat >conftest.$ac_ext <<_ACEOF3.10 +3.11 + /* confdefs.h. */3.12 +_ACEOF3.13 +cat confdefs.h >>conftest.$ac_ext3.14 +cat >>conftest.$ac_ext <<_ACEOF3.15 +/* end confdefs.h. */3.16 +3.17 +static int __attribute__((always_inline)) foo(int a, int b) { return a+b; }3.18 +3.19 +int main(int argc, char *argv[])3.20 +{3.21 + return foo( 1, 2 ) == 3 ? 0 : 1;3.22 +}3.23 +_ACEOF3.24 +rm -f conftest.$ac_objext3.25 +if { (ac_try="$ac_compile"3.26 +case "(($ac_try" in3.27 + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;3.28 + *) ac_try_echo=$ac_try;;3.29 +esac3.30 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&53.31 + (eval "$ac_compile") 2>conftest.er13.32 + ac_status=$?3.33 + grep -v '^ *+' conftest.er1 >conftest.err3.34 + rm -f conftest.er13.35 + cat conftest.err >&53.36 + echo "$as_me:$LINENO: \$? = $ac_status" >&53.37 + (exit $ac_status); } && {3.38 + test -z "$ac_c_werror_flag" ||3.39 + test ! -s conftest.err3.40 + } && test -s conftest.$ac_objext; then3.41 +3.42 + FORCEINLINE="__attribute__((always_inline))"3.43 + { echo "$as_me:$LINENO: result: $FORCEINLINE" >&53.44 +echo "${ECHO_T}$FORCEINLINE" >&6; }3.45 +3.46 +else3.47 + echo "$as_me: failed program was:" >&53.48 +sed 's/^/| /' conftest.$ac_ext >&53.49 +3.50 +3.51 + FORCEINLINE=""3.52 + { echo "$as_me:$LINENO: result: no" >&53.53 +echo "${ECHO_T}no" >&6; }3.54 +3.55 +fi3.56 +3.57 +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext3.58 +3.59 +3.60 +cat >>confdefs.h <<_ACEOF3.61 +#define FORCEINLINE $FORCEINLINE3.62 +_ACEOF3.63 +3.64 +3.65 { echo "$as_me:$LINENO: checking if we have a working __builtin_frame_address()" >&53.66 echo $ECHO_N "checking if we have a working __builtin_frame_address()... $ECHO_C" >&6; };3.67 if test "$cross_compiling" = yes; then
4.1 --- a/configure.in Mon Nov 08 18:56:11 2010 +10004.2 +++ b/configure.in Mon Nov 08 22:10:47 2010 +10004.3 @@ -178,6 +178,8 @@4.4 AC_CHECK_FASTCALL([4.5 AC_DEFINE(HAVE_FASTCALL, [1], [Use fast register-passing calling conventions])4.6 ])4.7 +AC_CHECK_FORCEINLINE()4.8 +AC_DEFINE_UNQUOTED(FORCEINLINE, [$FORCEINLINE], [Forcibly inline code])4.9 AC_CHECK_FRAME_ADDRESS( [4.10 AC_DEFINE(HAVE_FRAME_ADDRESS, [1], [Define if we have a working builtin frame_address])4.11 ], [ AC_MSG_WARN([Memory exceptions will be slow]) ])
5.1 --- a/src/xlat/x86/x86op.h Mon Nov 08 18:56:11 2010 +10005.2 +++ b/src/xlat/x86/x86op.h Mon Nov 08 22:10:47 2010 +10005.3 @@ -154,7 +154,7 @@5.4 /**5.5 * Encode opcode+reg with no mod/rm (eg MOV imm64, r32)5.6 */5.7 -static void x86_encode_opcodereg( int rexw, uint32_t opcode, int reg )5.8 +static inline void x86_encode_opcodereg( int rexw, uint32_t opcode, int reg )5.9 {5.10 int rex = rexw;5.11 reg &= 0x0F;5.12 @@ -174,7 +174,7 @@5.13 * @param rr reg field5.14 * @param rb r/m field5.15 */5.16 -static void x86_encode_reg_rm( int rexw, uint32_t opcode, int rr, int rb )5.17 +static inline void x86_encode_reg_rm( int rexw, uint32_t opcode, int rr, int rb )5.18 {5.19 int rex = rexw;5.20 rr &= 0x0F;5.21 @@ -203,7 +203,7 @@5.22 * @param ss Scale shift (0..3) applied to index register (ignored if no index register)5.23 * @param disp32 Signed displacement (0 for none)5.24 */5.25 -static void x86_encode_modrm( int rexw, uint32_t opcode, int rr, int rb, int rx, int ss, int32_t disp32 )5.26 +static inline void FORCEINLINE x86_encode_modrm( int rexw, uint32_t opcode, int rr, int rb, int rx, int ss, int32_t disp32 )5.27 {5.28 /* Construct the rex prefix where necessary */5.29 int rex = rexw;5.30 @@ -290,7 +290,7 @@5.31 * @param rr mod/rm reg field5.32 * @param disp32 RIP-relative displacement5.33 */5.34 -static void x86_encode_modrm_rip(int rexw, uint32_t opcode, int rr, int32_t disp32)5.35 +static inline void x86_encode_modrm_rip(int rexw, uint32_t opcode, int rr, int32_t disp32)5.36 {5.37 int rex = rexw;5.38 rr &= 0x0F;
.