![]() |
Phasor 2.2.0
Stack VM based Programming Language
|
Complete bytecode structure. More...
#include <CodeGen.hpp>
Public Member Functions | |
| int | addConstant (const Value &value) |
| Add a constant to the pool and return its index. | |
| int | getOrCreateVar (const std::string &name) |
| Get or create a variable index. | |
| void | emit (OpCode op, int32_t op1=0, int32_t op2=0, int32_t op3=0, int32_t op4=0, int32_t op5=0) |
| Emit an instruction with operands. | |
Public Attributes | |
| std::vector< Instruction > | instructions |
| List of instructions. | |
| std::vector< Value > | constants |
| Constant pool. | |
| std::map< std::string, int > | variables |
| Variable name -> index mapping. | |
| std::map< std::string, int > | functionEntries |
| Function name -> instruction index mapping. | |
| int | nextVarIndex = 0 |
| Next available variable index. | |
| std::vector< StructInfo > | structs |
| List of struct descriptors. | |
| std::map< std::string, int > | structEntries |
| Struct name -> index in structs. | |
Complete bytecode structure.
Definition at line 200 of file CodeGen.hpp.
|
inline |
Add a constant to the pool and return its index.
Definition at line 213 of file CodeGen.hpp.
|
inline |
Emit an instruction with operands.
Definition at line 233 of file CodeGen.hpp.
|
inline |
Get or create a variable index.
Definition at line 220 of file CodeGen.hpp.
| std::vector<Value> Phasor::Bytecode::constants |
Constant pool.
Definition at line 203 of file CodeGen.hpp.
| std::map<std::string, int> Phasor::Bytecode::functionEntries |
Function name -> instruction index mapping.
Definition at line 205 of file CodeGen.hpp.
| std::vector<Instruction> Phasor::Bytecode::instructions |
List of instructions.
Definition at line 202 of file CodeGen.hpp.
| int Phasor::Bytecode::nextVarIndex = 0 |
Next available variable index.
Definition at line 206 of file CodeGen.hpp.
| std::map<std::string, int> Phasor::Bytecode::structEntries |
Struct name -> index in structs.
Definition at line 210 of file CodeGen.hpp.
| std::vector<StructInfo> Phasor::Bytecode::structs |
List of struct descriptors.
Definition at line 209 of file CodeGen.hpp.
| std::map<std::string, int> Phasor::Bytecode::variables |
Variable name -> index mapping.
Definition at line 204 of file CodeGen.hpp.