aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2010-08-31 00:04:32 +0200
committerMike Pall <mike>2010-08-31 00:04:32 +0200
commitc7f91f8cd1c64031d6f74e957f6ad72f0bc8cf10 (patch)
tree2e6c214d2fe5d010afbc5cbef2251cad221c429e /src
parente1efd0d871e816bb6d2851b5941ba3b4b3d1d01b (diff)
downloadluajit-c7f91f8cd1c64031d6f74e957f6ad72f0bc8cf10.tar.gz
luajit-c7f91f8cd1c64031d6f74e957f6ad72f0bc8cf10.tar.bz2
luajit-c7f91f8cd1c64031d6f74e957f6ad72f0bc8cf10.zip
PPC: Add register assignments and type definitions.
Diffstat (limited to 'src')
-rw-r--r--src/buildvm_ppc.dasc62
-rw-r--r--src/buildvm_ppcspe.h13
2 files changed, 75 insertions, 0 deletions
diff --git a/src/buildvm_ppc.dasc b/src/buildvm_ppc.dasc
index c2363d97..c76c425d 100644
--- a/src/buildvm_ppc.dasc
+++ b/src/buildvm_ppc.dasc
@@ -14,8 +14,55 @@
14|.error "No support for plain PowerPC CPUs (yet)" 14|.error "No support for plain PowerPC CPUs (yet)"
15|.endif 15|.endif
16| 16|
17|// Note: The ragged indentation of the instructions is intentional.
18|// The starting columns indicate data dependencies.
19|
17|//----------------------------------------------------------------------- 20|//-----------------------------------------------------------------------
18| 21|
22|// Fixed register assignments for the interpreter.
23|// Don't use: r1 = sp, r2 and r13 = reserved and/or small data area ptr
24|
25|// The following must be C callee-save (but BASE is often refetched).
26|.define BASE, r14 // Base of current Lua stack frame.
27|.define KBASE, r15 // Constants of current Lua function.
28|.define PC, r16 // Next PC.
29|.define DISPATCH, r17 // Opcode dispatch table.
30|.define LREG, r18 // Register holding lua_State (also in SAVE_L).
31|
32|// Constants for vectorized type-comparisons (hi+low GPR). C callee-save.
33|.define TISNUM, r21
34|.if SPE
35|.define TISSTR, r22
36|.define TISTAB, r23
37|.define TISFUNC, r24
38|.define TISNIL, r25
39|.endif
40|
41|// The following temporaries are not saved across C calls, except for RA.
42|.define RA, r19 // Callee-save.
43|.define RB, r10
44|.define RC, r11
45|.define RD, r12
46|.define INS, r7 // Overlaps CARG5.
47|
48|.define TMP0, r0
49|.define TMP1, r8
50|.define TMP2, r9
51|.define TMP3, r6 // Overlaps CARG4.
52|
53|// Saved temporaries.
54|.define SAVE0, r20
55|
56|// Calling conventions.
57|.define CARG1, r3
58|.define CARG2, r4
59|.define CARG3, r5
60|.define CARG4, r6 // Overlaps TMP3.
61|.define CARG5, r7 // Overlaps INS.
62|
63|.define CRET1, r3
64|.define CRET2, r4
65|
19|// Stack layout while in interpreter. Must match with lj_frame.h. 66|// Stack layout while in interpreter. Must match with lj_frame.h.
20|.if SPE 67|.if SPE
21|.define SAVE_LR, 180(sp) 68|.define SAVE_LR, 180(sp)
@@ -70,6 +117,21 @@
70| addi sp, sp, CFRAME_SPACE 117| addi sp, sp, CFRAME_SPACE
71|.endmacro 118|.endmacro
72| 119|
120|// Type definitions. Some of these are only used for documentation.
121|.type L, lua_State, LREG
122|.type GL, global_State
123|.type TVALUE, TValue
124|.type GCOBJ, GCobj
125|.type STR, GCstr
126|.type TAB, GCtab
127|.type LFUNC, GCfuncL
128|.type CFUNC, GCfuncC
129|.type PROTO, GCproto
130|.type UPVAL, GCupval
131|.type NODE, Node
132|.type NARGS8, int
133|.type TRACE, GCtrace
134|
73|//----------------------------------------------------------------------- 135|//-----------------------------------------------------------------------
74| 136|
75|// Trap for not-yet-implemented parts. 137|// Trap for not-yet-implemented parts.
diff --git a/src/buildvm_ppcspe.h b/src/buildvm_ppcspe.h
index 9a066bc6..8c25fdf8 100644
--- a/src/buildvm_ppcspe.h
+++ b/src/buildvm_ppcspe.h
@@ -748,6 +748,19 @@ static const char *const globnames[] = {
748static const char *const extnames[] = { 748static const char *const extnames[] = {
749 (const char *)0 749 (const char *)0
750}; 750};
751#define Dt1(_V) (int)(ptrdiff_t)&(((lua_State *)0)_V)
752#define Dt2(_V) (int)(ptrdiff_t)&(((global_State *)0)_V)
753#define Dt3(_V) (int)(ptrdiff_t)&(((TValue *)0)_V)
754#define Dt4(_V) (int)(ptrdiff_t)&(((GCobj *)0)_V)
755#define Dt5(_V) (int)(ptrdiff_t)&(((GCstr *)0)_V)
756#define Dt6(_V) (int)(ptrdiff_t)&(((GCtab *)0)_V)
757#define Dt7(_V) (int)(ptrdiff_t)&(((GCfuncL *)0)_V)
758#define Dt8(_V) (int)(ptrdiff_t)&(((GCfuncC *)0)_V)
759#define Dt9(_V) (int)(ptrdiff_t)&(((GCproto *)0)_V)
760#define DtA(_V) (int)(ptrdiff_t)&(((GCupval *)0)_V)
761#define DtB(_V) (int)(ptrdiff_t)&(((Node *)0)_V)
762#define DtC(_V) (int)(ptrdiff_t)&(((int *)0)_V)
763#define DtD(_V) (int)(ptrdiff_t)&(((GCtrace *)0)_V)
751#define DISPATCH_GL(field) (GG_DISP2G + (int)offsetof(global_State, field)) 764#define DISPATCH_GL(field) (GG_DISP2G + (int)offsetof(global_State, field))
752#define DISPATCH_J(field) (GG_DISP2J + (int)offsetof(jit_State, field)) 765#define DISPATCH_J(field) (GG_DISP2J + (int)offsetof(jit_State, field))
753#define PC2PROTO(field) ((int)offsetof(GCproto, field)-(int)sizeof(GCproto)) 766#define PC2PROTO(field) ((int)offsetof(GCproto, field)-(int)sizeof(GCproto))