Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Roblox
GitHub Repository: Roblox/luau
Path: blob/master/CodeGen/src/IrTranslation.h
2725 views
1
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
2
#pragma once
3
4
#include <stdint.h>
5
6
#include "ltm.h"
7
8
typedef uint32_t Instruction;
9
10
namespace Luau
11
{
12
namespace CodeGen
13
{
14
15
enum class IrCondition : uint8_t;
16
struct IrOp;
17
struct IrBuilder;
18
enum class IrCmd : uint8_t;
19
20
void translateInstLoadNil(IrBuilder& build, const Instruction* pc);
21
void translateInstLoadB(IrBuilder& build, const Instruction* pc, int pcpos);
22
void translateInstLoadN(IrBuilder& build, const Instruction* pc);
23
void translateInstLoadK(IrBuilder& build, const Instruction* pc);
24
void translateInstLoadKX(IrBuilder& build, const Instruction* pc);
25
void translateInstMove(IrBuilder& build, const Instruction* pc);
26
void translateInstJump(IrBuilder& build, const Instruction* pc, int pcpos);
27
void translateInstJumpBack(IrBuilder& build, const Instruction* pc, int pcpos);
28
void translateInstJumpIf(IrBuilder& build, const Instruction* pc, int pcpos, bool not_);
29
void translateInstJumpIfEq(IrBuilder& build, const Instruction* pc, int pcpos, bool not_);
30
void translateInstJumpIfEqShortcut(IrBuilder& build, const Instruction* pc, int pcpos, bool not_);
31
void translateInstJumpIfCond(IrBuilder& build, const Instruction* pc, int pcpos, IrCondition cond);
32
void translateInstJumpX(IrBuilder& build, const Instruction* pc, int pcpos);
33
void translateInstJumpxEqNil(IrBuilder& build, const Instruction* pc, int pcpos);
34
void translateInstJumpxEqNilShortcut(IrBuilder& build, const Instruction* pc, int pcpos);
35
void translateInstJumpxEqB(IrBuilder& build, const Instruction* pc, int pcpos);
36
void translateInstJumpxEqBShortcut(IrBuilder& build, const Instruction* pc, int pcpos);
37
void translateInstJumpxEqN(IrBuilder& build, const Instruction* pc, int pcpos);
38
void translateInstJumpxEqNShortcut(IrBuilder& build, const Instruction* pc, int pcpos);
39
void translateInstJumpxEqS(IrBuilder& build, const Instruction* pc, int pcpos);
40
void translateInstJumpxEqSShortcut(IrBuilder& build, const Instruction* pc, int pcpos);
41
void translateInstBinary(IrBuilder& build, const Instruction* pc, int pcpos, TMS tm);
42
void translateInstBinaryK(IrBuilder& build, const Instruction* pc, int pcpos, TMS tm);
43
void translateInstBinaryRK(IrBuilder& build, const Instruction* pc, int pcpos, TMS tm);
44
void translateInstNot(IrBuilder& build, const Instruction* pc);
45
void translateInstMinus(IrBuilder& build, const Instruction* pc, int pcpos);
46
void translateInstLength(IrBuilder& build, const Instruction* pc, int pcpos);
47
void translateInstNewTable(IrBuilder& build, const Instruction* pc, int pcpos);
48
void translateInstDupTable(IrBuilder& build, const Instruction* pc, int pcpos);
49
void translateInstGetUpval(IrBuilder& build, const Instruction* pc, int pcpos);
50
void translateInstSetUpval(IrBuilder& build, const Instruction* pc, int pcpos);
51
void translateInstCloseUpvals(IrBuilder& build, const Instruction* pc);
52
IrOp translateFastCallN(
53
IrBuilder& build,
54
const Instruction* pc,
55
int pcpos,
56
bool customParams,
57
int customParamCount,
58
IrOp customArgs,
59
IrOp customArg3
60
);
61
void translateInstForNPrep(IrBuilder& build, const Instruction* pc, int pcpos);
62
void translateInstForNLoop(IrBuilder& build, const Instruction* pc, int pcpos);
63
void translateInstForGPrepNext(IrBuilder& build, const Instruction* pc, int pcpos);
64
void translateInstForGPrepInext(IrBuilder& build, const Instruction* pc, int pcpos);
65
void translateInstForGLoopIpairs(IrBuilder& build, const Instruction* pc, int pcpos);
66
void translateInstGetTableN(IrBuilder& build, const Instruction* pc, int pcpos);
67
void translateInstSetTableN(IrBuilder& build, const Instruction* pc, int pcpos);
68
void translateInstGetTable(IrBuilder& build, const Instruction* pc, int pcpos);
69
void translateInstSetTable(IrBuilder& build, const Instruction* pc, int pcpos);
70
void translateInstGetImport(IrBuilder& build, const Instruction* pc, int pcpos);
71
void translateInstGetTableKS(IrBuilder& build, const Instruction* pc, int pcpos);
72
void translateInstSetTableKS(IrBuilder& build, const Instruction* pc, int pcpos);
73
void translateInstGetGlobal(IrBuilder& build, const Instruction* pc, int pcpos);
74
void translateInstSetGlobal(IrBuilder& build, const Instruction* pc, int pcpos);
75
void translateInstConcat(IrBuilder& build, const Instruction* pc, int pcpos);
76
void translateInstCapture(IrBuilder& build, const Instruction* pc, int pcpos);
77
bool translateInstNamecall(IrBuilder& build, const Instruction* pc, int pcpos);
78
void translateInstAndX(IrBuilder& build, const Instruction* pc, int pcpos, IrOp c);
79
void translateInstOrX(IrBuilder& build, const Instruction* pc, int pcpos, IrOp c);
80
void translateInstNewClosure(IrBuilder& build, const Instruction* pc, int pcpos);
81
82
void beforeInstForNPrep(IrBuilder& build, const Instruction* pc, int pcpos);
83
void afterInstForNLoop(IrBuilder& build, const Instruction* pc);
84
85
} // namespace CodeGen
86
} // namespace Luau
87
88