ARM/PPC: Detect more target arch variants. Detect console OS.

This commit is contained in:
Mike Pall 2012-06-09 20:53:22 +02:00
parent 9d7bd04fae
commit 9f443e8b89
2 changed files with 83 additions and 8 deletions

View File

@ -591,11 +591,11 @@ static uint32_t jit_cpudetect(lua_State *L)
#elif LJ_TARGET_ARM
#if LJ_HASJIT
/* Compile-time ARM CPU detection. */
#if __ARM_ARCH_7__ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__
#if LJ_ARCH_VERSION >= 70
flags |= JIT_F_ARMV6|JIT_F_ARMV6T2|JIT_F_ARMV7;
#elif __ARM_ARCH_6T2__
#elif LJ_ARCH_VERSION >= 61
flags |= JIT_F_ARMV6|JIT_F_ARMV6T2;
#elif __ARM_ARCH_6__ || __ARM_ARCH_6J__ || __ARM_ARCH_6Z__ || __ARM_ARCH_6ZK__
#elif LJ_ARCH_VERSION >= 60
flags |= JIT_F_ARMV6;
#endif
/* Runtime ARM CPU detection. */
@ -612,12 +612,28 @@ static uint32_t jit_cpudetect(lua_State *L)
}
#endif
#endif
#elif LJ_TARGET_PPC || LJ_TARGET_PPCSPE
#elif LJ_TARGET_PPC
#if LJ_ARCH_PPC64
flags |= JIT_F_PPC64;
#endif
#if LJ_ARCH_SQRT
flags |= JIT_F_SQRT;
#endif
#if LJ_ARCH_ROUND
flags |= JIT_F_ROUND;
#endif
#if LJ_ARCH_CELL
flags |= JIT_F_CELL;
#endif
#if LJ_ARCH_XENON
flags |= JIT_F_XENON;
#endif
#elif LJ_TARGET_PPCSPE
/* Nothing to do. */
#elif LJ_TARGET_MIPS
#if LJ_HASJIT
/* Compile-time MIPS CPU detection. */
#if _MIPS_ARCH_MIPS32R2
#if LJ_ARCH_VERSION >= 20
flags |= JIT_F_MIPS32R2;
#endif
/* Runtime MIPS CPU detection. */

View File

@ -60,7 +60,7 @@
/* Select native OS if no target OS defined. */
#ifndef LUAJIT_OS
#if defined(_WIN32)
#if defined(_WIN32) && !defined(_XBOX_VER)
#define LUAJIT_OS LUAJIT_OS_WINDOWS
#elif defined(__linux__)
#define LUAJIT_OS LUAJIT_OS_LINUX
@ -100,6 +100,16 @@
#define LJ_TARGET_POSIX (LUAJIT_OS > LUAJIT_OS_WINDOWS)
#define LJ_TARGET_DLOPEN LJ_TARGET_POSIX
#ifdef __CELLOS_LV2__
#define LJ_TARGET_PS3 1
#define LJ_TARGET_CONSOLE 1
#endif
#if _XBOX_VER >= 200
#define LJ_TARGET_XBOX360 1
#define LJ_TARGET_CONSOLE 1
#endif
#define LJ_NUMMODE_SINGLE 0 /* Single-number mode only. */
#define LJ_NUMMODE_SINGLE_DUAL 1 /* Default to single-number mode. */
#define LJ_NUMMODE_DUAL 2 /* Dual-number mode only. */
@ -151,6 +161,16 @@
#define LJ_TARGET_UNIFYROT 2 /* Want only IR_BROR. */
#define LJ_ARCH_NUMMODE LJ_NUMMODE_DUAL
#if __ARM_ARCH_7__ || __ARM_ARCH_7A__ || __ARM_ARCH_7R__
#define LJ_ARCH_VERSION 70
#elif __ARM_ARCH_6T2__
#define LJ_ARCH_VERSION 61
#elif __ARM_ARCH_6__ || __ARM_ARCH_6J__ || __ARM_ARCH_6K__ || __ARM_ARCH_6Z__ || __ARM_ARCH_6ZK__
#define LJ_ARCH_VERSION 60
#else
#define LJ_ARCH_VERSION 50
#endif
#elif LUAJIT_TARGET == LUAJIT_ARCH_PPC
#define LJ_ARCH_NAME "ppc"
@ -165,6 +185,35 @@
#define LJ_TARGET_UNIFYROT 1 /* Want only IR_BROL. */
#define LJ_ARCH_NUMMODE LJ_NUMMODE_DUAL_SINGLE
#if _ARCH_PWR7
#define LJ_ARCH_VERSION 70
#elif _ARCH_PWR6
#define LJ_ARCH_VERSION 60
#elif _ARCH_PWR5X
#define LJ_ARCH_VERSION 51
#elif _ARCH_PWR5
#define LJ_ARCH_VERSION 50
#elif _ARCH_PWR4
#define LJ_ARCH_VERSION 40
#else
#define LJ_ARCH_VERSION 0
#endif
#if __PPC64__ || __powerpc64__ || LJ_TARGET_XBOX360
#define LJ_ARCH_PPC64 1
#endif
#if _ARCH_PPCSQ
#define LJ_ARCH_SQRT 1
#endif
#if _ARCH_PPC5X
#define LJ_ARCH_ROUND 1
#endif
#if __PPU__
#define LJ_ARCH_CELL 1
#endif
#if LJ_TARGET_XBOX360
#define LJ_ARCH_XENON 1
#endif
#elif LUAJIT_TARGET == LUAJIT_ARCH_PPCSPE
#define LJ_ARCH_NAME "ppcspe"
@ -202,6 +251,12 @@
#define LJ_TARGET_UNIFYROT 2 /* Want only IR_BROR. */
#define LJ_ARCH_NUMMODE LJ_NUMMODE_SINGLE
#if _MIPS_ARCH_MIPS32R2
#define LJ_ARCH_VERSION 20
#else
#define LJ_ARCH_VERSION 10
#endif
#else
#error "No target architecture defined"
#endif
@ -240,6 +295,9 @@
#if defined(__ARM_PCS_VFP)
#error "No support for ARM hard-float ABI (yet)"
#endif
#if __ARM_ARCH_6M__ || __ARM_ARCH_7M__ || __ARM_ARCH_7EM__
#error "No support for Cortex-M CPUs"
#endif
#if !(__ARM_EABI__ || LJ_TARGET_IOS)
#error "Only ARM EABI or iOS 3.0+ ABI is supported"
#endif
@ -269,8 +327,9 @@
#define LJ_DUALNUM 0
#endif
#if LJ_TARGET_IOS
#if LJ_TARGET_IOS || LJ_TARGET_CONSOLE
/* Runtime code generation is restricted on iOS. Complain to Apple, not me. */
/* Ditto for the consoles. Complain to Sony or MS, not me. */
#ifndef LUAJIT_ENABLE_JIT
#define LJ_OS_NOJIT 1
#endif
@ -320,7 +379,7 @@
#define LUAJIT_NO_EXP2
#endif
#if defined(__symbian__) || LJ_TARGET_IOS
#if defined(__symbian__) || LJ_TARGET_IOS || LJ_TARGET_PS3
#define LUAJIT_NO_UNWIND
#endif