luau/CodeGen/include/Luau/IrDump.h

70 lines
1.8 KiB
C
Raw Normal View History

2023-01-13 12: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 14:34:12 +02:00
#include "Luau/IrData.h"
2024-01-26 18:30:40 -08:00
#include "Luau/CodeGen.h"
2023-01-13 12:36:28 -08:00
#include <string>
#include <vector>
2025-01-10 09:13:13 -08:00
struct Proto;
2023-01-13 12:36:28 -08:00
namespace Luau
{
namespace CodeGen
{
2023-03-10 11:20:04 -08:00
struct CfgInfo;
2023-01-13 12:36:28 -08:00
const char* getCmdName(IrCmd cmd);
const char* getBlockKindName(IrBlockKind kind);
struct IrToStringContext
{
std::string& result;
2023-03-24 10:34:14 -07:00
const std::vector<IrBlock>& blocks;
const std::vector<IrConst>& constants;
const CfgInfo& cfg;
2025-01-10 09:13:13 -08:00
Proto* proto = nullptr;
2023-01-13 12:36:28 -08:00
};
2023-02-10 10: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-13 12:36:28 -08:00
void toString(IrToStringContext& ctx, IrOp op);
void toString(std::string& result, IrConst constant);
2024-04-25 13:57:23 -07:00
2024-05-31 10:46:33 -07:00
const char* getBytecodeTypeName(uint8_t type, const char* const* userdataTypes);
2024-04-25 13:57:23 -07:00
2024-05-31 10:46:33 -07:00
void toString(std::string& result, const BytecodeTypes& bcTypes, const char* const* userdataTypes);
2023-01-13 12:36:28 -08:00
2024-01-19 17:13:08 +02:00
void toStringDetailed(
2024-08-01 16:25:12 -07:00
IrToStringContext& ctx,
const IrBlock& block,
uint32_t blockIdx,
const IrInst& inst,
uint32_t instIdx,
IncludeUseInfo includeUseInfo
);
void toStringDetailed(
IrToStringContext& ctx,
const IrBlock& block,
uint32_t blockIdx,
IncludeUseInfo includeUseInfo,
IncludeCfgInfo includeCfgInfo,
IncludeRegFlowInfo includeRegFlowInfo
);
2023-02-10 10:50:54 -08:00
2024-01-26 18:30:40 -08:00
std::string toString(const IrFunction& function, IncludeUseInfo includeUseInfo);
2023-01-13 12:36:28 -08:00
2023-03-24 10:34:14 -07:00
std::string dump(const IrFunction& function);
2023-01-20 14:02:39 +02:00
2023-03-24 10:34:14 -07:00
std::string toDot(const IrFunction& function, bool includeInst);
2023-06-16 10:01:18 -07:00
std::string toDotCfg(const IrFunction& function);
std::string toDotDjGraph(const IrFunction& function);
2023-03-17 16:59:30 +02:00
2023-03-24 10:34:14 -07:00
std::string dumpDot(const IrFunction& function, bool includeInst);
2023-03-17 16:59:30 +02:00
2023-01-13 12:36:28 -08:00
} // namespace CodeGen
} // namespace Luau