![]() |
Phasor 3.1.1
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) |
| 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. | |
| std::map< std::string, int > | functionParamCounts |
| Function name -> parameter count. | |
| 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 46 of file CodeGen.hpp.
|
inline |
Add a constant to the pool and return its index.
Definition at line 60 of file CodeGen.hpp.
|
inline |
Emit an instruction with operands.
Definition at line 80 of file CodeGen.hpp.
|
inline |
Get or create a variable index.
Definition at line 67 of file CodeGen.hpp.
| std::vector<Value> Phasor::Bytecode::constants |
Constant pool.
Definition at line 49 of file CodeGen.hpp.
| std::map<std::string, int> Phasor::Bytecode::functionEntries |
Function name -> instruction index mapping.
Definition at line 51 of file CodeGen.hpp.
| std::map<std::string, int> Phasor::Bytecode::functionParamCounts |
Function name -> parameter count.
Definition at line 52 of file CodeGen.hpp.
| std::vector<Instruction> Phasor::Bytecode::instructions |
List of instructions.
Definition at line 48 of file CodeGen.hpp.
| int Phasor::Bytecode::nextVarIndex = 0 |
Next available variable index.
Definition at line 53 of file CodeGen.hpp.
| std::map<std::string, int> Phasor::Bytecode::structEntries |
Struct name -> index in structs.
Definition at line 57 of file CodeGen.hpp.
| std::vector<StructInfo> Phasor::Bytecode::structs |
List of struct descriptors.
Definition at line 56 of file CodeGen.hpp.
| std::map<std::string, int> Phasor::Bytecode::variables |
Variable name -> index mapping.
Definition at line 50 of file CodeGen.hpp.