diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-06-28 16:58:57 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-06-28 16:58:57 -0300 |
commit | 2a4afb97c8a3f64dccad86fa848855616ea2c254 (patch) | |
tree | e343fd15c387e6975b7a680130ee09735666ea2d /lopcodes.h | |
parent | 87a5fae45322dde56306de92d8eb8050506fb9ba (diff) | |
download | lua-2a4afb97c8a3f64dccad86fa848855616ea2c254.tar.gz lua-2a4afb97c8a3f64dccad86fa848855616ea2c254.tar.bz2 lua-2a4afb97c8a3f64dccad86fa848855616ea2c254.zip |
new module lopcodes.c for tables describing opcodes
Diffstat (limited to 'lopcodes.h')
-rw-r--r-- | lopcodes.h | 29 |
1 files changed, 28 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lopcodes.h,v 1.74 2001/06/08 19:00:57 roberto Exp roberto $ | 2 | ** $Id: lopcodes.h,v 1.75 2001/06/11 14:56:42 roberto Exp roberto $ |
3 | ** Opcodes for Lua virtual machine | 3 | ** Opcodes for Lua virtual machine |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -28,6 +28,9 @@ | |||
28 | ===========================================================================*/ | 28 | ===========================================================================*/ |
29 | 29 | ||
30 | 30 | ||
31 | enum OpMode {iABC, iABc, iAsBc}; /* basic instruction format */ | ||
32 | |||
33 | |||
31 | /* | 34 | /* |
32 | ** size and position of opcode arguments. | 35 | ** size and position of opcode arguments. |
33 | */ | 36 | */ |
@@ -198,4 +201,28 @@ OP_CLOSURE /* A Bc R(A) := closure(KPROTO[Bc], R(A), ... ,R(A+n)) */ | |||
198 | ===========================================================================*/ | 201 | ===========================================================================*/ |
199 | 202 | ||
200 | 203 | ||
204 | |||
205 | /* | ||
206 | ** masks for instruction properties | ||
207 | */ | ||
208 | enum OpModeMask { | ||
209 | OpModeBreg = 2, /* B is a register */ | ||
210 | OpModeCreg, /* C is a register/constant */ | ||
211 | OpModesetA, /* instruction set register A */ | ||
212 | OpModeK, /* Bc is a constant */ | ||
213 | OpModeT /* operator is a test */ | ||
214 | }; | ||
215 | |||
216 | extern const lu_byte luaP_opmodes[]; | ||
217 | |||
218 | #define getOpMode(m) ((enum OpMode)(luaP_opmodes[m] & 3)) | ||
219 | #define testOpMode(m, b) (luaP_opmodes[m] & (1 << (b))) | ||
220 | |||
221 | |||
222 | /* | ||
223 | ** opcode names (only included when compiled with LUA_OPNAMES) | ||
224 | */ | ||
225 | extern const l_char *const luaP_opnames[]; | ||
226 | |||
227 | |||
201 | #endif | 228 | #endif |