mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 15:14:08 +00:00
PPC: Add PowerPC target architecture selection.
This commit is contained in:
parent
06ae534328
commit
5526fa2312
@ -1,12 +1,13 @@
|
||||
buildvm.o: buildvm.c lua.h luaconf.h luajit.h lj_obj.h lj_def.h lj_arch.h \
|
||||
lj_gc.h lj_bc.h lj_ir.h lj_frame.h lj_dispatch.h lj_jit.h buildvm.h \
|
||||
buildvm.o: buildvm.c buildvm.h lj_def.h lua.h luaconf.h lj_arch.h \
|
||||
lj_obj.h lj_gc.h lj_bc.h lj_ir.h lj_frame.h lj_dispatch.h lj_jit.h \
|
||||
luajit.h \
|
||||
lj_traceerr.h
|
||||
buildvm_asm.o: buildvm_asm.c buildvm.h lj_def.h lua.h luaconf.h lj_arch.h \
|
||||
lj_bc.h
|
||||
buildvm_fold.o: buildvm_fold.c lj_obj.h lua.h luaconf.h lj_def.h \
|
||||
lj_arch.h lj_ir.h buildvm.h
|
||||
buildvm_lib.o: buildvm_lib.c lj_obj.h lua.h luaconf.h lj_def.h lj_arch.h \
|
||||
lj_lib.h buildvm.h
|
||||
buildvm_fold.o: buildvm_fold.c buildvm.h lj_def.h lua.h luaconf.h \
|
||||
lj_arch.h lj_obj.h lj_ir.h
|
||||
buildvm_lib.o: buildvm_lib.c buildvm.h lj_def.h lua.h luaconf.h lj_arch.h \
|
||||
lj_obj.h lj_lib.h
|
||||
buildvm_peobj.o: buildvm_peobj.c buildvm.h lj_def.h lua.h luaconf.h \
|
||||
lj_arch.h lj_bc.h
|
||||
lib_aux.o: lib_aux.c lua.h luaconf.h lauxlib.h lj_obj.h lj_def.h \
|
||||
|
@ -14,22 +14,19 @@
|
||||
** It's a one-shot tool -- any effort fixing this would be wasted.
|
||||
*/
|
||||
|
||||
#include "lua.h"
|
||||
#include "luajit.h"
|
||||
|
||||
#ifdef LUA_USE_WIN
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#include "buildvm.h"
|
||||
#include "lj_obj.h"
|
||||
#include "lj_gc.h"
|
||||
#include "lj_bc.h"
|
||||
#include "lj_ir.h"
|
||||
#include "lj_frame.h"
|
||||
#include "lj_dispatch.h"
|
||||
|
||||
#include "buildvm.h"
|
||||
#include "luajit.h"
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
@ -422,6 +419,12 @@ int main(int argc, char **argv)
|
||||
BuildCtx *ctx = &ctx_;
|
||||
int status, binmode;
|
||||
|
||||
if (sizeof(void *) != 4*LJ_32+8*LJ_64) {
|
||||
fprintf(stderr,"Error: pointer size mismatch in cross-build.\n");
|
||||
fprintf(stderr,"Try: make CC=\"gcc -m32\" CROSS=... TARGET=...\n\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
UNUSED(argc);
|
||||
parseargs(ctx, argv);
|
||||
|
||||
|
@ -3,11 +3,10 @@
|
||||
** Copyright (C) 2005-2010 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#include "buildvm.h"
|
||||
#include "lj_obj.h"
|
||||
#include "lj_ir.h"
|
||||
|
||||
#include "buildvm.h"
|
||||
|
||||
/* Context for the folding hash table generator. */
|
||||
static int lineno;
|
||||
static int funcidx;
|
||||
|
@ -3,11 +3,10 @@
|
||||
** Copyright (C) 2005-2010 Mike Pall. See Copyright Notice in luajit.h
|
||||
*/
|
||||
|
||||
#include "buildvm.h"
|
||||
#include "lj_obj.h"
|
||||
#include "lj_lib.h"
|
||||
|
||||
#include "buildvm.h"
|
||||
|
||||
/* Context for library definitions. */
|
||||
static uint8_t obuf[8192];
|
||||
static uint8_t *optr;
|
||||
|
@ -18,6 +18,10 @@
|
||||
#define LUAJIT_ARCH_x86 1
|
||||
#define LUAJIT_ARCH_X64 2
|
||||
#define LUAJIT_ARCH_x64 2
|
||||
#define LUAJIT_ARCH_PPC 3
|
||||
#define LUAJIT_ARCH_ppc 3
|
||||
#define LUAJIT_ARCH_PPCSPE 4
|
||||
#define LUAJIT_ARCH_ppcspe 4
|
||||
|
||||
|
||||
/* Select native target if no target defined. */
|
||||
@ -27,6 +31,12 @@
|
||||
#define LUAJIT_TARGET LUAJIT_ARCH_X86
|
||||
#elif defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || defined(_M_AMD64)
|
||||
#define LUAJIT_TARGET LUAJIT_ARCH_X64
|
||||
#elif defined(__ppc__) || defined(__ppc) || defined(__PPC__) || defined(__PPC) || defined(__powerpc__) || defined(__powerpc) || defined(__POWERPC__) || defined(__POWERPC) || defined(_M_PPC)
|
||||
#ifdef __NO_FPRS__
|
||||
#define LUAJIT_TARGET LUAJIT_ARCH_PPCSPE
|
||||
#else
|
||||
#define LUAJIT_TARGET LUAJIT_ARCH_PPC
|
||||
#endif
|
||||
#else
|
||||
#error "No support for this architecture (yet)"
|
||||
#endif
|
||||
@ -35,23 +45,56 @@
|
||||
|
||||
/* Set target properties. */
|
||||
#if LUAJIT_TARGET == LUAJIT_ARCH_X86
|
||||
|
||||
#define LJ_ARCH_NAME "x86"
|
||||
#define LJ_ARCH_BITS 32
|
||||
#define LJ_ARCH_ENDIAN LUAJIT_LE
|
||||
#define LJ_TARGET_X86 1
|
||||
#define LJ_TARGET_X86ORX64 1
|
||||
#define LJ_PAGESIZE 4096
|
||||
#define LJ_TARGET_MASKEDSHIFT 1
|
||||
|
||||
#elif LUAJIT_TARGET == LUAJIT_ARCH_X64
|
||||
|
||||
#define LJ_ARCH_NAME "x64"
|
||||
#define LJ_ARCH_BITS 64
|
||||
#define LJ_ARCH_ENDIAN LUAJIT_LE
|
||||
#define LJ_TARGET_X64 1
|
||||
#define LJ_TARGET_X86ORX64 1
|
||||
#define LJ_PAGESIZE 4096
|
||||
#define LJ_TARGET_MASKEDSHIFT 1
|
||||
|
||||
#elif LUAJIT_TARGET == LUAJIT_ARCH_PPC
|
||||
|
||||
#error "No support for plain PowerPC CPUs (yet)"
|
||||
|
||||
#elif LUAJIT_TARGET == LUAJIT_ARCH_PPCSPE
|
||||
|
||||
#define LJ_ARCH_NAME "ppcspe"
|
||||
#define LJ_ARCH_BITS 32
|
||||
#define LJ_ARCH_ENDIAN LUAJIT_BE
|
||||
#define LJ_TARGET_PPC 1
|
||||
#define LJ_TARGET_PPCSPE 1
|
||||
#define LJ_PAGESIZE 4096
|
||||
#define LJ_TARGET_MASKEDSHIFT 1
|
||||
#define LJ_ARCH_NOJIT 1
|
||||
|
||||
#else
|
||||
#error "No target architecture defined"
|
||||
#endif
|
||||
|
||||
/* Check target-specific constraints. */
|
||||
#ifndef _BUILDVM_H
|
||||
#if LJ_TARGET_PPC
|
||||
#if defined(_SOFT_FLOAT) || defined(_SOFT_DOUBLE)
|
||||
#error "No support for PowerPC CPUs without double-precision FPU"
|
||||
#endif
|
||||
#if defined(_LITTLE_ENDIAN)
|
||||
#error "No support for little-endian PowerPC"
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Disable or enable the JIT compiler. */
|
||||
#if defined(LUAJIT_DISABLE_JIT) || defined(LJ_ARCH_NOJIT)
|
||||
#define LJ_HASJIT 0
|
||||
@ -78,9 +121,7 @@
|
||||
#endif
|
||||
|
||||
/* Whether target CPU masks the shift count by the operand length or not. */
|
||||
#if LJ_TARGET_X86ORX64
|
||||
#define LJ_TARGET_MASKEDSHIFT 1
|
||||
#else
|
||||
#ifndef LJ_TARGET_MASKEDSHIFT
|
||||
#define LJ_TARGET_MASKEDSHIFT 0
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user