MIPS: Add build rules (non-functional, yet).

This commit is contained in:
Mike Pall 2011-12-15 20:39:30 +01:00
parent b61be299c9
commit b330b468b3
6 changed files with 58 additions and 1 deletions

View File

@ -54,6 +54,7 @@ CCOPT_X64=
CCOPT_ARM= CCOPT_ARM=
CCOPT_PPC= CCOPT_PPC=
CCOPT_PPCSPE= CCOPT_PPCSPE=
CCOPT_MIPS=
# #
CCDEBUG= CCDEBUG=
# Uncomment the next line to generate debug information: # Uncomment the next line to generate debug information:
@ -242,6 +243,13 @@ else
ifneq (,$(findstring LJ_TARGET_PPCSPE ,$(TARGET_TESTARCH))) ifneq (,$(findstring LJ_TARGET_PPCSPE ,$(TARGET_TESTARCH)))
TARGET_CCARCH= ppcspe TARGET_CCARCH= ppcspe
TARGET_XCFLAGS+= $(CCOPT_PPCSPE) TARGET_XCFLAGS+= $(CCOPT_PPCSPE)
else
ifneq (,$(findstring LJ_TARGET_MIPS ,$(TARGET_TESTARCH)))
ifneq (,$(findstring MIPSEL ,$(TARGET_TESTARCH)))
TARGET_ARCH= -D__MIPSEL__=1
endif
TARGET_CCARCH= mips
TARGET_XCFLAGS+= $(CCOPT_MIPS)
else else
$(error Unsupported target architecture) $(error Unsupported target architecture)
endif endif
@ -249,8 +257,9 @@ endif
endif endif
endif endif
endif endif
endif
TARGET_ARCH= $(patsubst %,-DLUAJIT_TARGET=LUAJIT_ARCH_%,$(TARGET_CCARCH)) TARGET_ARCH+= $(patsubst %,-DLUAJIT_TARGET=LUAJIT_ARCH_%,$(TARGET_CCARCH))
ifneq (,$(PREFIX)) ifneq (,$(PREFIX))
ifneq (/usr/local,$(PREFIX)) ifneq (/usr/local,$(PREFIX))
@ -353,6 +362,7 @@ DASM_FLAGS_X64WIN= -D X64 -D X64WIN
DASM_FLAGS_ARM= DASM_FLAGS_ARM=
DASM_FLAGS_PPC= DASM_FLAGS_PPC=
DASM_FLAGS_PPCSPE= DASM_FLAGS_PPCSPE=
DASM_FLAGS_MIPS=
BUILDVM_O= buildvm.o buildvm_asm.o buildvm_peobj.o buildvm_lib.o buildvm_fold.o BUILDVM_O= buildvm.o buildvm_asm.o buildvm_peobj.o buildvm_lib.o buildvm_fold.o
BUILDVM_T= buildvm BUILDVM_T= buildvm
@ -399,6 +409,7 @@ ALL_HDRGEN= lj_bcdef.h lj_ffdef.h lj_libdef.h lj_recdef.h lj_folddef.h
ALL_GEN= $(LJVM_S) $(ALL_HDRGEN) $(LIB_VMDEFP) ALL_GEN= $(LJVM_S) $(ALL_HDRGEN) $(LIB_VMDEFP)
ALL_DYNGEN= buildvm_x86.h buildvm_x64.h buildvm_x64win.h buildvm_arm.h \ ALL_DYNGEN= buildvm_x86.h buildvm_x64.h buildvm_x64win.h buildvm_arm.h \
buildvm_ppc.h buildvm_ppcspe.h buildvm_ppc.h buildvm_ppcspe.h
###ALL_DYNGEN+= buildvm_mips.h
WIN_RM= *.obj *.lib *.exp *.dll *.exe *.manifest *.pdb *.ilk WIN_RM= *.obj *.lib *.exp *.dll *.exe *.manifest *.pdb *.ilk
ALL_RM= $(ALL_T) $(ALL_GEN) *.o $(WIN_RM) ALL_RM= $(ALL_T) $(ALL_GEN) *.o $(WIN_RM)
@ -491,6 +502,7 @@ distclean: clean
$(Q)$(DASM) $(DASM_DISTFLAGS) $(DASM_FLAGS_ARM) -o buildvm_arm.h buildvm_arm.dasc $(Q)$(DASM) $(DASM_DISTFLAGS) $(DASM_FLAGS_ARM) -o buildvm_arm.h buildvm_arm.dasc
$(Q)$(DASM) $(DASM_DISTFLAGS) $(DASM_FLAGS_PPC) -o buildvm_ppc.h buildvm_ppc.dasc $(Q)$(DASM) $(DASM_DISTFLAGS) $(DASM_FLAGS_PPC) -o buildvm_ppc.h buildvm_ppc.dasc
$(Q)$(DASM) $(DASM_DISTFLAGS) $(DASM_FLAGS_PPCSPE) -o buildvm_ppcspe.h buildvm_ppcspe.dasc $(Q)$(DASM) $(DASM_DISTFLAGS) $(DASM_FLAGS_PPCSPE) -o buildvm_ppcspe.h buildvm_ppcspe.dasc
@### $(Q)$(DASM) $(DASM_DISTFLAGS) $(DASM_FLAGS_MIPS) -o buildvm_mips.h buildvm_mips.dasc
depend: depend:
@for file in $(ALL_HDRGEN) $(ALL_DYNGEN); do \ @for file in $(ALL_HDRGEN) $(ALL_DYNGEN); do \
@ -536,6 +548,10 @@ buildvm_ppcspe.h: buildvm_ppcspe.dasc
$(E) "DYNASM $@" $(E) "DYNASM $@"
$(Q)$(DASM) $(DASM_FLAGS) $(DASM_FLAGS_PPCSPE) -o $@ buildvm_ppcspe.dasc $(Q)$(DASM) $(DASM_FLAGS) $(DASM_FLAGS_PPCSPE) -o $@ buildvm_ppcspe.dasc
buildvm_mips.h: buildvm_mips.dasc
$(E) "DYNASM $@"
$(Q)$(DASM) $(DASM_FLAGS) $(DASM_FLAGS_MIPS) -o $@ buildvm_mips.dasc
buildvm.o: $(ALL_DYNGEN) $(DASM_DIR)/dasm_*.h buildvm.o: $(ALL_DYNGEN) $(DASM_DIR)/dasm_*.h
$(BUILDVM_T): $(BUILDVM_O) $(BUILDVM_T): $(BUILDVM_O)

