diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-03-03 15:53:17 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-03-03 15:53:17 -0300 |
commit | d1ea38580ae35a3a34e7122c41682af7f9901030 (patch) | |
tree | ce7fa1568be9eb757805966b77ea1eac2bc604f6 /lcode.h | |
parent | 3c9d999424520c809e05bee11d81788b488434f6 (diff) | |
download | lua-d1ea38580ae35a3a34e7122c41682af7f9901030.tar.gz lua-d1ea38580ae35a3a34e7122c41682af7f9901030.tar.bz2 lua-d1ea38580ae35a3a34e7122c41682af7f9901030.zip |
change of code generation design (independent functions for each opcode)
Diffstat (limited to '')
-rw-r--r-- | lcode.h | 25 |
1 files changed, 14 insertions, 11 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lcode.h,v 1.1 2000/02/22 13:31:19 roberto Exp roberto $ | 2 | ** $Id: lcode.h,v 1.2 2000/03/03 12:33:59 roberto Exp roberto $ |
3 | ** Code generator for Lua | 3 | ** Code generator for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -13,20 +13,23 @@ | |||
13 | #include "lparser.h" | 13 | #include "lparser.h" |
14 | 14 | ||
15 | 15 | ||
16 | #define luaK_0(ls,o,d) luaK_code(ls, CREATE_0(o), d) | ||
17 | #define luaK_U(ls,o,u,d) luaK_code(ls, CREATE_U(o,u), d) | ||
18 | #define luaK_S(ls,o,s,d) luaK_code(ls, CREATE_S(o,s), d) | ||
19 | #define luaK_AB(ls,o,a,b,d) luaK_code(ls, CREATE_AB(o,a,b), d) | ||
20 | |||
21 | |||
16 | void luaK_error (LexState *ls, const char *msg); | 22 | void luaK_error (LexState *ls, const char *msg); |
17 | int luaK_primitivecode (LexState *ls, Instruction i); | 23 | int luaK_primitivecode (LexState *ls, Instruction i); |
18 | int luaK_code (LexState *ls, Instruction i); | 24 | int luaK_code (LexState *ls, Instruction i, int delta); |
25 | void luaK_retcode (LexState *ls, int nlocals, listdesc *e); | ||
19 | void luaK_fixjump (LexState *ls, int pc, int dest); | 26 | void luaK_fixjump (LexState *ls, int pc, int dest); |
20 | void luaK_deltastack (LexState *ls, int delta); | 27 | void luaK_deltastack (LexState *ls, int delta); |
21 | int luaK_0 (LexState *ls, OpCode op, int delta); | 28 | void luaK_kstr (LexState *ls, int c); |
22 | int luaK_U (LexState *ls, OpCode op, int u, int delta); | 29 | void luaK_number (LexState *ls, real f); |
23 | int luaK_S (LexState *ls, OpCode op, int s, int delta); | 30 | void luaK_adjuststack (LexState *ls, int n); |
24 | int luaK_AB (LexState *ls, OpCode op, int a, int b, int delta); | 31 | int luaK_iscall (LexState *ls, int hasjumps); |
25 | int luaK_kstr (LexState *ls, int c); | 32 | void luaK_setcallreturns (LexState *ls, int hasjumps, int nresults); |
26 | int luaK_number (LexState *ls, real f); | ||
27 | int luaK_adjuststack (LexState *ls, int n); | ||
28 | int luaK_iscall (LexState *ls, int pc); | ||
29 | void luaK_setcallreturns (LexState *ls, int pc, int nresults); | ||
30 | void luaK_2stack (LexState *ls, expdesc *var); | 33 | void luaK_2stack (LexState *ls, expdesc *var); |
31 | void luaK_storevar (LexState *ls, const expdesc *var); | 34 | void luaK_storevar (LexState *ls, const expdesc *var); |
32 | void luaK_prefix (LexState *ls, int op, expdesc *v); | 35 | void luaK_prefix (LexState *ls, int op, expdesc *v); |