diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-05-14 09:09:12 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-05-14 09:09:12 -0300 |
| commit | c116dcb92b2ee36ef5c4541a88e73540837f1057 (patch) | |
| tree | 1fbe7cdf10cc6d390b6f716c81aa40e11ee60375 /lopcodes.h | |
| parent | 6d268b0b00ae63e5d06aedc4fb3cec105123a565 (diff) | |
| download | lua-c116dcb92b2ee36ef5c4541a88e73540837f1057.tar.gz lua-c116dcb92b2ee36ef5c4541a88e73540837f1057.tar.bz2 lua-c116dcb92b2ee36ef5c4541a88e73540837f1057.zip | |
better information about instruction behavior (use of arguments)
Diffstat (limited to 'lopcodes.h')
| -rw-r--r-- | lopcodes.h | 30 |
1 files changed, 18 insertions, 12 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lopcodes.h,v 1.102 2002/08/21 18:56:09 roberto Exp roberto $ | 2 | ** $Id: lopcodes.h,v 1.103 2003/05/13 20:15:59 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 | */ |
| @@ -206,22 +206,28 @@ OP_CLOSURE/* A Bx R(A) := closure(KPROTO[Bx], R(A), ... ,R(A+n)) */ | |||
| 206 | 206 | ||
| 207 | 207 | ||
| 208 | /* | 208 | /* |
| 209 | ** masks for instruction properties | 209 | ** masks for instruction properties. The format is: |
| 210 | ** bits 0-1: op mode | ||
| 211 | ** bits 2-3: C arg mode | ||
| 212 | ** bits 4-5: B arg mode | ||
| 213 | ** bit 6: instruction set register A | ||
| 214 | ** bit 7: operator is a test | ||
| 210 | */ | 215 | */ |
| 211 | enum OpModeMask { | ||
| 212 | OpModeBreg = 2, /* B is a register */ | ||
| 213 | OpModeBrk, /* B is a register/constant */ | ||
| 214 | OpModeCrk, /* C is a register/constant */ | ||
| 215 | OpModesetA, /* instruction set register A */ | ||
| 216 | OpModeK, /* Bx is a constant */ | ||
| 217 | OpModeT /* operator is a test */ | ||
| 218 | }; | ||
| 219 | 216 | ||
| 217 | enum OpArgMask { | ||
| 218 | OpArgN, /* argument is not used */ | ||
| 219 | OpArgU, /* argument is used */ | ||
| 220 | OpArgR, /* argument is a register or a jump offset */ | ||
| 221 | OpArgK /* argument is a constant or register/constant */ | ||
| 222 | }; | ||
| 220 | 223 | ||
| 221 | extern const lu_byte luaP_opmodes[NUM_OPCODES]; | 224 | extern const lu_byte luaP_opmodes[NUM_OPCODES]; |
| 222 | 225 | ||
| 223 | #define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3)) | 226 | #define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3)) |
| 224 | #define testOpMode(m, b) (luaP_opmodes[m] & (1 << (b))) | 227 | #define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3)) |
| 228 | #define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3)) | ||
| 229 | #define testAMode(m) (luaP_opmodes[m] & (1 << 6)) | ||
| 230 | #define testTMode(m) (luaP_opmodes[m] & (1 << 7)) | ||
| 225 | 231 | ||
| 226 | 232 | ||
| 227 | #ifdef LUA_OPNAMES | 233 | #ifdef LUA_OPNAMES |
