From 2a4afb97c8a3f64dccad86fa848855616ea2c254 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 28 Jun 2001 16:58:57 -0300 Subject: new module lopcodes.c for tables describing opcodes --- lopcodes.h | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'lopcodes.h') diff --git a/lopcodes.h b/lopcodes.h index 45674257..b0881213 100644 --- a/lopcodes.h +++ b/lopcodes.h @@ -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 -- cgit v1.2.3-55-g6feb