2023-01-27 21:28:45 +00:00
|
|
|
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Luau/AssemblyBuilderX64.h"
|
2023-02-03 12:34:12 +00:00
|
|
|
#include "Luau/IrData.h"
|
2023-03-31 13:21:14 +01:00
|
|
|
#include "Luau/IrRegAllocX64.h"
|
2023-02-24 18:24:22 +00:00
|
|
|
|
2023-04-21 22:41:03 +01:00
|
|
|
#include "IrValueLocationTracking.h"
|
|
|
|
|
2023-01-27 21:28:45 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
struct Proto;
|
|
|
|
|
|
|
|
namespace Luau
|
|
|
|
{
|
|
|
|
namespace CodeGen
|
|
|
|
{
|
|
|
|
|
|
|
|
struct ModuleHelpers;
|
|
|
|
struct NativeState;
|
|
|
|
struct AssemblyOptions;
|
|
|
|
|
2023-03-03 13:45:38 +00:00
|
|
|
namespace X64
|
|
|
|
{
|
|
|
|
|
2023-01-27 21:28:45 +00:00
|
|
|
struct IrLoweringX64
|
|
|
|
{
|
2023-03-24 17:34:14 +00:00
|
|
|
IrLoweringX64(AssemblyBuilderX64& build, ModuleHelpers& helpers, NativeState& data, IrFunction& function);
|
2023-01-27 21:28:45 +00:00
|
|
|
|
|
|
|
void lowerInst(IrInst& inst, uint32_t index, IrBlock& next);
|
2023-04-21 22:41:03 +01:00
|
|
|
void finishBlock();
|
2023-01-27 21:28:45 +00:00
|
|
|
|
2023-04-07 20:56:27 +01:00
|
|
|
bool hasError() const;
|
|
|
|
|
2023-01-27 21:28:45 +00:00
|
|
|
bool isFallthroughBlock(IrBlock target, IrBlock next);
|
|
|
|
void jumpOrFallthrough(IrBlock& target, IrBlock& next);
|
|
|
|
|
2023-04-07 20:56:27 +01:00
|
|
|
void storeDoubleAsFloat(OperandX64 dst, IrOp src);
|
|
|
|
|
2023-01-27 21:28:45 +00:00
|
|
|
// Operand data lookup helpers
|
2023-04-07 20:56:27 +01:00
|
|
|
OperandX64 memRegDoubleOp(IrOp op);
|
2023-04-21 22:41:03 +01:00
|
|
|
OperandX64 memRegUintOp(IrOp op);
|
2023-04-07 20:56:27 +01:00
|
|
|
OperandX64 memRegTagOp(IrOp op);
|
|
|
|
RegisterX64 regOp(IrOp op);
|
2023-01-27 21:28:45 +00:00
|
|
|
|
|
|
|
IrConst constOp(IrOp op) const;
|
|
|
|
uint8_t tagOp(IrOp op) const;
|
|
|
|
bool boolOp(IrOp op) const;
|
|
|
|
int intOp(IrOp op) const;
|
|
|
|
unsigned uintOp(IrOp op) const;
|
|
|
|
double doubleOp(IrOp op) const;
|
|
|
|
|
|
|
|
IrBlock& blockOp(IrOp op) const;
|
|
|
|
Label& labelOp(IrOp op) const;
|
|
|
|
|
|
|
|
AssemblyBuilderX64& build;
|
|
|
|
ModuleHelpers& helpers;
|
|
|
|
NativeState& data;
|
|
|
|
|
|
|
|
IrFunction& function;
|
|
|
|
|
2023-02-24 18:24:22 +00:00
|
|
|
IrRegAllocX64 regs;
|
2023-04-21 22:41:03 +01:00
|
|
|
|
|
|
|
IrValueLocationTracking valueTracker;
|
2023-01-27 21:28:45 +00:00
|
|
|
};
|
|
|
|
|
2023-03-03 13:45:38 +00:00
|
|
|
} // namespace X64
|
2023-01-27 21:28:45 +00:00
|
|
|
} // namespace CodeGen
|
|
|
|
} // namespace Luau
|