Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Roblox
GitHub Repository: Roblox/luau
Path: blob/master/CodeGen/src/IrValueLocationTracking.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 "Luau/IrData.h"
5
6
#include <array>
7
8
namespace Luau
9
{
10
namespace CodeGen
11
{
12
13
struct IrValueLocationTracking
14
{
15
IrValueLocationTracking(IrFunction& function);
16
17
void setRestoreCallback(void* context, void (*callback)(void* context, IrInst& inst));
18
19
bool canBeRematerialized(IrCmd cmd);
20
bool canRematerializeArguments(IrInst& inst);
21
22
void beforeInstLowering(IrInst& inst);
23
void afterInstLowering(IrInst& inst, uint32_t instIdx);
24
25
void recordRestoreOp(uint32_t instIdx, IrOp location);
26
void invalidateRestoreOp(IrOp location, bool skipValueInvalidation);
27
void invalidateRestoreVmRegs(int start, int count);
28
29
IrFunction& function;
30
31
std::array<uint32_t, 256> vmRegValue;
32
33
// For range/full invalidations, we only want to visit a limited number of data that we have recorded
34
int maxReg = 0;
35
36
void* restoreCallbackCtx = nullptr;
37
void (*restoreCallback)(void* context, IrInst& inst) = nullptr;
38
};
39
40
} // namespace CodeGen
41
} // namespace Luau
42
43