Macros | Enumerations
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 checkopm(i, m)   (getOpMode(GET_OPCODE(i)) == m)
 
#define CREATE_ABCk(o, a, b, c, k)
 
#define CREATE_ABx(o, a, bc)
 
#define CREATE_Ax(o, a)
 
#define CREATE_sJ(o, j, k)
 
#define GET_OPCODE(i)   (cast(OpCode, ((i)>>POS_OP) & MASK1(SIZE_OP,0)))
 
#define getarg(i, pos, size)   (cast_int(((i)>>(pos)) & MASK1(size,0)))
 
#define GETARG_A(i)   getarg(i, POS_A, SIZE_A)
 
#define GETARG_Ax(i)   check_exp(checkopm(i, iAx), getarg(i, POS_Ax, SIZE_Ax))
 
#define GETARG_B(i)   check_exp(checkopm(i, iABC), getarg(i, POS_B, SIZE_B))
 
#define GETARG_Bx(i)   check_exp(checkopm(i, iABx), getarg(i, POS_Bx, SIZE_Bx))
 
#define GETARG_C(i)   check_exp(checkopm(i, iABC), getarg(i, POS_C, SIZE_C))
 
#define GETARG_k(i)   check_exp(checkopm(i, iABC), getarg(i, POS_k, 1))
 
#define GETARG_sB(i)   sC2int(GETARG_B(i))
 
#define GETARG_sBx(i)   check_exp(checkopm(i, iAsBx), getarg(i, POS_Bx, SIZE_Bx) - OFFSET_sBx)
 
#define GETARG_sC(i)   sC2int(GETARG_C(i))
 
#define GETARG_sJ(i)   check_exp(checkopm(i, isJ), getarg(i, POS_sJ, SIZE_sJ) - OFFSET_sJ)
 
#define getOpMode(m)   (cast(enum OpMode, luaP_opmodes[m] & 7))
 
#define int2sC(i)   ((i) + OFFSET_sC)
 
#define isIT(i)   (testITMode(GET_OPCODE(i)) && GETARG_B(i) == 0)
 
#define isOT(i)
 
#define L_INTHASBITS(b)   ((UINT_MAX >> ((b) - 1)) >= 1)
 
#define LFIELDS_PER_FLUSH   50
 
#define MASK0(n, p)   (~MASK1(n,p))
 
#define MASK1(n, p)   ((~((~(Instruction)0)<<(n)))<<(p))
 
#define MAXARG_A   ((1<<SIZE_A)-1)
 
#define MAXARG_Ax   MAX_INT
 
#define MAXARG_B   ((1<<SIZE_B)-1)
 
#define MAXARG_Bx   MAX_INT
 
#define MAXARG_C   ((1<<SIZE_C)-1)
 
#define MAXARG_sJ   MAX_INT
 
#define MAXINDEXRK   MAXARG_B
 
#define NO_REG   MAXARG_A
 
#define NUM_OPCODES   ((int)(OP_EXTRAARG) + 1)
 
#define OFFSET_sBx   (MAXARG_Bx>>1) /* 'sBx' is signed */
 
#define OFFSET_sC   (MAXARG_C >> 1)
 
#define OFFSET_sJ   (MAXARG_sJ >> 1)
 
#define opmode(mm, ot, it, t, a, m)   (((mm) << 7) | ((ot) << 6) | ((it) << 5) | ((t) << 4) | ((a) << 3) | (m))
 
#define POS_A   (POS_OP + SIZE_OP)
 
#define POS_Ax   POS_A
 
#define POS_B   (POS_k + 1)
 
#define POS_Bx   POS_k
 
#define POS_C   (POS_B + SIZE_B)
 
#define POS_k   (POS_A + SIZE_A)
 
#define POS_OP   0
 
#define POS_sJ   POS_A
 
#define sC2int(i)   ((i) - OFFSET_sC)
 
#define SET_OPCODE(i, o)
 
#define setarg(i, v, pos, size)
 
#define SETARG_A(i, v)   setarg(i, v, POS_A, SIZE_A)
 
#define SETARG_Ax(i, v)   setarg(i, v, POS_Ax, SIZE_Ax)
 
