![]() |
Phasor 3.3.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 | addStringConstant (const std::string &s) |
| Add a string constant with deduplication. | |
| int | getOrCreateVar (const std::string &name) |
| Get or create a variable index. | |
| void | emit (OpCode op, i32 op1=0, i32 op2=0, i32 op3=0) |
| Emit an instruction with operands. | |
| 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, i32 op1=0, i32 op2=0, i32 op3=0) |
| Emit an instruction with operands. | |
Public Attributes | |
| std::vector< Instruction > | instructions |
| List of instructions. | |
| std::vector< Value > | constants |
| Constant pool. | |
| std::unordered_map< std::string, int > | variables |
| Variable name -> index mapping. | |
| std::unordered_map< std::string, int > | functionEntries |
| Function name -> instruction index mapping. | |
| std::unordered_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::unordered_map< std::string, int > | structEntries |
| Struct name -> index in structs. | |
| std::unordered_map< std::string, int > | stringConstantCache |
| Dedup cache for string constants. | |
| 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. | |
| std::map< std::string, int > | structEntries |
| Struct name -> index in structs. | |
Complete bytecode structure.
Definition at line 49 of file CodeGen.hpp.
|
inline |
Add a constant to the pool and return its index.
Definition at line 231 of file PhasorISA.hpp.
|
inline |
Add a constant to the pool and return its index.
Definition at line 63 of file CodeGen.hpp.
|
inline |
Add a string constant with deduplication.
Definition at line 70 of file CodeGen.hpp.
Emit an instruction with operands.
Definition at line 251 of file PhasorISA.hpp.
Emit an instruction with operands.
Definition at line 98 of file CodeGen.hpp.
|
inline |
Get or create a variable index.
Definition at line 238 of file PhasorISA.hpp.
|
inline |
Get or create a variable index.
Definition at line 85 of file CodeGen.hpp.
| std::vector< Value > Phasor::Bytecode::constants |
Constant pool.
Definition at line 52 of file CodeGen.hpp.
| std::map<std::string, int> Phasor::Bytecode::functionEntries |
Function name -> instruction index mapping.
Definition at line 222 of file PhasorISA.hpp.
| std::unordered_map<std::string, int> Phasor::Bytecode::functionEntries |
Function name -> instruction index mapping.
Definition at line 54 of file CodeGen.hpp.
| std::map<std::string, int> Phasor::Bytecode::functionParamCounts |
Function name -> parameter count.
Definition at line 223 of file PhasorISA.hpp.
| std::unordered_map<std::string, int> Phasor::Bytecode::functionParamCounts |
Function name -> parameter count.
Definition at line 55 of file CodeGen.hpp.
| std::vector< Instruction > Phasor::Bytecode::instructions |
List of instructions.
Definition at line 51 of file CodeGen.hpp.
| int Phasor::Bytecode::nextVarIndex = 0 |
Next available variable index.
Definition at line 56 of file CodeGen.hpp.
| std::unordered_map<std::string, int> Phasor::Bytecode::stringConstantCache |
Dedup cache for string constants.
Definition at line 82 of file CodeGen.hpp.
| std::map<std::string, int> Phasor::Bytecode::structEntries |
Struct name -> index in structs.
Definition at line 228 of file PhasorISA.hpp.
| std::unordered_map<std::string, int> Phasor::Bytecode::structEntries |
Struct name -> index in structs.
Definition at line 60 of file CodeGen.hpp.
| std::vector< StructInfo > Phasor::Bytecode::structs |
List of struct descriptors.
Definition at line 59 of file CodeGen.hpp.
| std::map<std::string, int> Phasor::Bytecode::variables |
Variable name -> index mapping.
Definition at line 221 of file PhasorISA.hpp.
| std::unordered_map<std::string, int> Phasor::Bytecode::variables |
Variable name -> index mapping.
Definition at line 53 of file CodeGen.hpp.