RetroArch
Macros | Enumerations | Variables
lopcodes.h File Reference
#include "llimits.h"
Include dependency graph for lopcodes.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SIZE_C   9
 
#define SIZE_B   9
 
#define SIZE_Bx   (SIZE_C + SIZE_B)
 
#define SIZE_A   8
 
#define SIZE_Ax   (SIZE_C + SIZE_B + SIZE_A)
 
#define SIZE_OP   6
 
#define POS_OP   0
 
#define POS_A   (POS_OP + SIZE_OP)
 
#define POS_C   (POS_A + SIZE_A)
 
#define POS_B   (POS_C + SIZE_C)
 
#define POS_Bx   POS_C
 
#define POS_Ax   POS_A
 
#define MAXARG_Bx   MAX_INT
 
#define MAXARG_sBx   MAX_INT
 
#define MAXARG_Ax   MAX_INT
 
#define MAXARG_A   ((1<<SIZE_A)-1)
 
#define MAXARG_B   ((1<<SIZE_B)-1)
 
#define MAXARG_C   ((1<<SIZE_C)-1)
 
#define MASK1(n, p)   ((~((~(Instruction)0)<<(n)))<<(p))
 
#define MASK0(n, p)   (~MASK1(n,p))
 
#define GET_OPCODE(i)   (cast(OpCode, ((i)>>POS_OP) & MASK1(SIZE_OP,0)))
 
#define SET_OPCODE(i, o)
 
#define getarg(i, pos, size)   (cast(int, ((i)>>pos) & MASK1(size,0)))
 
#define setarg(i, v, pos, size)
 
#define GETARG_A(i)   getarg(i, POS_A, SIZE_A)
 
#define SETARG_A(i, v)   setarg(i, v, POS_A, SIZE_A)
 
#define GETARG_B(i)   getarg(i, POS_B, SIZE_B)
 
#define SETARG_B(i, v)   setarg(i, v, POS_B, SIZE_B)
 
#define GETARG_C(i)   getarg(i, POS_C, SIZE_C)
 
#define SETARG_C(i, v)   setarg(i, v, POS_C, SIZE_C)
 
#define GETARG_Bx(i)   getarg(i, POS_Bx, SIZE_Bx)
 
#define SETARG_Bx(i, v)   setarg(i, v, POS_Bx, SIZE_Bx)
 
#define GETARG_Ax(i)   getarg(i, POS_Ax, SIZE_Ax)
 
#define SETARG_Ax(i, v)   setarg(i, v, POS_Ax, SIZE_Ax)
 
#define GETARG_sBx(i)   (GETARG_Bx(i)-MAXARG_sBx)
 
#define SETARG_sBx(i, b)   SETARG_Bx((i),cast(unsigned int, (b)+MAXARG_sBx))
 
#define CREATE_ABC(o, a, b, c)
 
#define CREATE_ABx(o, a, bc)
 
#define CREATE_Ax(o, a)
 
#define BITRK   (1 << (SIZE_B - 1))
 
#define ISK(x)   ((x) & BITRK)
 
#define INDEXK(r)   ((int)(r) & ~BITRK)
 
#define MAXINDEXRK   (BITRK - 1)
 
#define RKASK(x)   ((x) | BITRK)
 
#define NO_REG   MAXARG_A
 
#define NUM_OPCODES   (cast(int, OP_EXTRAARG) + 1)
 
#define getOpMode(m)   (cast(enum OpMode, luaP_opmodes[m] & 3))
 
#define getBMode(m)   (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3))
 
#define getCMode(m)   (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3))
 
#define testAMode(m)   (luaP_opmodes[m] & (1 << 6))
 
#define testTMode(m)   (luaP_opmodes[m] & (1 << 7))
 
#define LFIELDS_PER_FLUSH   50
 

Enumerations

enum  OpMode { iABC, iABx, iAsBx, iAx }
 
enum  OpCode {
  OP_MOVE, OP_LOADK, OP_LOADKX, OP_LOADBOOL,
  OP_LOADNIL, OP_GETUPVAL, OP_GETTABUP, OP_GETTABLE,
  OP_SETTABUP, OP_SETUPVAL, OP_SETTABLE, OP_NEWTABLE,
  OP_SELF, OP_ADD, OP_SUB, OP_MUL,
  OP_MOD, OP_POW, OP_DIV, OP_IDIV,
  OP_BAND, OP_BOR, OP_BXOR, OP_SHL,
  OP_SHR, OP_UNM, OP_BNOT, OP_NOT,
  OP_LEN, OP_CONCAT, OP_JMP, OP_EQ,
  OP_LT, OP_LE, OP_TEST, OP_TESTSET,
  OP_CALL, OP_TAILCALL, OP_RETURN, OP_FORLOOP,
  OP_FORPREP, OP_TFORCALL, OP_TFORLOOP, OP_SETLIST,
  OP_CLOSURE, OP_VARARG, OP_EXTRAARG
}
 