#define SETARG_B(i, v)   setarg(i, v, POS_B, SIZE_B)
 
#define SETARG_Bx(i, v)   setarg(i, v, POS_Bx, SIZE_Bx)
 
#define SETARG_C(i, v)   setarg(i, v, POS_C, SIZE_C)
 
#define SETARG_k(i, v)   setarg(i, v, POS_k, 1)
 
#define SETARG_sBx(i, b)   SETARG_Bx((i),cast_uint((b)+OFFSET_sBx))
 
#define SETARG_sJ(i, j)   setarg(i, cast_uint((j)+OFFSET_sJ), POS_sJ, SIZE_sJ)
 
#define SIZE_A   8
 
#define SIZE_Ax   (SIZE_Bx + SIZE_A)
 
#define SIZE_B   8
 
#define SIZE_Bx   (SIZE_C + SIZE_B + 1)
 
#define SIZE_C   8
 
#define SIZE_OP   7
 
#define SIZE_sJ   (SIZE_Bx + SIZE_A)
 
#define testAMode(m)   (luaP_opmodes[m] & (1 << 3))
 
#define TESTARG_k(i)   check_exp(checkopm(i, iABC), (cast_int(((i) & (1u << POS_k)))))
 
#define testITMode(m)   (luaP_opmodes[m] & (1 << 5))
 
#define testMMMode(m)   (luaP_opmodes[m] & (1 << 7))
 
#define testOTMode(m)   (luaP_opmodes[m] & (1 << 6))
 
#define testTMode(m)   (luaP_opmodes[m] & (1 << 4))
 

Enumerations

enum  OpCode {
  OP_MOVE, OP_LOADI, OP_LOADF, OP_LOADK,
  OP_LOADKX, OP_LOADFALSE, OP_LFALSESKIP, OP_LOADTRUE,
  OP_LOADNIL, OP_GETUPVAL, OP_SETUPVAL, OP_GETTABUP,
  OP_GETTABLE, OP_GETI, OP_GETFIELD, OP_SETTABUP,
  OP_SETTABLE, OP_SETI, OP_SETFIELD, OP_NEWTABLE,
  OP_SELF, OP_ADDI, OP_ADDK, OP_SUBK,
  OP_MULK, OP_MODK, OP_POWK, OP_DIVK,
  OP_IDIVK, OP_BANDK, OP_BORK, OP_BXORK,
  OP_SHRI, OP_SHLI, 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_MMBIN, OP_MMBINI,
  OP_MMBINK, OP_UNM, OP_BNOT, OP_NOT,
  OP_LEN, OP_CONCAT, OP_CLOSE, OP_TBC,
  OP_JMP, OP_EQ, OP_LT, OP_LE,
  OP_EQK, OP_EQI, OP_LTI, OP_LEI,
  OP_GTI, OP_GEI, OP_TEST, OP_TESTSET,
  OP_CALL, OP_TAILCALL, OP_RETURN, OP_RETURN0,
  OP_RETURN1, OP_FORLOOP, OP_FORPREP, OP_TFORPREP,
  OP_TFORCALL, OP_TFORLOOP, OP_SETLIST, OP_CLOSURE,
  OP_VARARG, OP_VARARGPREP, OP_EXTRAARG
}
 
enum  OpMode {
  iABC, iABx, iAsBx, iAx,
  isJ
}
 

Macro Definition Documentation

◆ checkopm

#define checkopm (   i,
 
)    (getOpMode(GET_OPCODE(i)) == m)

Definition at line 118 of file lopcodes.h.

◆ CREATE_ABCk

#define CREATE_ABCk (   o,
  a,
  b,
  c,
 
)
Value:
| (cast(Instruction, a)<<POS_A) \
| (cast(Instruction, b)<<POS_B) \
| (cast(Instruction, c)<<POS_C) \

Definition at line 156 of file lopcodes.h.

◆ CREATE_ABx

#define CREATE_ABx (   o,
  a,
  bc 
)
Value:
| (cast(Instruction, a)<<POS_A) \
| (cast(Instruction, bc)<<POS_Bx))

Definition at line 162 of file lopcodes.h.

◆ CREATE_Ax

#define CREATE_Ax (   o,
 
)
Value:

Definition at line 166 of file lopcodes.h.

◆ CREATE_sJ

#define CREATE_sJ (   o,
  j,
 
)
Value:
((cast(Instruction, o) << POS_OP) \
| (cast(Instruction, j) << POS_sJ) \
| (cast(Instruction, k) << POS_k))

Definition at line 169 of file lopcodes.h.

◆ GET_OPCODE

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

Definition at line 114 of file lopcodes.h.

◆ getarg

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

Definition at line 121 of file lopcodes.h.

◆ GETARG_A

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

Definition at line 125 of file lopcodes.h.

◆ GETARG_Ax

#define GETARG_Ax (   i)    check_exp(checkopm(i, iAx), getarg(i, POS_Ax, SIZE_Ax))

Definition at line 143 of file lopcodes.h.

◆ GETARG_B

#define GETARG_B (   i)    check_exp(checkopm(i, iABC), getarg(i, POS_B, SIZE_B))

Definition at line 128 of file lopcodes.h.

◆ GETARG_Bx

#define GETARG_Bx (   i)    check_exp(checkopm(i, iABx), getarg(i, POS_Bx, SIZE_Bx))

Definition at line 140 of file lopcodes.h.

◆ GETARG_C

#define GETARG_C (   i)    check_exp(checkopm(i, iABC), getarg(i, POS_C, SIZE_C))

Definition at line 132 of file lopcodes.h.

◆ GETARG_k

#define GETARG_k (   i)    check_exp(checkopm(i, iABC), getarg(i, POS_k, 1))

Definition at line 137 of file lopcodes.h.

◆ GETARG_sB

#define GETARG_sB (   i)    sC2int(GETARG_B(i))

Definition at line 129 of file lopcodes.h.

◆ GETARG_sBx

#define GETARG_sBx (   i)    check_exp(checkopm(i, iAsBx), getarg(i, POS_Bx, SIZE_Bx) - OFFSET_sBx)

Definition at line 146 of file lopcodes.h.

◆ GETARG_sC

#define GETARG_sC (   i)    sC2int(GETARG_C(i))

Definition at line 133 of file lopcodes.h.

◆ GETARG_sJ

#define GETARG_sJ (   i)    check_exp(checkopm(i, isJ), getarg(i, POS_sJ, SIZE_sJ) - OFFSET_sJ)

Definition at line 150 of file lopcodes.h.

◆ getOpMode

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

Definition at line 370 of file lopcodes.h.

◆ int2sC

#define int2sC (   i)    ((i) + OFFSET_sC)

Definition at line 100 of file lopcodes.h.

◆ isIT

#define isIT (   i)    (testITMode(GET_OPCODE(i)) && GETARG_B(i) == 0)

Definition at line 383 of file lopcodes.h.

◆ isOT

#define isOT (   i)
Value:
((testOTMode(GET_OPCODE(i)) && GETARG_C(i) == 0) || \

Definition at line 378 of file lopcodes.h.

◆ L_INTHASBITS

#define L_INTHASBITS (   b)    ((UINT_MAX >> ((b) - 1)) >= 1)

Definition at line 68 of file lopcodes.h.

◆ LFIELDS_PER_FLUSH

#define LFIELDS_PER_FLUSH   50

Definition at line 390 of file lopcodes.h.

◆ MASK0

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

Definition at line 108 of file lopcodes.h.

◆ MASK1

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

Definition at line 105 of file lopcodes.h.

◆ MAXARG_A

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

Definition at line 95 of file lopcodes.h.

◆ MAXARG_Ax

#define MAXARG_Ax   MAX_INT

Definition at line 83 of file lopcodes.h.

◆ MAXARG_B

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

Definition at line 96 of file lopcodes.h.

◆ MAXARG_Bx

#define MAXARG_Bx   MAX_INT

Definition at line 74 of file lopcodes.h.

◆ MAXARG_C

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

Definition at line 97 of file lopcodes.h.

◆ MAXARG_sJ

#define MAXARG_sJ   MAX_INT

Definition at line 89 of file lopcodes.h.

◆ MAXINDEXRK

#define MAXINDEXRK   MAXARG_B

Definition at line 175 of file lopcodes.h.

◆ NO_REG

#define NO_REG   MAXARG_A

Definition at line 182 of file lopcodes.h.

◆ NUM_OPCODES

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

Definition at line 312 of file lopcodes.h.

◆ OFFSET_sBx

#define OFFSET_sBx   (MAXARG_Bx>>1) /* 'sBx' is signed */

Definition at line 77 of file lopcodes.h.

◆ OFFSET_sC

#define OFFSET_sC   (MAXARG_C >> 1)

Definition at line 98 of file lopcodes.h.

◆ OFFSET_sJ

#define OFFSET_sJ   (MAXARG_sJ >> 1)

Definition at line 92 of file lopcodes.h.

◆ opmode

#define opmode (   mm,
  ot,
  it,
  t,
  a,
 
)    (((mm) << 7) | ((ot) << 6) | ((it) << 5) | ((t) << 4) | ((a) << 3) | (m))