View File

@ -74,6 +74,9 @@ static int collect_reloc(BuildCtx *ctx, uint8_t *addr, int idx, int type);
#elif LJ_TARGET_PPCSPE #elif LJ_TARGET_PPCSPE
#include "../dynasm/dasm_ppc.h" #include "../dynasm/dasm_ppc.h"
#include "buildvm_ppcspe.h" #include "buildvm_ppcspe.h"
#elif LJ_TARGET_MIPS
#include "../dynasm/dasm_mips.h"
#include "buildvm_mips.h"
#else #else
#error "No support for this architecture (yet)" #error "No support for this architecture (yet)"
#endif #endif

View File

@ -119,6 +119,8 @@ static void emit_asm_wordreloc(BuildCtx *ctx, uint8_t *p, int n,
ins, sym); ins, sym);
exit(1); exit(1);
} }
#elif LJ_TARGET_MIPS
UNUSED(sym); /* NYI */
#else #else
#error "missing relocation support for this architecture" #error "missing relocation support for this architecture"
#endif #endif

View File

@ -614,6 +614,8 @@ static uint32_t jit_cpudetect(lua_State *L)
#endif #endif
#elif LJ_TARGET_PPC || LJ_TARGET_PPCSPE #elif LJ_TARGET_PPC || LJ_TARGET_PPCSPE
/* Nothing to do. */ /* Nothing to do. */
#elif LJ_TARGET_MIPS
/* NYI */
#else #else
#error "Missing CPU detection for this architecture" #error "Missing CPU detection for this architecture"
#endif #endif

View File

@ -23,6 +23,8 @@
#define LUAJIT_ARCH_ppc 4 #define LUAJIT_ARCH_ppc 4
#define LUAJIT_ARCH_PPCSPE 5 #define LUAJIT_ARCH_PPCSPE 5
#define LUAJIT_ARCH_ppcspe 5 #define LUAJIT_ARCH_ppcspe 5
#define LUAJIT_ARCH_MIPS 6
#define LUAJIT_ARCH_mips 6
/* Target OS. */ /* Target OS. */
#define LUAJIT_OS_OTHER 0 #define LUAJIT_OS_OTHER 0
@ -47,6 +49,8 @@
#else #else
#define LUAJIT_TARGET LUAJIT_ARCH_PPC #define LUAJIT_TARGET LUAJIT_ARCH_PPC
#endif #endif
#elif defined(__mips__) || defined(__mips) || defined(__MIPS__) || defined(__MIPS)
#define LUAJIT_TARGET LUAJIT_ARCH_MIPS
#else #else
#error "No support for this architecture (yet)" #error "No support for this architecture (yet)"
#endif #endif
@ -182,6 +186,26 @@
#define LJ_ARCH_NOFFI 1 /* NYI: comparisons, calls. */ #define LJ_ARCH_NOFFI 1 /* NYI: comparisons, calls. */
#define LJ_ARCH_NOJIT 1 #define LJ_ARCH_NOJIT 1
#elif LUAJIT_TARGET == LUAJIT_ARCH_MIPS
#define LJ_ARCH_NAME "mips"
#define LJ_ARCH_BITS 32
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL)
#define LJ_ARCH_ENDIAN LUAJIT_LE
#else
#define LJ_ARCH_ENDIAN LUAJIT_BE
#endif
#define LJ_ARCH_HASFPU 1
#define LJ_TARGET_MIPS 1
#define LJ_TARGET_EHRETREG 4
#define LJ_TARGET_JUMPRANGE 27 /* 2*2^27 = 256MB-aligned region */
#define LJ_TARGET_MASKSHIFT 1
#define LJ_TARGET_MASKROT 1
#define LJ_TARGET_UNIFYROT 2 /* Want only IR_BROR. */
#define LJ_ARCH_NUMMODE LJ_NUMMODE_SINGLE
#define LJ_ARCH_NOFFI 1
#define LJ_ARCH_NOJIT 1
#else #else
#error "No target architecture defined" #error "No target architecture defined"
#endif #endif

View File

@ -117,6 +117,16 @@ enum {
#define CFRAME_OFS_MULTRES 8 #define CFRAME_OFS_MULTRES 8
#define CFRAME_SIZE 184 #define CFRAME_SIZE 184
#define CFRAME_SHIFT_MULTRES 3 #define CFRAME_SHIFT_MULTRES 3
#elif LJ_TARGET_MIPS
/* NYI: Dummy definitions for now. */
#define CFRAME_OFS_ERRF 0
#define CFRAME_OFS_NRES 0
#define CFRAME_OFS_PREV 0
#define CFRAME_OFS_L 0
#define CFRAME_OFS_PC 0
#define CFRAME_OFS_MULTRES 0
#define CFRAME_SIZE 256
#define CFRAME_SHIFT_MULTRES 3
#else #else
#error "Missing CFRAME_* definitions for this architecture" #error "Missing CFRAME_* definitions for this architecture"
#endif #endif