Expand file tree
/
Copy pathlcode.h
More file actions
Latest commit
104 lines (84 loc) · 3.71 KB
/
Copy pathlcode.h
File metadata and controls
104 lines (84 loc) · 3.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
** $Id: lcode.h $
** Code generator for Lua
** See Copyright Notice in lua.h
*/
#ifndeflcode_h
#definelcode_h
#include"llex.h"
#include"lobject.h"
#include"lopcodes.h"
#include"lparser.h"
/*
** Marks the end of a patch list. It is an invalid value both as an absolute
** address, and as a list link (would link an element to itself).
*/
#defineNO_JUMP (-1)
/*
** grep "ORDER OPR" if you change these enums (ORDER OP)
*/
typedefenumBinOpr {
/* arithmetic operators */
OPR_ADD, OPR_SUB, OPR_MUL, OPR_MOD, OPR_POW,
OPR_DIV, OPR_IDIV,
/* bitwise operators */
OPR_BAND, OPR_BOR, OPR_BXOR,
OPR_SHL, OPR_SHR,
/* string operator */
OPR_CONCAT,
/* comparison operators */
OPR_EQ, OPR_LT, OPR_LE,
OPR_NE, OPR_GT, OPR_GE,
/* logical operators */
OPR_AND, OPR_OR,
OPR_NOBINOPR
} BinOpr;
/* true if operation is foldable (that is, it is arithmetic or bitwise) */
#definefoldbinop(op) ((op) <= OPR_SHR)
#defineluaK_codeABC(fs,o,a,b,c) luaK_codeABCk(fs,o,a,b,c,0)
typedefenumUnOpr { OPR_MINUS, OPR_BNOT, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr;
/* get (pointer to) instruction of given 'expdesc' */
#definegetinstruction(fs,e) ((fs)->f->code[(e)->u.info])
#defineluaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET)
#defineluaK_jumpto(fs,t) luaK_patchlist(fs, luaK_jump(fs), t)
LUAI_FUNCintluaK_code (FuncState*fs, Instructioni);
LUAI_FUNCintluaK_codeABx (FuncState*fs, OpCodeo, intA, unsigned intBx);
LUAI_FUNCintluaK_codeAsBx (FuncState*fs, OpCodeo, intA, intBx);
LUAI_FUNCintluaK_codeABCk (FuncState*fs, OpCodeo, intA,
intB, intC, intk);
LUAI_FUNCintluaK_isKint (expdesc*e);
LUAI_FUNCintluaK_exp2const (FuncState*fs, constexpdesc*e, TValue*v);
LUAI_FUNCvoidluaK_fixline (FuncState*fs, intline);
LUAI_FUNCvoidluaK_nil (FuncState*fs, intfrom, intn);
LUAI_FUNCvoidluaK_reserveregs (FuncState*fs, intn);
LUAI_FUNCvoidluaK_checkstack (FuncState*fs, intn);
LUAI_FUNCvoidluaK_int (FuncState*fs, intreg, lua_Integern);
LUAI_FUNCvoidluaK_dischargevars (FuncState*fs, expdesc*e);
LUAI_FUNCintluaK_exp2anyreg (FuncState*fs, expdesc*e);
LUAI_FUNCvoidluaK_exp2anyregup (FuncState*fs, expdesc*e);
LUAI_FUNCvoidluaK_exp2nextreg (FuncState*fs, expdesc*e);
LUAI_FUNCvoidluaK_exp2val (FuncState*fs, expdesc*e);
LUAI_FUNCintluaK_exp2RK (FuncState*fs, expdesc*e);
LUAI_FUNCvoidluaK_self (FuncState*fs, expdesc*e, expdesc*key);
LUAI_FUNCvoidluaK_indexed (FuncState*fs, expdesc*t, expdesc*k);
LUAI_FUNCvoidluaK_goiftrue (FuncState*fs, expdesc*e);
LUAI_FUNCvoidluaK_goiffalse (FuncState*fs, expdesc*e);
LUAI_FUNCvoidluaK_storevar (FuncState*fs, expdesc*var, expdesc*e);
LUAI_FUNCvoidluaK_setreturns (FuncState*fs, expdesc*e, intnresults);
LUAI_FUNCvoidluaK_setoneret (FuncState*fs, expdesc*e);
LUAI_FUNCintluaK_jump (FuncState*fs);
LUAI_FUNCvoidluaK_ret (FuncState*fs, intfirst, intnret);
LUAI_FUNCvoidluaK_patchlist (FuncState*fs, intlist, inttarget);
LUAI_FUNCvoidluaK_patchtohere (FuncState*fs, intlist);
LUAI_FUNCvoidluaK_concat (FuncState*fs, int*l1, intl2);
LUAI_FUNCintluaK_getlabel (FuncState*fs);
LUAI_FUNCvoidluaK_prefix (FuncState*fs, UnOprop, expdesc*v, intline);
LUAI_FUNCvoidluaK_infix (FuncState*fs, BinOprop, expdesc*v);
LUAI_FUNCvoidluaK_posfix (FuncState*fs, BinOprop, expdesc*v1,
expdesc*v2, intline);
LUAI_FUNCvoidluaK_settablesize (FuncState*fs, intpc,
intra, intasize, inthsize);
LUAI_FUNCvoidluaK_setlist (FuncState*fs, intbase, intnelems, inttostore);
LUAI_FUNCvoidluaK_finish (FuncState*fs);
LUAI_FUNCl_noretluaK_semerror (LexState*ls, constchar*msg);
#endif