2023-01-14 04:36:28 +08:00
|
|
|
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
|
|
#pragma once
|
|
|
|
|
2023-02-03 20:34:12 +08:00
|
|
|
#include "Luau/IrData.h"
|
2023-01-14 04:36:28 +08:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace Luau
|
|
|
|
{
|
|
|
|
namespace CodeGen
|
|
|
|
{
|
|
|
|
|
2023-03-11 03:20:04 +08:00
|
|
|
struct CfgInfo;
|
|
|
|
|
2023-01-14 04:36:28 +08:00
|
|
|
const char* getCmdName(IrCmd cmd);
|
|
|
|
const char* getBlockKindName(IrBlockKind kind);
|
|
|
|
|
|
|
|
struct IrToStringContext
|
|
|
|
{
|
|
|
|
std::string& result;
|
2023-03-25 01:34:14 +08:00
|
|
|
const std::vector<IrBlock>& blocks;
|
|
|
|
const std::vector<IrConst>& constants;
|
|
|
|
const CfgInfo& cfg;
|
2023-01-14 04:36:28 +08:00
|
|
|
};
|
|
|
|
|
2023-02-11 02:50:54 +08:00
|
|
|
void toString(IrToStringContext& ctx, const IrInst& inst, uint32_t index);
|
|
|
|
void toString(IrToStringContext& ctx, const IrBlock& block, uint32_t index); // Block title
|
2023-01-14 04:36:28 +08:00
|
|
|
void toString(IrToStringContext& ctx, IrOp op);
|
|
|
|
|
|
|
|
void toString(std::string& result, IrConst constant);
|
2023-12-02 10:04:44 +08:00
|
|
|
void toString(std::string& result, const BytecodeTypes& bcTypes);
|
2023-01-14 04:36:28 +08:00
|
|
|
|
2023-05-06 03:57:12 +08:00
|
|
|
void toStringDetailed(IrToStringContext& ctx, const IrBlock& block, uint32_t blockIdx, const IrInst& inst, uint32_t instIdx, bool includeUseInfo);
|
2024-01-19 23:13:08 +08:00
|
|
|
void toStringDetailed(
|
|
|
|
IrToStringContext& ctx, const IrBlock& block, uint32_t blockIdx, bool includeUseInfo, bool includeCfgInfo, bool includeRegFlowInfo);
|
2023-02-11 02:50:54 +08:00
|
|
|
|
2023-03-25 01:34:14 +08:00
|
|
|
std::string toString(const IrFunction& function, bool includeUseInfo);
|
2023-01-14 04:36:28 +08:00
|
|
|
|
2023-03-25 01:34:14 +08:00
|
|
|
std::string dump(const IrFunction& function);
|
2023-01-20 20:02:39 +08:00
|
|
|
|
2023-03-25 01:34:14 +08:00
|
|
|
std::string toDot(const IrFunction& function, bool includeInst);
|
2023-06-17 01:01:18 +08:00
|
|
|
std::string toDotCfg(const IrFunction& function);
|
|
|
|
std::string toDotDjGraph(const IrFunction& function);
|
2023-03-17 22:59:30 +08:00
|
|
|
|
2023-03-25 01:34:14 +08:00
|
|
|
std::string dumpDot(const IrFunction& function, bool includeInst);
|
2023-03-17 22:59:30 +08:00
|
|
|
|
2023-01-14 04:36:28 +08:00
|
|
|
} // namespace CodeGen
|
|
|
|
} // namespace Luau
|