new module lopcodes.c for tables describing opcodes

This commit is contained in:
Roberto Ierusalimschy
2001-06-28 16:58:57 -03:00
parent 87a5fae453
commit 2a4afb97c8
5 changed files with 35 additions and 117 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lopcodes.h,v 1.74 2001/06/08 19:00:57 roberto Exp roberto $
** $Id: lopcodes.h,v 1.75 2001/06/11 14:56:42 roberto Exp roberto $
** Opcodes for Lua virtual machine
** See Copyright Notice in lua.h
*/
@@ -28,6 +28,9 @@
===========================================================================*/
enum OpMode {iABC, iABc, iAsBc}; /* basic instruction format */
/*
** size and position of opcode arguments.
*/
@@ -198,4 +201,28 @@ OP_CLOSURE /* A Bc R(A) := closure(KPROTO[Bc], R(A), ... ,R(A+n)) */
===========================================================================*/
/*
** masks for instruction properties
*/
enum OpModeMask {
OpModeBreg = 2, /* B is a register */
OpModeCreg, /* C is a register/constant */
OpModesetA, /* instruction set register A */
OpModeK, /* Bc is a constant */
OpModeT /* operator is a test */
};
extern const lu_byte luaP_opmodes[];
#define getOpMode(m) ((enum OpMode)(luaP_opmodes[m] & 3))
#define testOpMode(m, b) (luaP_opmodes[m] & (1 << (b)))
/*
** opcode names (only included when compiled with LUA_OPNAMES)
*/
extern const l_char *const luaP_opnames[];
#endif