![]() |
Phasor 3.1.1
Stack VM based Programming Language
|
Phasor IR Serializer/Deserializer. More...
#include <PhasorIR.hpp>
Static Public Member Functions | |
| static std::vector< uint8_t > | serialize (const Bytecode &bytecode) |
| Serialize bytecode to Phasor IR format. | |
| static Bytecode | deserialize (const std::vector< uint8_t > &data) |
| Deserialize Phasor IR format to bytecode. | |
| static bool | saveToFile (const Bytecode &bytecode, const std::filesystem::path &filename) |
| Save bytecode to .phir file. | |
| static Bytecode | loadFromFile (const std::filesystem::path &filename) |
| Load bytecode from .phir file. | |
| static std::string | escapeString (const std::string &str) |
| Helper to escape strings for text format. | |
| static std::string | unescapeString (const std::string &str) |
| Helper to unescape strings from text format. | |
Private Types | |
| enum class | OperandType : uint8_t { NONE , INT , REGISTER , CONSTANT_IDX , VARIABLE_IDX , FUNCTION_IDX } |
| Operand types for instructions. More... | |
Static Private Member Functions | |
| static int | getOperandCount (OpCode op) |
| static OperandType | getOperandType (OpCode op, int operandIndex) |
Static Private Attributes | |
| static const std::unordered_map< OpCode, std::string > | opCodeToStringMap |
| static const std::unordered_map< std::string, OpCode > | stringToOpCodeMap |
Phasor IR Serializer/Deserializer.
Definition at line 17 of file PhasorIR.hpp.
|
strongprivate |
Operand types for instructions.
| Enumerator | |
|---|---|
| NONE | No operand. |
| INT | Integer operand. |
| REGISTER | Register operand. |
| CONSTANT_IDX | Index into constant pool. |
| VARIABLE_IDX | Index into variable mapping. |
| FUNCTION_IDX | Index into function entries. |
Definition at line 40 of file PhasorIR.hpp.
|
static |
Deserialize Phasor IR format to bytecode.
Definition at line 454 of file PhasorIR.cpp.
|
static |
Helper to escape strings for text format.
Definition at line 214 of file PhasorIR.cpp.
|
staticprivate |
|
staticprivate |
|
static |
Load bytecode from .phir file.
Definition at line 641 of file PhasorIR.cpp.
|
static |
Save bytecode to .phir file.
Definition at line 624 of file PhasorIR.cpp.
|
static |
Serialize bytecode to Phasor IR format.
Definition at line 283 of file PhasorIR.cpp.
|
static |
Helper to unescape strings from text format.
Definition at line 244 of file PhasorIR.cpp.
|
staticprivate |
Definition at line 53 of file PhasorIR.hpp.
|
staticprivate |
Definition at line 54 of file PhasorIR.hpp.