Definition at line 385 of file lopcodes.h.

◆ POS_A

#define POS_A   (POS_OP + SIZE_OP)

Definition at line 49 of file lopcodes.h.

◆ POS_Ax

#define POS_Ax   POS_A

Definition at line 56 of file lopcodes.h.

◆ POS_B

#define POS_B   (POS_k + 1)

Definition at line 51 of file lopcodes.h.

◆ POS_Bx

#define POS_Bx   POS_k

Definition at line 54 of file lopcodes.h.

◆ POS_C

#define POS_C   (POS_B + SIZE_B)

Definition at line 52 of file lopcodes.h.

◆ POS_k

#define POS_k   (POS_A + SIZE_A)

Definition at line 50 of file lopcodes.h.

◆ POS_OP

#define POS_OP   0

Definition at line 47 of file lopcodes.h.

◆ POS_sJ

#define POS_sJ   POS_A

Definition at line 58 of file lopcodes.h.

◆ sC2int

#define sC2int (   i)    ((i) - OFFSET_sC)

Definition at line 101 of file lopcodes.h.

◆ SET_OPCODE

#define SET_OPCODE (   i,
 
)
Value:
((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \

Definition at line 115 of file lopcodes.h.

◆ setarg

#define setarg (   i,
  v,
  pos,
  size 
)
Value:
((i) = (((i)&MASK0(size,pos)) | \
((cast(Instruction, v)<<pos)&MASK1(size,pos))))

Definition at line 122 of file lopcodes.h.

◆ SETARG_A

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

Definition at line 126 of file lopcodes.h.

◆ SETARG_Ax

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

Definition at line 144 of file lopcodes.h.

◆ SETARG_B

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

Definition at line 130 of file lopcodes.h.

◆ SETARG_Bx

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

Definition at line 141 of file lopcodes.h.

◆ SETARG_C

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

Definition at line 134 of file lopcodes.h.

◆ SETARG_k

#define SETARG_k (   i,
 
)    setarg(i, v, POS_k, 1)

Definition at line 138 of file lopcodes.h.

◆ SETARG_sBx

#define SETARG_sBx (   i,
 
)    SETARG_Bx((i),cast_uint((b)+OFFSET_sBx))

Definition at line 148 of file lopcodes.h.

◆ SETARG_sJ

#define SETARG_sJ (   i,
 
)    setarg(i, cast_uint((j)+OFFSET_sJ), POS_sJ, SIZE_sJ)

Definition at line 152 of file lopcodes.h.

◆ SIZE_A

#define SIZE_A   8

Definition at line 41 of file lopcodes.h.

◆ SIZE_Ax

#define SIZE_Ax   (SIZE_Bx + SIZE_A)

Definition at line 42 of file lopcodes.h.

◆ SIZE_B

#define SIZE_B   8

Definition at line 39 of file lopcodes.h.

◆ SIZE_Bx

#define SIZE_Bx   (SIZE_C + SIZE_B + 1)

Definition at line 40 of file lopcodes.h.

◆ SIZE_C

#define SIZE_C   8

Definition at line 38 of file lopcodes.h.

◆ SIZE_OP

#define SIZE_OP   7

Definition at line 45 of file lopcodes.h.

◆ SIZE_sJ