enum  OpArgMask { OpArgN, OpArgU, OpArgR, OpArgK }
 

Variables

LUAI_DDEC const lu_byte luaP_opmodes [NUM_OPCODES]
 
LUAI_DDEC const char *const luaP_opnames [NUM_OPCODES+1]
 

Macro Definition Documentation

◆ BITRK

#define BITRK   (1 << (SIZE_B - 1))

◆ CREATE_ABC

#define CREATE_ABC (   o,
  a,
  b,
  c 
)
Value:
#define POS_B
Definition: lopcodes.h:49
#define cast(t, exp)
Definition: llimits.h:111
#define POS_OP
Definition: lopcodes.h:46
const GLubyte * c
Definition: glext.h:9812
GLboolean GLboolean GLboolean b
Definition: glext.h:6844
#define POS_C
Definition: lopcodes.h:48
#define POS_A
Definition: lopcodes.h:47
unsigned long Instruction
Definition: llimits.h:165
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6844

◆ CREATE_ABx

#define CREATE_ABx (   o,
  a,
  bc 
)
Value:
| (cast(Instruction, bc)<<POS_Bx))
#define cast(t, exp)
Definition: llimits.h:111
#define POS_OP
Definition: lopcodes.h:46
#define POS_Bx
Definition: lopcodes.h:50
#define POS_A
Definition: lopcodes.h:47
unsigned long Instruction
Definition: llimits.h:165
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6844

◆ CREATE_Ax

#define CREATE_Ax (   o,
  a 
)
Value:
#define cast(t, exp)
Definition: llimits.h:111
#define POS_OP
Definition: lopcodes.h:46
#define POS_Ax
Definition: lopcodes.h:51
unsigned long Instruction
Definition: llimits.h:165
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6844

◆ GET_OPCODE

#define GET_OPCODE (   i)    (cast(OpCode, ((i)>>POS_OP) & MASK1(SIZE_OP,0)))

◆ getarg

#define getarg (   i,
  pos,
  size 
)    (cast(int, ((i)>>pos) & MASK1(size,0)))

◆ GETARG_A

#define GETARG_A (   i)    getarg(i, POS_A, SIZE_A)

◆ GETARG_Ax

#define GETARG_Ax (   i)    getarg(i, POS_Ax, SIZE_Ax)

◆ GETARG_B

#define GETARG_B (   i)    getarg(i, POS_B, SIZE_B)

◆ GETARG_Bx

#define GETARG_Bx (   i)    getarg(i, POS_Bx, SIZE_Bx)

◆ GETARG_C

#define GETARG_C (   i)    getarg(i, POS_C, SIZE_C)

◆ GETARG_sBx

#define GETARG_sBx (   i)    (GETARG_Bx(i)-MAXARG_sBx)

◆ getBMode

#define getBMode (   m)    (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3))

◆ getCMode

#define getCMode (   m)    (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3))

◆ getOpMode

#define getOpMode (   m)    (cast(enum OpMode, luaP_opmodes[m] & 3))

◆ INDEXK

#define INDEXK (   r)    ((int)(r) & ~BITRK)

◆ ISK

#define ISK (   x)    ((x) & BITRK)

◆ LFIELDS_PER_FLUSH

#define LFIELDS_PER_FLUSH   50

◆ MASK0

#define MASK0 (   n,
  p 
)    (~MASK1(n,p))

◆ MASK1

#define MASK1 (   n,
  p 
)    ((~((~(Instruction)0)<<(n)))<<(p))

◆ MAXARG_A

#define MAXARG_A   ((1<<SIZE_A)-1)

◆ MAXARG_Ax

#define MAXARG_Ax   MAX_INT

◆ MAXARG_B

#define MAXARG_B   ((1<<SIZE_B)-1)

◆ MAXARG_Bx

#define MAXARG_Bx   MAX_INT

◆ MAXARG_C

#define MAXARG_C   ((1<<SIZE_C)-1)

◆ MAXARG_sBx

#define MAXARG_sBx   MAX_INT

◆ MAXINDEXRK

#define MAXINDEXRK   (BITRK - 1)

◆ NO_REG

#define NO_REG   MAXARG_A

◆ NUM_OPCODES

#define NUM_OPCODES   (cast(int, OP_EXTRAARG) + 1)

