summaryrefslogtreecommitdiff
path: root/src/lj_arch.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_arch.h')
-rw-r--r--src/lj_arch.h47
1 files changed, 44 insertions, 3 deletions
diff --git a/src/lj_arch.h b/src/lj_arch.h
index 86a2d5ed..d87575ed 100644
--- a/src/lj_arch.h
+++ b/src/lj_arch.h
@@ -18,6 +18,10 @@
18#define LUAJIT_ARCH_x86 1 18#define LUAJIT_ARCH_x86 1
19#define LUAJIT_ARCH_X64 2 19#define LUAJIT_ARCH_X64 2
20#define LUAJIT_ARCH_x64 2 20#define LUAJIT_ARCH_x64 2
21#define LUAJIT_ARCH_PPC 3
22#define LUAJIT_ARCH_ppc 3
23#define LUAJIT_ARCH_PPCSPE 4
24#define LUAJIT_ARCH_ppcspe 4
21 25
22 26
23/* Select native target if no target defined. */ 27/* Select native target if no target defined. */
@@ -27,6 +31,12 @@
27#define LUAJIT_TARGET LUAJIT_ARCH_X86 31#define LUAJIT_TARGET LUAJIT_ARCH_X86
28#elif defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64) 32#elif defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)
29#define LUAJIT_TARGET LUAJIT_ARCH_X64 33#define LUAJIT_TARGET LUAJIT_ARCH_X64
34#elif defined(__ppc__) || defined(__ppc) || defined(__PPC__) || defined(__PPC) || defined(__powerpc__) || defined(__powerpc) || defined(__POWERPC__) || defined(__POWERPC) || defined(_M_PPC)
35#ifdef __NO_FPRS__
36#define LUAJIT_TARGET LUAJIT_ARCH_PPCSPE
37#else
38#define LUAJIT_TARGET LUAJIT_ARCH_PPC
39#endif
30#else 40#else
31#error "No support for this architecture (yet)" 41#error "No support for this architecture (yet)"
32#endif 42#endif
@@ -35,23 +45,56 @@
35 45
36/* Set target properties. */ 46/* Set target properties. */
37#if LUAJIT_TARGET == LUAJIT_ARCH_X86 47#if LUAJIT_TARGET == LUAJIT_ARCH_X86
48
38#define LJ_ARCH_NAME "x86" 49#define LJ_ARCH_NAME "x86"
39#define LJ_ARCH_BITS 32 50#define LJ_ARCH_BITS 32
40#define LJ_ARCH_ENDIAN LUAJIT_LE 51#define LJ_ARCH_ENDIAN LUAJIT_LE
41#define LJ_TARGET_X86 1 52#define LJ_TARGET_X86 1
42#define LJ_TARGET_X86ORX64 1 53#define LJ_TARGET_X86ORX64 1
43#define LJ_PAGESIZE 4096 54#define LJ_PAGESIZE 4096
55#define LJ_TARGET_MASKEDSHIFT 1
56
44#elif LUAJIT_TARGET == LUAJIT_ARCH_X64 57#elif LUAJIT_TARGET == LUAJIT_ARCH_X64
58
45#define LJ_ARCH_NAME "x64" 59#define LJ_ARCH_NAME "x64"
46#define LJ_ARCH_BITS 64 60#define LJ_ARCH_BITS 64
47#define LJ_ARCH_ENDIAN LUAJIT_LE 61#define LJ_ARCH_ENDIAN LUAJIT_LE
48#define LJ_TARGET_X64 1 62#define LJ_TARGET_X64 1
49#define LJ_TARGET_X86ORX64 1 63#define LJ_TARGET_X86ORX64 1
50#define LJ_PAGESIZE 4096 64#define LJ_PAGESIZE 4096
65#define LJ_TARGET_MASKEDSHIFT 1
66
67#elif LUAJIT_TARGET == LUAJIT_ARCH_PPC
68
69#error "No support for plain PowerPC CPUs (yet)"
70
71#elif LUAJIT_TARGET == LUAJIT_ARCH_PPCSPE
72
73#define LJ_ARCH_NAME "ppcspe"
74#define LJ_ARCH_BITS 32
75#define LJ_ARCH_ENDIAN LUAJIT_BE
76#define LJ_TARGET_PPC 1
77#define LJ_TARGET_PPCSPE 1
78#define LJ_PAGESIZE 4096
79#define LJ_TARGET_MASKEDSHIFT 1
80#define LJ_ARCH_NOJIT 1
81
51#else 82#else
52#error "No target architecture defined" 83#error "No target architecture defined"
53#endif 84#endif
54 85
86/* Check target-specific constraints. */
87#ifndef _BUILDVM_H
88#if LJ_TARGET_PPC
89#if defined(_SOFT_FLOAT) || defined(_SOFT_DOUBLE)
90#error "No support for PowerPC CPUs without double-precision FPU"
91#endif
92#if defined(_LITTLE_ENDIAN)
93#error "No support for little-endian PowerPC"
94#endif
95#endif
96#endif
97
55/* Disable or enable the JIT compiler. */ 98/* Disable or enable the JIT compiler. */
56#if defined(LUAJIT_DISABLE_JIT) || defined(LJ_ARCH_NOJIT) 99#if defined(LUAJIT_DISABLE_JIT) || defined(LJ_ARCH_NOJIT)
57#define LJ_HASJIT 0 100#define LJ_HASJIT 0
@@ -78,9 +121,7 @@
78#endif 121#endif
79 122
80/* Whether target CPU masks the shift count by the operand length or not. */ 123/* Whether target CPU masks the shift count by the operand length or not. */
81#if LJ_TARGET_X86ORX64 124#ifndef LJ_TARGET_MASKEDSHIFT
82#define LJ_TARGET_MASKEDSHIFT 1
83#else
84#define LJ_TARGET_MASKEDSHIFT 0 125#define LJ_TARGET_MASKEDSHIFT 0
85#endif 126#endif
86 127