#define SIZE_sJ   (SIZE_Bx + SIZE_A)

Definition at line 43 of file lopcodes.h.

◆ testAMode

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

Definition at line 371 of file lopcodes.h.

◆ TESTARG_k

#define TESTARG_k (   i)    check_exp(checkopm(i, iABC), (cast_int(((i) & (1u << POS_k)))))

Definition at line 136 of file lopcodes.h.

◆ testITMode

#define testITMode (   m)    (luaP_opmodes[m] & (1 << 5))

Definition at line 373 of file lopcodes.h.

◆ testMMMode

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

Definition at line 375 of file lopcodes.h.

◆ testOTMode

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

Definition at line 374 of file lopcodes.h.

◆ testTMode

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

Definition at line 372 of file lopcodes.h.

Enumeration Type Documentation

◆ OpCode

enum OpCode
Enumerator
OP_MOVE 
OP_LOADI 
OP_LOADF 
OP_LOADK 
OP_LOADKX 
OP_LOADFALSE 
OP_LFALSESKIP 
OP_LOADTRUE 
OP_LOADNIL 
OP_GETUPVAL 
OP_SETUPVAL 
OP_GETTABUP 
OP_GETTABLE 
OP_GETI 
OP_GETFIELD 
OP_SETTABUP 
OP_SETTABLE 
OP_SETI 
OP_SETFIELD 
OP_NEWTABLE 
OP_SELF 
OP_ADDI 
OP_ADDK 
OP_SUBK 
OP_MULK 
OP_MODK 
OP_POWK 
OP_DIVK 
OP_IDIVK 
OP_BANDK 
OP_BORK 
OP_BXORK 
OP_SHRI 
OP_SHLI 
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_MMBIN 
OP_MMBINI 
OP_MMBINK 
OP_UNM 
OP_BNOT 
OP_NOT 
OP_LEN 
OP_CONCAT 
OP_CLOSE 
OP_TBC 
OP_JMP 
OP_EQ 
OP_LT 
OP_LE 
OP_EQK 
OP_EQI 
OP_LTI 
OP_LEI 
OP_GTI 
OP_GEI 
OP_TEST 
OP_TESTSET 
OP_CALL 
OP_TAILCALL 
OP_RETURN 
OP_RETURN0 
OP_RETURN1 
OP_FORLOOP 
OP_FORPREP 
OP_TFORPREP 
OP_TFORCALL 
OP_TFORLOOP 
OP_SETLIST 
OP_CLOSURE 
OP_VARARG 
OP_VARARGPREP 
OP_EXTRAARG 

Definition at line 196 of file lopcodes.h.

◆ OpMode

enum OpMode
Enumerator
iABC 
iABx 
iAsBx 
iAx 
isJ 

Definition at line 32 of file lopcodes.h.

MASK1
#define MASK1(n, p)
Definition: lopcodes.h:105
POS_k
#define POS_k
Definition: lopcodes.h:50
POS_B
#define POS_B
Definition: lopcodes.h:51
cast
#define cast(t, exp)
Definition: llimits.h:123
POS_A
#define POS_A
Definition: lopcodes.h:49
OP_TAILCALL
@ OP_TAILCALL
Definition: lopcodes.h:286
POS_sJ
#define POS_sJ
Definition: lopcodes.h:58
POS_OP
#define POS_OP
Definition: lopcodes.h:47
testOTMode
#define testOTMode(m)
Definition: lopcodes.h:374
POS_Ax
#define POS_Ax
Definition: lopcodes.h:56
nonstd::span_lite::size
span_constexpr std::size_t size(span< T, Extent > const &spn)
Definition: span.hpp:1554
POS_C
#define POS_C
Definition: lopcodes.h:52
SIZE_OP
#define SIZE_OP
Definition: lopcodes.h:45
MASK0
#define MASK0(n, p)
Definition: lopcodes.h:108
POS_Bx
#define POS_Bx
Definition: lopcodes.h:54
Instruction
l_uint32 Instruction
Definition: llimits.h:178
GET_OPCODE
#define GET_OPCODE(i)
Definition: lopcodes.h:114
GETARG_C
#define GETARG_C(i)
Definition: lopcodes.h:132


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:49