◆ POS_A

#define POS_A   (POS_OP + SIZE_OP)

◆ POS_Ax

#define POS_Ax   POS_A

◆ POS_B

#define POS_B   (POS_C + SIZE_C)

◆ POS_Bx

#define POS_Bx   POS_C

◆ POS_C

#define POS_C   (POS_A + SIZE_A)

◆ POS_OP

#define POS_OP   0

◆ RKASK

#define RKASK (   x)    ((x) | BITRK)

◆ SET_OPCODE

#define SET_OPCODE (   i,
 
)
Value:
((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \
#define MASK0(n, p)
Definition: lopcodes.h:83
#define MASK1(n, p)
Definition: lopcodes.h:80
#define cast(t, exp)
Definition: llimits.h:111
#define POS_OP
Definition: lopcodes.h:46
#define SIZE_OP
Definition: lopcodes.h:44
unsigned long Instruction
Definition: llimits.h:165

◆ setarg

#define setarg (   i,
  v,
  pos,
  size 
)
Value:
((i) = (((i)&MASK0(size,pos)) | \
((cast(Instruction, v)<<pos)&MASK1(size,pos))))
#define MASK0(n, p)
Definition: lopcodes.h:83
#define MASK1(n, p)
Definition: lopcodes.h:80
GLsizeiptr size
Definition: glext.h:6559
#define cast(t, exp)
Definition: llimits.h:111
const GLdouble * v
Definition: glext.h:6391
unsigned long Instruction
Definition: llimits.h:165

◆ SETARG_A

#define SETARG_A (   i,
  v 
)    setarg(i, v, POS_A, SIZE_A)

◆ SETARG_Ax

#define SETARG_Ax (   i,
  v 
)    setarg(i, v, POS_Ax, SIZE_Ax)

◆ SETARG_B

#define SETARG_B (   i,
  v 
)    setarg(i, v, POS_B, SIZE_B)

◆ SETARG_Bx

#define SETARG_Bx (   i,
  v 
)    setarg(i, v, POS_Bx, SIZE_Bx)

◆ SETARG_C

#define SETARG_C (   i,
  v 
)    setarg(i, v, POS_C, SIZE_C)

◆ SETARG_sBx

#define SETARG_sBx (   i,
  b 
)    SETARG_Bx((i),cast(unsigned int, (b)+MAXARG_sBx))

◆ SIZE_A

#define SIZE_A   8

◆ SIZE_Ax

#define SIZE_Ax   (SIZE_C + SIZE_B + SIZE_A)

◆ SIZE_B

#define SIZE_B   9

◆ SIZE_Bx

#define SIZE_Bx   (SIZE_C + SIZE_B)

◆ SIZE_C

#define SIZE_C   9

◆ SIZE_OP

#define SIZE_OP   6

◆ testAMode

#define testAMode (   m)    (luaP_opmodes[m] & (1 << 6))

◆ testTMode

#define testTMode (   m)    (luaP_opmodes[m] & (1 << 7))

Enumeration Type Documentation

◆ OpArgMask

enum OpArgMask
Enumerator
OpArgN 
OpArgU 
OpArgR 
OpArgK 

◆ OpCode

enum OpCode
Enumerator
OP_MOVE 
OP_LOADK 
OP_LOADKX 
OP_LOADBOOL 
OP_LOADNIL 
OP_GETUPVAL 
OP_GETTABUP 
OP_GETTABLE 
OP_SETTABUP 
OP_SETUPVAL 
OP_SETTABLE 
OP_NEWTABLE 
OP_SELF 
OP_ADD 
OP_SUB 
OP_MUL 
OP_MOD 
OP_POW 
OP_DIV 
OP_IDIV 
OP_BAND 
OP_BOR 
OP_BXOR 
OP_SHL 
OP_SHR 
OP_UNM 
OP_BNOT 
OP_NOT 
OP_LEN 
OP_CONCAT 
OP_JMP 
OP_EQ 
OP_LT 
OP_LE 
OP_TEST 
OP_TESTSET 
OP_CALL 
OP_TAILCALL 
OP_RETURN 
OP_FORLOOP 
OP_FORPREP 
OP_TFORCALL 
OP_TFORLOOP 
OP_SETLIST 
OP_CLOSURE 
OP_VARARG 
OP_EXTRAARG 

◆ OpMode

enum OpMode
Enumerator
iABC 
iABx 
iAsBx 
iAx 

Variable Documentation

◆ luaP_opmodes

◆ luaP_opnames

LUAI_DDEC const char* const luaP_opnames[NUM_OPCODES+1]