|
MXVM 1.8.1
Virtual Machine, Compiler, and Pascal Frontend
|
AST visitor that generates MXVM intermediate code. More...
#include <icode.hpp>

Classes | |
| struct | Scope |
| struct | FuncInfo |
| Describes a user-declared function's parameter and return types. More... | |
| struct | ValueLocation |
| Describes where a value currently resides (register, memory, or immediate). More... | |
| struct | RecordField |
| A field within a record type definition. More... | |
| struct | RecordTypeInfo |
| Complete description of a record type. More... | |
Public Member Functions | |
| void | registerExternalFunc (const std::string &funcName, const std::string &unitName) |
| Register a function or procedure as originating from an external unit. | |
| bool | isImportedUnit (const std::string &name) const |
| Check whether a name refers to an imported unit. | |
| void | registerImportedConst (const std::string &unitName, ConstDeclNode &node) |
| Register imported constant values from a dependency unit. | |
| void | registerImportedVar (const std::string &unitName, VarDeclNode &node) |
| Register imported variable metadata from a dependency unit (no alloc emitted). | |
| CodeGenVisitor () | |
| Construct and initialise registers and float register pool. | |
| virtual | ~CodeGenVisitor ()=default |
| void | initializeBuiltins () |
| Register all built-in function handlers (IO, Std, SDL, String). | |
| void | emitFree (const std::string &s) |
| Emit a free instruction for an allocated pointer. | |
| void | generate (ASTNode *root) |
| Generate MXVM code for the entire AST. | |
| void | markAllocatedPtr (const std::string &p) |
| Mark a pointer name as allocated (will be freed at scope end). | |
| void | emit_invoke (const std::string &funcName, const std::vector< std::string > ¶ms) |
| Emit an invoke instruction calling a named function with parameters. | |
| bool | isIntLiteral (const std::string &s) const |
| void | writeTo (std::ostream &out) const |
| Write the complete MXVM program to a stream. | |
| std::string | getTypeString (const VarDeclNode &node) |
| std::string | storageSymbolFor (const std::string &mangled) |
| bool | isRecordTypeName (const std::string &t) |
| int | getTypeSizeByName (const std::string &t) |
| VarType | getTypeFromString (const std::string &typeStr) |
| void | emitArrayBoundsCheck (const std::string &idxReg, int lower, int upper) |
| Emit bounds-check code for a static array access. | |
| void | emitDynArrayBoundsCheck (const std::string &idxReg, const std::string &lenSym) |
| Emit bounds-check code for a dynamic array access. | |
| VarType | getExpressionType (ASTNode *node) |
| void | updateDataSectionInitialValue (const std::string &varName, const std::string &type, const std::string &value) |
AST Visitor Overrides | |
Code generation for each Pascal AST node type. | |
| void | visit (ProgramNode &node) override |
| void | visit (UnitNode &node) override |
| Generate MXVM object code from a Pascal unit. | |
| void | visit (BlockNode &node) override |
| void | visit (VarDeclNode &node) override |
| void | visit (ProcCallNode &node) override |
| void | visit (FuncCallNode &node) override |
| void | visit (FuncDeclNode &node) override |
| void | visit (ProcDeclNode &node) override |
| void | visit (TypeAliasNode &node) override |
| void | visit (ParameterNode &node) override |
| void | visit (CompoundStmtNode &node) override |
| Visit a compound statement block, freeing temporary pointers after each statement. | |
| void | visit (IfStmtNode &node) override |
| void | visit (WhileStmtNode &node) override |
| void | visit (ForStmtNode &node) override |
| void | visit (BinaryOpNode &node) override |
| void | visit (UnaryOpNode &node) override |
| void | visit (VariableNode &node) override |
| void | visit (NumberNode &node) override |
| void | visit (StringNode &node) override |
| void | visit (BooleanNode &node) override |
| void | visit (EmptyStmtNode &node) override |
| void | visit (ConstDeclNode &node) override |
| void | visit (RepeatStmtNode &node) override |
| void | visit (CaseStmtNode &node) override |
| void | visit (ArrayTypeNode &node) override |
| void | visit (ArrayDeclarationNode &node) override |
| void | visit (FieldAccessNode &node) override |
| void | visit (AssignmentNode &node) override |
| void | visit (ArrayAssignmentNode &node) override |
| void | visit (ArrayAccessNode &node) override |
| void | visit (RecordTypeNode &node) override |
| void | visit (RecordDeclarationNode &node) override |
| void | visit (TypeDeclNode &node) override |
| void | visit (SimpleTypeNode &node) override |
| void | visit (ArrayTypeDeclarationNode &node) override |
| void | visit (ExitNode &node) override |
| void | visit (BreakNode &node) override |
| void | visit (ContinueNode &node) override |
| void | visit (NilNode &node) override |
| void | visit (PointerTypeNode &node) override |
| void | visit (PointerDerefNode &node) override |
| void | visit (AddressOfNode &node) override |
| void | visit (WithStmtNode &node) override |
| void | visit (GotoStmtNode &node) override |
| void | visit (LabelStmtNode &node) override |
| void | visit (SetLiteralNode &node) override |
| void | visit (SetTypeNode &node) override |
| void | visit (EnumTypeDeclNode &node) override |
| Public Member Functions inherited from pascal::ASTVisitor | |
| virtual | ~ASTVisitor ()=default |
Public Attributes | |
| BuiltinFunctionRegistry | builtinRegistry |
| registry of built-in function handlers | |
| std::string | name = "App" |
| program name emitted in the output header | |
| std::unordered_map< std::string, int > | enumConstants |
| Enum value → ordinal mapping (lowercased name → integer). | |
| std::unordered_map< std::string, std::vector< std::string > > | enumTypes |
| Enum type name → ordered list of value names. | |
| std::unordered_set< std::string > | setVars |
| Set of variable names that are set types (allocated as 256-byte bitsets). | |
| std::unordered_set< std::string > | fileVars |
| Set of variable names that are file types (pointer to FILE). | |
| std::unordered_map< std::string, std::string > | fileVarNames |
| Maps file variable name to companion filename variable name. | |
Private Member Functions | |
| std::string | generateRealConstantName () |
| bool | isRealNumber (const std::string &s) const |
| std::string | mangleWithScope (const std::string &baseName, const std::vector< std::string > &scopePath) const |
| std::string | mangleVariableName (const std::string &varName) const |
| std::string | getCurrentScopeName () const |
| std::string | funcLabel (const char *prefix, const std::string &name) |
| VarType | getVarType (const std::string &name) const |
| bool | isRealConstSymbol (const std::string &s) const |
| std::string | coerceToIntImmediate (const std::string &v) |
| void | setVarType (const std::string &name, VarType t) |
| void | setSlotType (int slot, VarType t) |
| bool | isStringVar (const std::string &name) const |
| std::string | emptyString () |
| void | initializeFloatRegisters () |
| void | addTempPtr (const std::string &v) |
| bool | isRegisterSlot (int slot) const |
| bool | isTempVar (const std::string &name) const |
| std::string | slotVar (int slot) const |
| std::string | allocReg () |
| std::string | allocPtrReg () |
| std::string | allocFloatReg () |
| void | expandFloatRegisters () |
| void | freePtrReg (const std::string ®) |
| void | freeReg (const std::string ®) |
| void | freeFloatReg (const std::string ®) |
| bool | isFloatReg (const std::string &name) const |
| bool | isPtrReg (const std::string &name) const |
| bool | isReg (const std::string &name) const |
| int | newSlotFor (const std::string &name) |
| std::string | newTemp () |
| std::string | newLabel (const std::string &prefix="L") |
| void | freeTempPtr (const std::string &ptrName) |
| void | releaseTempPtr (const std::string &ptrName) |
| bool | isTempPtr (const std::string &name) const |
| std::string | allocTempPtr (const std::string &forScope="") |
| void | emit (const std::string &s) |
| void | emitLabel (const std::string &label) |
| void | emit1 (const std::string &op, const std::string &a) |
| void | emit2 (const std::string &op, const std::string &a, const std::string &b) |
| void | emit3 (const std::string &op, const std::string &a, const std::string &b, const std::string &c) |
| void | emit4 (const std::string &op, const std::string &a, const std::string &b, const std::string &c, const std::string &d) |
| std::string | escapeStringForMxvm (const std::string &raw) const |
| std::string | ensureFloatConstSymbol (const std::string &value) |
| std::string | internString (const std::string &val) |
| std::string | convertCharLiteral (const std::string &c) |
| void | pushValue (const std::string &v) |
| std::string | popValue () |
| std::string | eval (ASTNode *n) |
| void | recordLocation (const std::string &var, ValueLocation loc) |
| void | pushTri (const char *op, const std::string &a, const std::string &b) |
| void | pushCmpResult (const std::string &a, const std::string &b, const char *jop) |
| void | pushFloatCmpResult (const std::string &aIn, const std::string &bIn, const char *jop) |
| void | pushLogicalAnd (const std::string &a, const std::string &b) |
| void | pushLogicalOr (const std::string &a, const std::string &b) |
| bool | isParmReg (const std::string &name) const |
| void | allocateRecordFieldArrays (const std::string &recordVarName, const std::string &recordTypeName) |
| ArrayInfo | buildArrayInfoFromNode (ArrayTypeNode *atn) |
| int | getArrayElementSize (const std::string &tIn) |
| std::string | evaluateConstantExpression (ASTNode *node) |
| std::string | getTypeString (ASTNode *typeNode) |
| std::string | resolveTypeName (std::string t) const |
| int | getRecordTypeSize (const std::string &typeName) |
| std::string | findMangledFuncName (const std::string &name, bool isProc) const |
| std::string | findMangledName (const std::string &name) const |
| std::string | findMangledArrayName (const std::string &name) const |
| bool | isIntegerLiteral (const std::string &s) const |
| bool | isFloatLiteral (const std::string &s) const |
| bool | tryGetConstNumeric (const std::string &name, std::string &out) |
| std::string | foldNumeric (ASTNode *n) |
| std::pair< int, int > | getRecordFieldOffsetAndSize (const std::string &recType, const std::string &field) |
| std::string | getVarRecordTypeNameFromExpr (ASTNode *expr) |
| std::string | getVarRecordTypeName (const std::string &varName) |
| bool | isArrayTypeName (const std::string &t) const |
| std::string | getPointerBaseTypeName (const std::string &varName) const |
| int | getPointerElementSize (const std::string &varName) |
| VarType | getPointerDerefType (const std::string &varName) |
| std::string | getCurrentEndLabel () const |
| std::string | ensurePtrBase (const std::string &v) |
| std::string | getArrayNameFromBase (ASTNode *base) |
| ArrayInfo * | getArrayInfoForArrayAccess (ArrayAccessNode *arr) |
Static Private Member Functions | |
| static bool | endsWithColon (const std::string &s) |
| static std::string | lc (std::string s) |
| static bool | isPtrLike (VarType t) |
Private Attributes | |
| std::unordered_map< std::string, std::string > | compileTimeConstants |
| std::unordered_set< std::string > | usedRealConstants |
| int | realConstantCounter = 0 |
| std::unordered_map< std::string, std::string > | currentParamTypes |
| std::set< std::string > | usedModules |
| std::vector< std::string > | objectDeps |
| unit/object dependencies for section object | |
| bool | isUnit = false |
| true when generating code for a unit (object output) | |
| std::unordered_map< std::string, std::string > | externalFuncs |
| maps function/proc name to source unit name | |
| std::unordered_set< std::string > | importedUnitNames |
| names of units imported via uses clause | |
| std::unordered_map< std::string, ArrayInfo > | importedArrayInfo |
| array metadata for imported unit vars | |
| std::unordered_map< std::string, VarType > | importedVarTypes |
| var types for imported unit vars | |
| std::vector< std::string > | globalArrays |
| std::unordered_map< std::string, std::vector< std::string > > | functionScopedArrays |
| std::vector< std::string > | scopeHierarchy |
| std::vector< Scope > | scopeStack |
| std::unordered_map< std::string, std::string > | typeAliases |
| std::map< std::string, std::pair< std::string, std::string > > | constInitialValues |
| std::map< std::string, size_t > | bufferStringVars |
| std::map< std::string, std::string > | currentParamLocations |
| std::vector< std::pair< ProcDeclNode *, std::vector< std::string > > > | deferredProcs |
| std::vector< std::string > | allTempPtrs |
| std::vector< bool > | tempPtrInUse |
| std::unordered_map< std::string, FuncInfo > | funcSignatures |
| std::unordered_map< std::string, VarType > | varTypes |
| std::unordered_map< int, VarType > | slotToType |
| bool | needsEmptyString = false |
| int | nextSpillReg = 0 |
| std::vector< std::string > | registers = {"rax", "rbx", "rcx", "rdx", "rsi", "rdi", "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"} |
| const std::vector< std::string > | ptrRegisters |
| std::vector< std::string > | floatRegisters |
| std::vector< bool > | floatRegInUse |
| int | nextFloatRegIndex = 0 |
| std::vector< bool > | regInUse |
| std::vector< bool > | ptrRegInUse |
| std::vector< std::pair< FuncDeclNode *, std::vector< std::string > > > | deferredFuncs |
| std::string | currentFunctionName |
| std::string | currentFunctionReturnSlot |
| slot variable that holds the return value until FUNC_END | |
| std::vector< std::string > | currentFuncLocalSlots |
| bool | functionSetReturn = false |
| int | nextSlot = 0 |
| int | nextTemp = 0 |
| int | labelCounter = 0 |
| std::unordered_map< std::string, int > | varSlot |
| std::vector< std::string > | prolog |
| std::vector< std::string > | instructions |
| std::vector< std::string > | evalStack |
| std::vector< std::pair< std::string, std::string > > | stringLiterals |
| std::unordered_set< std::string > | usedStrings |
| std::unordered_map< int, std::string > | slotToName |
| std::unordered_map< std::string, std::vector< std::string > > | recordsToFreeInScope |
| std::unordered_map< std::string, std::vector< std::string > > | tempPtrByScope |
| std::unordered_map< std::string, bool > | declaredProcs |
| std::unordered_map< std::string, bool > | declaredFuncs |
| bool | generatingDeferredCode = false |
| std::unordered_map< std::string, ValueLocation > | valueLocations |
| std::unordered_set< std::string > | allocatedPtrs |
| std::unordered_set< std::string > | escapedTempPtrs |
| std::unordered_map< std::string, std::string > | realConstants |
| std::unordered_map< std::string, ArrayInfo > | arrayInfo |
| std::unordered_map< std::string, int > | dynArrayLenSlot |
| mangled array name → slot of companion length variable | |
| std::unordered_map< std::string, RecordTypeInfo > | recordTypes |
| std::unordered_map< std::string, std::string > | varRecordType |
| std::unordered_map< std::string, std::string > | pointerBaseType |
| std::vector< std::string > | loopEndLabels |
| std::vector< std::string > | loopContinueLabels |
| std::vector< std::unordered_map< std::string, std::string > > | withFieldScopes |
| Stack of active with scopes: each entry maps unqualified field name -> record variable name. | |
| std::unordered_map< std::string, std::string > | gotoLabels |
| Maps user-declared goto label numbers to generated MXVM labels. | |
Friends | |
| class | IOFunctionHandler |
| class | MathFunctionHandler |
| class | StdFunctionHandler |
| class | SDLFunctionHandler |
| class | StringFunctionHandler |
| class | FileFunctionHandler |
AST visitor that generates MXVM intermediate code.
Traverses the Pascal AST, emitting register-based intermediate instructions into an instruction list. The final output is written via writeTo() in MXVM program format.
| pascal::CodeGenVisitor::CodeGenVisitor | ( | ) |
Construct and initialise registers and float register pool.
Definition at line 10 of file icode_visit.cpp.
References initializeBuiltins(), initializeFloatRegisters(), ptrRegInUse, ptrRegisters, regInUse, and registers.
|
virtualdefault |
|
inlineprivate |
Definition at line 353 of file icode.hpp.
References getCurrentScopeName(), and tempPtrByScope.
|
inlineprivate |
Definition at line 785 of file icode.hpp.
References emit3(), emit4(), ensurePtrBase(), functionScopedArrays, getCurrentScopeName(), globalArrays, newSlotFor(), pascal::PTR, recordTypes, setSlotType(), slotVar(), and updateDataSectionInitialValue().
Referenced by visit().
|
inlineprivate |
Definition at line 412 of file icode.hpp.
References expandFloatRegisters(), floatRegInUse, and floatRegisters.
Referenced by emit_invoke(), pascal::StdFunctionHandler::generateWithResult(), pushTri(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 401 of file icode.hpp.
References ptrRegInUse, and ptrRegisters.
|
inlineprivate |
Definition at line 389 of file icode.hpp.
References name, nextSpillReg, regInUse, and registers.
Referenced by emit_invoke(), emitDynArrayBoundsCheck(), pascal::FileFunctionHandler::generate(), pascal::IOFunctionHandler::generate(), pascal::StdFunctionHandler::generate(), pascal::FileFunctionHandler::generateWithResult(), pascal::IOFunctionHandler::generateWithResult(), pascal::SDLFunctionHandler::generateWithResult(), pascal::StdFunctionHandler::generateWithResult(), pascal::StringFunctionHandler::generateWithResult(), pushCmpResult(), pushFloatCmpResult(), pushLogicalAnd(), pushLogicalOr(), pushTri(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 502 of file icode.hpp.
References allTempPtrs, getCurrentScopeName(), nextTemp, tempPtrByScope, and tempPtrInUse.
Referenced by ensurePtrBase(), pascal::StringFunctionHandler::generateWithResult(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 817 of file icode.hpp.
References buildArrayInfoFromNode(), pascal::ArrayInfo::elementArray, pascal::ArrayInfo::elementIsArray, pascal::ArrayInfo::elementSize, pascal::ArrayInfo::elementType, pascal::ArrayTypeNode::elementType, evaluateConstantExpression(), getArrayElementSize(), pascal::ArrayInfo::isDynamic, lc(), pascal::ArrayInfo::lowerBound, pascal::ArrayTypeNode::lowerBound, resolveTypeName(), pascal::ArrayInfo::size, typeAliases, pascal::ArrayInfo::upperBound, and pascal::ArrayTypeNode::upperBound.
Referenced by buildArrayInfoFromNode(), registerImportedVar(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 290 of file icode.hpp.
References isFloatLiteral(), isRealConstSymbol(), and realConstants.
Referenced by visit().
|
inlineprivate |
|
inlineprivate |
Definition at line 525 of file icode.hpp.
References instructions.
Referenced by emit1(), emit2(), emit4(), emit_invoke(), emitFree(), generate(), pascal::FileFunctionHandler::generate(), pascal::IOFunctionHandler::generate(), pascal::StdFunctionHandler::generate(), pascal::FileFunctionHandler::generateWithResult(), pascal::IOFunctionHandler::generateWithResult(), pascal::SDLFunctionHandler::generateWithResult(), pascal::StdFunctionHandler::generateWithResult(), pascal::StringFunctionHandler::generateWithResult(), visit(), visit(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 529 of file icode.hpp.
References emit().
Referenced by emitArrayBoundsCheck(), emitDynArrayBoundsCheck(), freeTempPtr(), generate(), pascal::IOFunctionHandler::generate(), pushCmpResult(), pushFloatCmpResult(), pushLogicalAnd(), pushLogicalOr(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 530 of file icode.hpp.
References emit(), ensureFloatConstSymbol(), and isRealNumber().
Referenced by emit_invoke(), emitArrayBoundsCheck(), emitDynArrayBoundsCheck(), ensurePtrBase(), generate(), pascal::FileFunctionHandler::generate(), pascal::IOFunctionHandler::generate(), pascal::StdFunctionHandler::generate(), pascal::FileFunctionHandler::generateWithResult(), pascal::StdFunctionHandler::generateWithResult(), pushCmpResult(), pushFloatCmpResult(), pushLogicalAnd(), pushLogicalOr(), pushTri(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 537 of file icode.hpp.
References allocatedPtrs, and instructions.
Referenced by allocateRecordFieldArrays(), visit(), visit(), visit(), visit(), and visit().
|
inlineprivate |
|
inline |
Emit an invoke instruction calling a named function with parameters.
| funcName | Function/procedure label |
| params | Values to pass (literals are first moved into registers) |
Definition at line 1287 of file icode.hpp.
References allocFloatReg(), allocReg(), emit(), emit2(), freeReg(), isIntLiteral(), and isRealNumber().
Referenced by pascal::FileFunctionHandler::generate(), pascal::IOFunctionHandler::generate(), pascal::SDLFunctionHandler::generate(), pascal::StdFunctionHandler::generate(), pascal::FileFunctionHandler::generateWithResult(), pascal::IOFunctionHandler::generateWithResult(), pascal::SDLFunctionHandler::generateWithResult(), pascal::StdFunctionHandler::generateWithResult(), pascal::StringFunctionHandler::generateWithResult(), and visit().
|
inline |
Emit bounds-check code for a static array access.
| idxReg | Register or variable holding the index |
| lower | Compile-time lower bound |
| upper | Compile-time upper bound |
Generates code that exits with code 1 when the index is out of the static [lower..upper] range. Gated by MXVM_BOUNDS_CHECK.
Definition at line 1572 of file icode.hpp.
References emit1(), emit2(), emitLabel(), and newLabel().
|
inline |
Emit bounds-check code for a dynamic array access.
| idxReg | Register or variable holding the index |
| lenSym | Variable holding the runtime array length |
Generates code that exits with code 1 when the index is negative or >= the runtime length stored in lenSym. Gated by MXVM_BOUNDS_CHECK.
Definition at line 1596 of file icode.hpp.
References allocReg(), emit1(), emit2(), emitLabel(), freeReg(), and newLabel().
|
inline |
Emit a free instruction for an allocated pointer.
Definition at line 980 of file icode.hpp.
References allocatedPtrs, and emit().
Referenced by generate().
|
inlineprivate |
Definition at line 528 of file icode.hpp.
References instructions.
Referenced by emitArrayBoundsCheck(), emitDynArrayBoundsCheck(), generate(), pushCmpResult(), pushFloatCmpResult(), pushLogicalAnd(), pushLogicalOr(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), and visit().
|
inlineprivate |
|
inlinestaticprivate |
|
inlineprivate |
Definition at line 564 of file icode.hpp.
References generateRealConstantName(), isRealNumber(), realConstants, and usedRealConstants.
Referenced by emit2(), registerImportedConst(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 2171 of file icode.hpp.
References allocTempPtr(), emit2(), isPtrReg(), pascal::PTR, pascal::RECORD, slotToType, pascal::STRING, and varSlot.
Referenced by allocateRecordFieldArrays(), pascal::StdFunctionHandler::generate(), visit(), visit(), visit(), visit(), visit(), and visit().
|
inlineprivate |
|
inlineprivate |
Definition at line 634 of file icode.hpp.
References pascal::ASTNode::accept(), evalStack, isRealNumber(), and popValue().
Referenced by pascal::FileFunctionHandler::generate(), pascal::IOFunctionHandler::generate(), pascal::SDLFunctionHandler::generate(), pascal::StdFunctionHandler::generate(), pascal::FileFunctionHandler::generateWithResult(), pascal::IOFunctionHandler::generateWithResult(), pascal::SDLFunctionHandler::generateWithResult(), pascal::StdFunctionHandler::generateWithResult(), pascal::StringFunctionHandler::generateWithResult(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 1696 of file icode.hpp.
References compileTimeConstants, pascal::BinaryOpNode::DIV, pascal::BinaryOpNode::DIVIDE, evaluateConstantExpression(), findMangledName(), isFloatLiteral(), pascal::BinaryOpNode::MINUS, pascal::UnaryOpNode::MINUS, pascal::BinaryOpNode::MOD, pascal::BinaryOpNode::MULTIPLY, pascal::BinaryOpNode::PLUS, and pascal::UnaryOpNode::PLUS.
Referenced by buildArrayInfoFromNode(), evaluateConstantExpression(), registerImportedConst(), visit(), and visit().
|
inlineprivate |
Definition at line 425 of file icode.hpp.
References floatRegInUse, and floatRegisters.
Referenced by allocFloatReg().
|
inlineprivate |
|
inlineprivate |
Definition at line 1843 of file icode.hpp.
References declaredFuncs, declaredProcs, mangleWithScope(), name, and scopeHierarchy.
Referenced by getCurrentEndLabel(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 1855 of file icode.hpp.
References name, scopeHierarchy, and varSlot.
Referenced by evaluateConstantExpression(), pascal::FileFunctionHandler::generate(), pascal::IOFunctionHandler::generate(), getArrayInfoForArrayAccess(), getPointerBaseTypeName(), getVarRecordTypeName(), getVarRecordTypeNameFromExpr(), getVarType(), tryGetConstNumeric(), visit(), visit(), visit(), visit(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 1928 of file icode.hpp.
References pascal::BinaryOpNode::DIV, pascal::BinaryOpNode::DIVIDE, foldNumeric(), isFloatLiteral(), pascal::BinaryOpNode::MINUS, pascal::BinaryOpNode::MOD, pascal::BinaryOpNode::MULTIPLY, pascal::BinaryOpNode::PLUS, and tryGetConstNumeric().
Referenced by foldNumeric(), and visit().
|
inlineprivate |
Definition at line 448 of file icode.hpp.
References floatRegInUse, and floatRegisters.
Referenced by pascal::StdFunctionHandler::generateWithResult(), and pushFloatCmpResult().
|
inlineprivate |
Definition at line 431 of file icode.hpp.
References ptrRegInUse, and ptrRegisters.
Referenced by freeReg().
|
inlineprivate |
Definition at line 439 of file icode.hpp.
References freePtrReg(), regInUse, registers, and releaseTempPtr().
Referenced by emit_invoke(), emitDynArrayBoundsCheck(), pascal::FileFunctionHandler::generate(), pascal::IOFunctionHandler::generate(), pascal::SDLFunctionHandler::generate(), pascal::StdFunctionHandler::generate(), pascal::FileFunctionHandler::generateWithResult(), pascal::IOFunctionHandler::generateWithResult(), pascal::SDLFunctionHandler::generateWithResult(), pascal::StdFunctionHandler::generateWithResult(), pascal::StringFunctionHandler::generateWithResult(), pushCmpResult(), pushLogicalAnd(), pushLogicalOr(), pushTri(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 477 of file icode.hpp.
References allTempPtrs, emit1(), and tempPtrInUse.
|
inlineprivate |
|
inline |
Generate MXVM code for the entire AST.
| root | Root AST node (typically a ProgramNode) |
Definition at line 990 of file icode.hpp.
References pascal::ASTNode::accept(), allocatedPtrs, arrayInfo, compileTimeConstants, currentFuncLocalSlots, currentFunctionName, currentFunctionReturnSlot, currentParamLocations, currentParamTypes, declaredFuncs, deferredFuncs, deferredProcs, pascal::DOUBLE, emit(), emit1(), emit2(), emitFree(), emitLabel(), emptyString(), escapedTempPtrs, floatRegInUse, floatRegisters, funcLabel(), functionScopedArrays, functionSetReturn, generateRealConstantName(), generatingDeferredCode, getTypeFromString(), getVarType(), globalArrays, importedArrayInfo, importedVarTypes, instructions, isUnit, lc(), mangleVariableName(), mangleWithScope(), name, newSlotFor(), objectDeps, pointerBaseType, prolog, pascal::PTR, ptrRegInUse, ptrRegisters, realConstants, pascal::RECORD, recordsToFreeInScope, recordTypes, regInUse, registers, resolveTypeName(), scopeHierarchy, scopeStack, setSlotType(), setVarType(), slotVar(), pascal::STRING, tempPtrByScope, typeAliases, usedRealConstants, usedStrings, valueLocations, varRecordType, and varTypes.
Referenced by compileFile().
|
inlineprivate |
Definition at line 208 of file icode.hpp.
References realConstantCounter.
Referenced by ensureFloatConstSymbol(), generate(), and pushFloatCmpResult().
|
inlineprivate |
Definition at line 865 of file icode.hpp.
References lc(), recordTypes, and resolveTypeName().
Referenced by buildArrayInfoFromNode(), and visit().
|
inlineprivate |
Definition at line 2208 of file icode.hpp.
References arrayInfo, pascal::ArrayAccessNode::base, pascal::ArrayInfo::elementArray, pascal::ArrayInfo::elementIsArray, findMangledName(), getArrayInfoForArrayAccess(), getVarRecordTypeNameFromExpr(), isImportedUnit(), lc(), recordTypes, and resolveTypeName().
Referenced by getArrayInfoForArrayAccess(), getExpressionType(), getVarRecordTypeNameFromExpr(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 2194 of file icode.hpp.
References getArrayNameFromBase().
Referenced by getArrayNameFromBase(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 2150 of file icode.hpp.
References currentFunctionName, declaredFuncs, declaredProcs, and findMangledFuncName().
Referenced by visit().
|
inlineprivate |
Definition at line 245 of file icode.hpp.
References deferredFuncs, generatingDeferredCode, mangleWithScope(), and scopeHierarchy.
Referenced by addTempPtr(), allocateRecordFieldArrays(), allocTempPtr(), visit(), and visit().
Definition at line 1614 of file icode.hpp.
References pascal::BOOL, builtinRegistry, pascal::CHAR, pascal::DOUBLE, pascal::ArrayInfo::elementIsArray, pascal::ArrayInfo::elementType, funcSignatures, getArrayInfoForArrayAccess(), getExpressionType(), getPointerDerefType(), getTypeFromString(), getVarRecordTypeNameFromExpr(), getVarType(), pascal::INT, pascal::NumberNode::isReal, isRecordTypeName(), lc(), pascal::BinaryOpNode::PLUS, pascal::PTR, pascal::RECORD, recordTypes, resolveTypeName(), and pascal::STRING.
Referenced by pascal::IOFunctionHandler::generate(), pascal::StdFunctionHandler::generateWithResult(), getExpressionType(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 2115 of file icode.hpp.
References findMangledName(), and pointerBaseType.
Referenced by getPointerDerefType(), getPointerElementSize(), and visit().
|
inlineprivate |
Definition at line 2134 of file icode.hpp.
References getPointerBaseTypeName(), getTypeFromString(), and pascal::INT.
Referenced by getExpressionType(), and visit().
|
inlineprivate |
Definition at line 2126 of file icode.hpp.
References getPointerBaseTypeName(), getTypeSizeByName(), lc(), and resolveTypeName().
Referenced by visit().
|
inlineprivate |
Definition at line 2005 of file icode.hpp.
References lc(), recordTypes, and resolveTypeName().
|
inlineprivate |
Definition at line 1835 of file icode.hpp.
References recordTypes.
|
inline |
Definition at line 1538 of file icode.hpp.
References arrayInfo, pascal::CHAR, pascal::DOUBLE, pascal::INT, isRecordTypeName(), lc(), pascal::PTR, pascal::RECORD, resolveTypeName(), and pascal::UNKNOWN.
Referenced by generate(), getExpressionType(), getPointerDerefType(), registerImportedVar(), visit(), visit(), visit(), visit(), and visit().
|
inline |
Definition at line 1522 of file icode.hpp.
References lc(), recordTypes, and resolveTypeName().
Referenced by getPointerElementSize(), visit(), and visit().
|
inlineprivate |
|
inline |
Definition at line 1502 of file icode.hpp.
References pascal::VarDeclNode::type.
|
inlineprivate |
Definition at line 2089 of file icode.hpp.
References currentParamTypes, findMangledName(), resolveTypeName(), and varRecordType.
|
inlineprivate |
Definition at line 2021 of file icode.hpp.
References currentParamTypes, pascal::ArrayInfo::elementType, findMangledName(), getArrayInfoForArrayAccess(), getVarRecordTypeNameFromExpr(), lc(), recordTypes, resolveTypeName(), typeAliases, and varRecordType.
Referenced by getArrayInfoForArrayAccess(), getExpressionType(), getVarRecordTypeNameFromExpr(), visit(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 276 of file icode.hpp.
References findMangledName(), name, slotToType, pascal::UNKNOWN, varSlot, and varTypes.
Referenced by generate(), pascal::IOFunctionHandler::generate(), getExpressionType(), isStringVar(), visit(), visit(), visit(), and visit().
|
inline |
Register all built-in function handlers (IO, Std, SDL, String).
Definition at line 969 of file icode.hpp.
References builtinRegistry.
Referenced by CodeGenVisitor().
|
inlineprivate |
Definition at line 323 of file icode.hpp.
References floatRegInUse, and floatRegisters.
Referenced by CodeGenVisitor().
|
inlineprivate |
Definition at line 578 of file icode.hpp.
References stringLiterals.
Referenced by pascal::FileFunctionHandler::generate(), pascal::IOFunctionHandler::generate(), registerImportedConst(), visit(), and visit().
|
inlineprivate |
Definition at line 2110 of file icode.hpp.
References arrayInfo, lc(), and resolveTypeName().
|
inlineprivate |
Definition at line 1906 of file icode.hpp.
Referenced by coerceToIntImmediate(), evaluateConstantExpression(), foldNumeric(), tryGetConstNumeric(), and visit().
|
inlineprivate |
Definition at line 455 of file icode.hpp.
References floatRegisters, and name.
Referenced by pascal::StdFunctionHandler::generateWithResult(), pushFloatCmpResult(), pushTri(), visit(), visit(), and visit().
|
inlinenodiscard |
Check whether a name refers to an imported unit.
Definition at line 909 of file icode.hpp.
References importedUnitNames, and name.
Referenced by getArrayInfoForArrayAccess(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 1894 of file icode.hpp.
Referenced by tryGetConstNumeric(), and visit().
|
inline |
Definition at line 1305 of file icode.hpp.
Referenced by emit_invoke().
|
inlineprivate |
Definition at line 775 of file icode.hpp.
References name, ptrRegisters, and registers.
Referenced by pascal::FileFunctionHandler::generate(), pascal::IOFunctionHandler::generate(), pascal::FileFunctionHandler::generateWithResult(), pascal::IOFunctionHandler::generateWithResult(), pascal::StdFunctionHandler::generateWithResult(), pascal::StringFunctionHandler::generateWithResult(), pushCmpResult(), pushFloatCmpResult(), pushLogicalAnd(), pushLogicalOr(), pushTri(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), and visit().
|
inlinestaticprivate |
Definition at line 2167 of file icode.hpp.
References pascal::PTR, pascal::RECORD, and pascal::STRING.
|
inlineprivate |
Definition at line 456 of file icode.hpp.
References name, and ptrRegisters.
Referenced by ensurePtrBase(), isReg(), and writeTo().
|
inlineprivate |
Definition at line 288 of file icode.hpp.
Referenced by coerceToIntImmediate().
|
inlineprivate |
Definition at line 210 of file icode.hpp.
Referenced by emit2(), emit_invoke(), ensureFloatConstSymbol(), eval(), pushFloatCmpResult(), pushTri(), registerImportedConst(), visit(), and visit().
|
inline |
Definition at line 1517 of file icode.hpp.
References lc(), recordTypes, and resolveTypeName().
Referenced by getExpressionType(), getTypeFromString(), visit(), visit(), visit(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 457 of file icode.hpp.
References floatRegisters, isPtrReg(), isTempPtr(), name, and registers.
Referenced by pascal::FileFunctionHandler::generate(), pascal::IOFunctionHandler::generate(), pascal::SDLFunctionHandler::generate(), pascal::StdFunctionHandler::generate(), pascal::FileFunctionHandler::generateWithResult(), pascal::IOFunctionHandler::generateWithResult(), pascal::SDLFunctionHandler::generateWithResult(), pascal::StdFunctionHandler::generateWithResult(), pascal::StringFunctionHandler::generateWithResult(), pushCmpResult(), pushLogicalAnd(), pushLogicalOr(), pushTri(), pushValue(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), and visit().
|
inlineprivate |
|
inlineprivate |
Definition at line 307 of file icode.hpp.
References getVarType(), name, pascal::PTR, and pascal::STRING.
|
inlineprivate |
|
inlineprivate |
|
inlinestaticprivate |
Definition at line 1813 of file icode.hpp.
Referenced by buildArrayInfoFromNode(), generate(), getArrayElementSize(), getArrayInfoForArrayAccess(), getExpressionType(), getPointerElementSize(), getRecordFieldOffsetAndSize(), getTypeFromString(), getTypeSizeByName(), getVarRecordTypeNameFromExpr(), isArrayTypeName(), isRecordTypeName(), resolveTypeName(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 241 of file icode.hpp.
References mangleWithScope(), and scopeHierarchy.
Referenced by generate(), visit(), visit(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 227 of file icode.hpp.
Referenced by findMangledFuncName(), generate(), getCurrentScopeName(), and mangleVariableName().
|
inline |
Mark a pointer name as allocated (will be freed at scope end).
Definition at line 1280 of file icode.hpp.
References allocatedPtrs.
Referenced by pascal::StringFunctionHandler::generateWithResult().
|
inlineprivate |
Definition at line 473 of file icode.hpp.
References labelCounter.
Referenced by emitArrayBoundsCheck(), emitDynArrayBoundsCheck(), pushCmpResult(), pushFloatCmpResult(), pushLogicalAnd(), pushLogicalOr(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 461 of file icode.hpp.
References name, nextSlot, slotToName, and varSlot.
Referenced by allocateRecordFieldArrays(), generate(), pascal::IOFunctionHandler::generate(), newTemp(), visit(), visit(), visit(), visit(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 472 of file icode.hpp.
References newSlotFor(), nextTemp, and slotVar().
|
inlineprivate |
|
inlineprivate |
Definition at line 681 of file icode.hpp.
References allocReg(), emit1(), emit2(), emitLabel(), freeReg(), isParmReg(), isReg(), newLabel(), and pushValue().
Referenced by visit().
|
inlineprivate |
Definition at line 704 of file icode.hpp.
References allocReg(), emit1(), emit2(), emitLabel(), freeFloatReg(), generateRealConstantName(), isFloatReg(), isParmReg(), isRealNumber(), newLabel(), pushValue(), realConstants, and usedRealConstants.
|
inlineprivate |
Definition at line 735 of file icode.hpp.
References allocReg(), emit1(), emit2(), emitLabel(), freeReg(), isParmReg(), isReg(), newLabel(), and pushValue().
Referenced by visit().
|
inlineprivate |
Definition at line 755 of file icode.hpp.
References allocReg(), emit1(), emit2(), emitLabel(), freeReg(), isParmReg(), isReg(), newLabel(), and pushValue().
Referenced by visit().
|
inlineprivate |
Definition at line 649 of file icode.hpp.
References allocFloatReg(), allocReg(), emit2(), freeReg(), isFloatReg(), isParmReg(), isRealNumber(), isReg(), and pushValue().
|
inlineprivate |
Definition at line 621 of file icode.hpp.
References evalStack, isReg(), recordLocation(), and pascal::CodeGenVisitor::ValueLocation::REGISTER.
Referenced by pascal::FileFunctionHandler::generateWithResult(), pascal::IOFunctionHandler::generateWithResult(), pascal::SDLFunctionHandler::generateWithResult(), pascal::StdFunctionHandler::generateWithResult(), pascal::StringFunctionHandler::generateWithResult(), pushCmpResult(), pushFloatCmpResult(), pushLogicalAnd(), pushLogicalOr(), pushTri(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 647 of file icode.hpp.
References valueLocations.
Referenced by pascal::IOFunctionHandler::generate(), pushValue(), and visit().
|
inline |
Register a function or procedure as originating from an external unit.
When generating code for a program that imports units, the compiler needs to emit qualified MXVM object references (e.g. MathUtils.FUNC_Add) for cross-object calls. This method records the mapping so that the code generator can prefix call targets and parameter/return registers with the correct object name.
| funcName | Unqualified function or procedure name |
| unitName | Name of the unit that defines the function |
Definition at line 903 of file icode.hpp.
References externalFuncs, and importedUnitNames.
Referenced by compileFile().
|
inline |
Register imported constant values from a dependency unit.
Definition at line 914 of file icode.hpp.
References pascal::ConstDeclNode::assignments, compileTimeConstants, ensureFloatConstSymbol(), evaluateConstantExpression(), importedUnitNames, internString(), isRealNumber(), and realConstants.
Referenced by compileFile().
|
inline |
Register imported variable metadata from a dependency unit (no alloc emitted).
Definition at line 940 of file icode.hpp.
References arrayInfo, buildArrayInfoFromNode(), getTypeFromString(), pascal::VarDeclNode::identifiers, importedArrayInfo, importedUnitNames, importedVarTypes, pascal::PTR, setVarType(), and pascal::VarDeclNode::type.
Referenced by compileFile().
|
inlineprivate |
Definition at line 489 of file icode.hpp.
References allTempPtrs, and tempPtrInUse.
Referenced by freeReg().
|
inlineprivate |
Definition at line 1819 of file icode.hpp.
References lc(), and typeAliases.
Referenced by buildArrayInfoFromNode(), generate(), getArrayElementSize(), getArrayInfoForArrayAccess(), getExpressionType(), getPointerElementSize(), getRecordFieldOffsetAndSize(), getTypeFromString(), getTypeSizeByName(), getVarRecordTypeName(), getVarRecordTypeNameFromExpr(), isArrayTypeName(), isRecordTypeName(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), and visit().
|
inlineprivate |
Definition at line 306 of file icode.hpp.
References slotToType.
Referenced by allocateRecordFieldArrays(), generate(), visit(), visit(), visit(), visit(), visit(), and visit().
|
inlineprivate |
|
inlineprivate |
Definition at line 372 of file icode.hpp.
References floatRegisters, registers, and slotToName.
Referenced by allocateRecordFieldArrays(), generate(), pascal::FileFunctionHandler::generate(), pascal::IOFunctionHandler::generate(), newTemp(), storageSymbolFor(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), and writeTo().
|
inline |
|
inlineprivate |
Definition at line 1914 of file icode.hpp.
References compileTimeConstants, findMangledName(), isFloatLiteral(), isIntegerLiteral(), and name.
Referenced by foldNumeric(), and visit().
|
inline |
Definition at line 1791 of file icode.hpp.
References constInitialValues.
Referenced by allocateRecordFieldArrays(), visit(), visit(), and visit().
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 2566 of file icode_visit.cpp.
References allocTempPtr(), emit2(), findMangledName(), pascal::AddressOfNode::operand, and pushValue().
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 2228 of file icode_visit.cpp.
References allocFloatReg(), allocReg(), allocTempPtr(), pascal::ArrayAccessNode::base, pascal::DOUBLE, pascal::ArrayInfo::elementIsArray, pascal::ArrayInfo::elementSize, pascal::ArrayInfo::elementType, emit2(), emit4(), ensurePtrBase(), eval(), findMangledArrayName(), freeReg(), getArrayInfoForArrayAccess(), getArrayNameFromBase(), getExpressionType(), getRecordFieldOffsetAndSize(), getVarRecordTypeNameFromExpr(), pascal::ArrayAccessNode::index, isImportedUnit(), isParmReg(), isRecordTypeName(), isReg(), pascal::ArrayInfo::lowerBound, popValue(), pascal::PTR, pushValue(), storageSymbolFor(), and pascal::STRING.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 2154 of file icode_visit.cpp.
References allocFloatReg(), allocReg(), arrayInfo, pascal::ArrayAssignmentNode::arrayName, pascal::DOUBLE, dynArrayLenSlot, pascal::ArrayInfo::elementSize, pascal::ArrayInfo::elementType, emit2(), emit4(), emitArrayBoundsCheck(), emitDynArrayBoundsCheck(), ensurePtrBase(), eval(), freeReg(), getExpressionType(), pascal::ArrayAssignmentNode::index, pascal::INT, pascal::ArrayInfo::isDynamic, isFloatReg(), isParmReg(), isRecordTypeName(), isReg(), pascal::ArrayInfo::lowerBound, pascal::PTR, pascal::RECORD, slotVar(), storageSymbolFor(), pascal::ArrayInfo::upperBound, and pascal::ArrayAssignmentNode::value.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 1677 of file icode_visit.cpp.
References arrayInfo, pascal::ArrayDeclarationNode::arrayType, pascal::ArrayInfo::elementSize, pascal::ArrayInfo::elementType, emit3(), evaluateConstantExpression(), findMangledName(), functionScopedArrays, getArrayElementSize(), getCurrentScopeName(), globalArrays, isRecordTypeName(), pascal::ArrayInfo::lowerBound, pascal::ArrayDeclarationNode::name, newSlotFor(), pascal::PTR, recordTypes, setSlotType(), setVarType(), pascal::ArrayInfo::size, slotVar(), updateDataSectionInitialValue(), pascal::ArrayInfo::upperBound, and varSlot.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 2482 of file icode_visit.cpp.
References arrayInfo, pascal::ArrayTypeDeclarationNode::arrayType, buildArrayInfoFromNode(), lc(), pascal::ArrayTypeDeclarationNode::name, and resolveTypeName().
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 1673 of file icode_visit.cpp.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 1831 of file icode_visit.cpp.
References allocatedPtrs, allocFloatReg(), allocReg(), allocTempPtr(), pascal::CHAR, currentFunctionName, currentFunctionReturnSlot, currentParamLocations, pascal::DOUBLE, dynArrayLenSlot, pascal::ArrayInfo::elementSize, pascal::ArrayInfo::elementType, emit1(), emit2(), emit4(), emitArrayBoundsCheck(), emitDynArrayBoundsCheck(), emitLabel(), ensurePtrBase(), escapedTempPtrs, eval(), pascal::AssignmentNode::expression, findMangledArrayName(), findMangledName(), freeReg(), functionSetReturn, getArrayInfoForArrayAccess(), getArrayNameFromBase(), getExpressionType(), getRecordFieldOffsetAndSize(), getTypeFromString(), getVarRecordTypeName(), getVarRecordTypeNameFromExpr(), getVarType(), pascal::INT, pascal::ArrayInfo::isDynamic, isFloatReg(), isImportedUnit(), isParmReg(), isReg(), isTempPtr(), lc(), pascal::ArrayInfo::lowerBound, pascal::CodeGenVisitor::ValueLocation::MEMORY, pascal::VariableNode::name, newLabel(), newSlotFor(), popValue(), pascal::PTR, pascal::RECORD, recordLocation(), recordTypes, resolveTypeName(), setSlotType(), setVars, slotVar(), storageSymbolFor(), pascal::STRING, pascal::ArrayInfo::upperBound, pascal::AssignmentNode::variable, varSlot, visit(), and withFieldScopes.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 1141 of file icode_visit.cpp.
References allocFloatReg(), allocReg(), allocTempPtr(), pascal::BinaryOpNode::AND, pascal::BinaryOpNode::DIV, pascal::BinaryOpNode::DIVIDE, pascal::DOUBLE, emit(), emit1(), emit2(), emit3(), emit4(), emit_invoke(), emitLabel(), ensureFloatConstSymbol(), pascal::BinaryOpNode::EQUAL, eval(), findMangledName(), foldNumeric(), freeReg(), getExpressionType(), pascal::BinaryOpNode::GREATER, pascal::BinaryOpNode::GREATER_EQUAL, pascal::BinaryOpNode::IN, isFloatLiteral(), isFloatReg(), isIntegerLiteral(), isParmReg(), isReg(), pascal::BinaryOpNode::left, pascal::BinaryOpNode::LESS, pascal::BinaryOpNode::LESS_EQUAL, pascal::BinaryOpNode::MINUS, pascal::BinaryOpNode::MOD, pascal::BinaryOpNode::MULTIPLY, newLabel(), pascal::BinaryOpNode::NOT_EQUAL, pascal::BinaryOpNode::operator_, pascal::BinaryOpNode::OR, pascal::BinaryOpNode::PLUS, pascal::PTR, pushCmpResult(), pushLogicalAnd(), pushLogicalOr(), pushValue(), pascal::BinaryOpNode::right, setVars, pascal::STRING, tryGetConstNumeric(), and usedModules.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 90 of file icode_visit.cpp.
References pascal::BlockNode::compoundStatement, pascal::BlockNode::declarations, and generatingDeferredCode.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 1544 of file icode_visit.cpp.
References pushValue(), and pascal::BooleanNode::value.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 2516 of file icode_visit.cpp.
References emit1(), and loopEndLabels.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 1625 of file icode_visit.cpp.
References pascal::CaseStmtNode::branches, pascal::CHAR, pascal::CaseStmtNode::elseStatement, emit1(), emit2(), emitLabel(), eval(), pascal::CaseStmtNode::expression, freeReg(), getExpressionType(), pascal::INT, isParmReg(), isReg(), and newLabel().
|
overridevirtual |
Visit a compound statement block, freeing temporary pointers after each statement.
Snapshots the set of allocated temporary pointers before each statement and emits free instructions for any new temporaries that were not "escaped" (assigned to a named variable). This prevents memory leaks from intermediate string concatenation results and other temporary heap allocations.
Implements pascal::ASTVisitor.
Definition at line 1010 of file icode_visit.cpp.
References allocatedPtrs, declaredProcs, emit(), emit1(), escapedTempPtrs, externalFuncs, findMangledFuncName(), funcSignatures, and pascal::CompoundStmtNode::statements.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 1552 of file icode_visit.cpp.
References pascal::ConstDeclNode::assignments, compileTimeConstants, pascal::DOUBLE, emit2(), ensureFloatConstSymbol(), eval(), evaluateConstantExpression(), freeReg(), getExpressionType(), pascal::INT, internString(), isParmReg(), isRealNumber(), isReg(), mangleVariableName(), newSlotFor(), prolog, pascal::PTR, realConstants, setSlotType(), setVarType(), slotVar(), and updateDataSectionInitialValue().
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 2522 of file icode_visit.cpp.
References emit1(), and loopContinueLabels.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 1548 of file icode_visit.cpp.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 2656 of file icode_visit.cpp.
References compileTimeConstants, enumConstants, enumTypes, lc(), typeAliases, pascal::EnumTypeDeclNode::typeName, and pascal::EnumTypeDeclNode::values.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 2488 of file icode_visit.cpp.
References currentFunctionName, pascal::DOUBLE, emit(), emit1(), emit2(), eval(), pascal::ExitNode::expr, freeReg(), functionSetReturn, getCurrentEndLabel(), getVarType(), isParmReg(), isReg(), pascal::PTR, pascal::RECORD, pascal::STRING, and pascal::UNKNOWN.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 1733 of file icode_visit.cpp.
References allocFloatReg(), allocReg(), allocTempPtr(), compileTimeConstants, pascal::DOUBLE, emit2(), emit4(), ensurePtrBase(), externalFuncs, pascal::FieldAccessNode::fieldName, findMangledName(), getTypeFromString(), getVarRecordTypeName(), getVarRecordTypeNameFromExpr(), getVarType(), isImportedUnit(), isRecordTypeName(), lc(), popValue(), pascal::PTR, pushValue(), pascal::FieldAccessNode::recordExpr, recordTypes, resolveTypeName(), pascal::STRING, and visit().
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 1094 of file icode_visit.cpp.
References coerceToIntImmediate(), emit1(), emit2(), emitLabel(), pascal::ForStmtNode::endValue, eval(), freeReg(), pascal::ForStmtNode::isDownto, isParmReg(), isReg(), loopContinueLabels, loopEndLabels, mangleVariableName(), newLabel(), newSlotFor(), slotVar(), pascal::ForStmtNode::startValue, pascal::ForStmtNode::statement, and pascal::ForStmtNode::variable.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 727 of file icode_visit.cpp.
References allocFloatReg(), allocReg(), allocTempPtr(), pascal::FuncCallNode::arguments, arrayInfo, builtinRegistry, currentFuncLocalSlots, pascal::DOUBLE, dynArrayLenSlot, emit1(), emit2(), eval(), externalFuncs, findMangledArrayName(), findMangledFuncName(), floatRegisters, freeReg(), funcSignatures, getExpressionType(), pascal::INT, isParmReg(), isReg(), pascal::FuncCallNode::name, pascal::PTR, ptrRegisters, pushValue(), pascal::RECORD, regInUse, registers, slotVar(), and pascal::STRING.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 899 of file icode_visit.cpp.
References pascal::FuncDeclNode::block, declaredFuncs, deferredFuncs, funcSignatures, getTypeFromString(), mangleVariableName(), pascal::FuncDeclNode::name, pascal::FuncDeclNode::parameters, pascal::CodeGenVisitor::FuncInfo::paramTypes, pascal::CodeGenVisitor::FuncInfo::returnType, pascal::FuncDeclNode::returnType, scopeHierarchy, and setVarType().
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 2597 of file icode_visit.cpp.
References emit1(), gotoLabels, pascal::GotoStmtNode::label, and newLabel().
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 1050 of file icode_visit.cpp.
References pascal::IfStmtNode::condition, pascal::IfStmtNode::elseStatement, emit1(), emit2(), emitLabel(), eval(), freeReg(), isParmReg(), isReg(), newLabel(), and pascal::IfStmtNode::thenStatement.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 2609 of file icode_visit.cpp.
References emitLabel(), gotoLabels, pascal::LabelStmtNode::label, newLabel(), and pascal::LabelStmtNode::statement.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 2528 of file icode_visit.cpp.
References pushValue().
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 1529 of file icode_visit.cpp.
References allocFloatReg(), emit2(), ensureFloatConstSymbol(), pascal::NumberNode::isReal, isRealNumber(), pushValue(), and pascal::NumberNode::value.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 967 of file icode_visit.cpp.
References currentParamTypes, pascal::DOUBLE, pascal::ParameterNode::identifiers, pascal::INT, lc(), newSlotFor(), pascal::PTR, pascal::RECORD, recordTypes, resolveTypeName(), setSlotType(), setVarType(), pascal::STRING, pascal::ParameterNode::type, and varRecordType.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 2536 of file icode_visit.cpp.
References allocFloatReg(), allocReg(), allocTempPtr(), pascal::DOUBLE, emit4(), ensurePtrBase(), eval(), freeReg(), getPointerDerefType(), pascal::INT, isParmReg(), isReg(), pascal::PointerDerefNode::pointer, pascal::PTR, pushValue(), and pascal::STRING.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 2532 of file icode_visit.cpp.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 346 of file icode_visit.cpp.
References allocReg(), allocTempPtr(), pascal::ProcCallNode::arguments, arrayInfo, builtinRegistry, currentFuncLocalSlots, pascal::DOUBLE, dynArrayLenSlot, pascal::ArrayInfo::elementSize, pascal::ArrayInfo::elementType, emit1(), emit2(), emit3(), emit4(), ensurePtrBase(), eval(), externalFuncs, findMangledArrayName(), findMangledFuncName(), findMangledName(), floatRegisters, freeReg(), funcSignatures, getArrayInfoForArrayAccess(), getArrayNameFromBase(), getExpressionType(), getPointerBaseTypeName(), getPointerElementSize(), getTypeSizeByName(), getVarRecordTypeName(), getVarRecordTypeNameFromExpr(), isParmReg(), isRecordTypeName(), isReg(), lc(), pascal::ArrayInfo::lowerBound, pascal::ProcCallNode::name, popValue(), pascal::PTR, ptrRegisters, pascal::RECORD, recordTypes, regInUse, registers, resolveTypeName(), slotVar(), storageSymbolFor(), and pascal::STRING.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 936 of file icode_visit.cpp.
References pascal::ProcDeclNode::block, declaredProcs, deferredProcs, mangleVariableName(), pascal::ProcDeclNode::name, and scopeHierarchy.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 17 of file icode_visit.cpp.
References pascal::ProgramNode::block, name, pascal::ProgramNode::name, objectDeps, usedModules, and pascal::ProgramNode::uses.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 2323 of file icode_visit.cpp.
References pascal::CodeGenVisitor::RecordField::arrayInfo, buildArrayInfoFromNode(), pascal::ArrayInfo::elementSize, pascal::CodeGenVisitor::RecordTypeInfo::fields, getTypeSizeByName(), pascal::CodeGenVisitor::RecordField::isArray, isRecordTypeName(), lc(), pascal::CodeGenVisitor::RecordField::name, pascal::RecordDeclarationNode::name, pascal::CodeGenVisitor::RecordTypeInfo::nameToIndex, pascal::CodeGenVisitor::RecordField::offset, pascal::RecordDeclarationNode::recordType, recordTypes, resolveTypeName(), pascal::ArrayInfo::size, pascal::CodeGenVisitor::RecordField::size, pascal::CodeGenVisitor::RecordTypeInfo::size, typeAliases, and pascal::CodeGenVisitor::RecordField::typeName.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 2319 of file icode_visit.cpp.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 1602 of file icode_visit.cpp.
References pascal::RepeatStmtNode::condition, emit1(), emit2(), emitLabel(), eval(), freeReg(), isParmReg(), isReg(), loopContinueLabels, loopEndLabels, newLabel(), and pascal::RepeatStmtNode::statements.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 2623 of file icode_visit.cpp.
References allocReg(), allocTempPtr(), pascal::SetLiteralNode::elements, emit1(), emit2(), emit3(), emit4(), emitLabel(), eval(), freeReg(), isParmReg(), isReg(), newLabel(), and pushValue().
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 2652 of file icode_visit.cpp.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 2478 of file icode_visit.cpp.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 1539 of file icode_visit.cpp.
References internString(), pushValue(), and pascal::StringNode::value.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 961 of file icode_visit.cpp.
References pascal::TypeAliasNode::baseType, lc(), typeAliases, and pascal::TypeAliasNode::typeName.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 2472 of file icode_visit.cpp.
References pascal::TypeDeclNode::typeDeclarations.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 1439 of file icode_visit.cpp.
References allocReg(), emit(), emit2(), eval(), pascal::UnaryOpNode::MINUS, pascal::UnaryOpNode::NOT, pascal::UnaryOpNode::operand, pascal::UnaryOpNode::operator_, pascal::UnaryOpNode::PLUS, and pushValue().
|
overridevirtual |
Generate MXVM object code from a Pascal unit.
Implements pascal::ASTVisitor.
Definition at line 34 of file icode_visit.cpp.
References emit(), emitLabel(), funcSignatures, getTypeFromString(), pascal::UnitNode::implDecls, pascal::UnitNode::interfaceDecls, isUnit, name, pascal::UnitNode::name, objectDeps, pascal::CodeGenVisitor::FuncInfo::paramTypes, pascal::CodeGenVisitor::FuncInfo::returnType, setVarType(), usedModules, and pascal::UnitNode::uses.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 119 of file icode_visit.cpp.
References allocateRecordFieldArrays(), allocReg(), arrayInfo, buildArrayInfoFromNode(), currentFuncLocalSlots, currentFunctionName, pascal::DOUBLE, dynArrayLenSlot, emit1(), emit2(), emit3(), emit4(), emitLabel(), fileVarNames, fileVars, freeReg(), functionScopedArrays, getCurrentScopeName(), getTypeFromString(), globalArrays, pascal::VarDeclNode::identifiers, pascal::INT, lc(), mangleVariableName(), newLabel(), newSlotFor(), pointerBaseType, pascal::PTR, pascal::RECORD, recordsToFreeInScope, recordTypes, resolveTypeName(), setSlotType(), setVars, setVarType(), slotVar(), pascal::VarDeclNode::type, updateDataSectionInitialValue(), varRecordType, and varSlot.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 1461 of file icode_visit.cpp.
References compileTimeConstants, currentFunctionName, currentFunctionReturnSlot, currentParamLocations, pascal::DOUBLE, externalFuncs, findMangledName(), funcSignatures, getVarType(), pascal::INT, lc(), pascal::VariableNode::name, newSlotFor(), pascal::PTR, pushValue(), pascal::RECORD, setSlotType(), slotVar(), pascal::STRING, varSlot, visit(), and withFieldScopes.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 1075 of file icode_visit.cpp.
References pascal::WhileStmtNode::condition, emit1(), emit2(), emitLabel(), eval(), freeReg(), isParmReg(), isReg(), loopContinueLabels, loopEndLabels, newLabel(), and pascal::WhileStmtNode::statement.
|
overridevirtual |
Implements pascal::ASTVisitor.
Definition at line 2577 of file icode_visit.cpp.
References getVarRecordTypeName(), lc(), recordTypes, pascal::WithStmtNode::recordVar, resolveTypeName(), pascal::WithStmtNode::statement, and withFieldScopes.
|
inline |
Write the complete MXVM program to a stream.
| out | Output stream |
Emits the program header, module section, data section (registers, variables, string literals, real constants), and code section.
Definition at line 1324 of file icode.hpp.
References allTempPtrs, bufferStringVars, pascal::CHAR, constInitialValues, pascal::DOUBLE, endsWithColon(), escapeStringForMxvm(), floatRegisters, instructions, isPtrReg(), isRegisterSlot(), isTempVar(), isUnit, name, needsEmptyString, nextSlot, objectDeps, prolog, pascal::PTR, ptrRegisters, realConstants, registers, slotToType, slotVar(), pascal::STRING, stringLiterals, tempPtrByScope, usedModules, and usedStrings.
Referenced by compileFile().
|
friend |
Definition at line 887 of file icode.hpp.
References FileFunctionHandler.
Referenced by FileFunctionHandler.
|
friend |
Definition at line 882 of file icode.hpp.
References IOFunctionHandler.
Referenced by IOFunctionHandler.
|
friend |
Definition at line 883 of file icode.hpp.
References MathFunctionHandler.
Referenced by MathFunctionHandler.
|
friend |
Definition at line 885 of file icode.hpp.
References SDLFunctionHandler.
Referenced by SDLFunctionHandler.
|
friend |
Definition at line 884 of file icode.hpp.
References StdFunctionHandler.
Referenced by StdFunctionHandler.
|
friend |
Definition at line 886 of file icode.hpp.
References StringFunctionHandler.
Referenced by StringFunctionHandler.
|
private |
Definition at line 1794 of file icode.hpp.
Referenced by emit3(), emitFree(), generate(), markAllocatedPtr(), visit(), and visit().
|
private |
Definition at line 205 of file icode.hpp.
Referenced by allocTempPtr(), freeTempPtr(), isTempPtr(), releaseTempPtr(), and writeTo().
|
private |
Definition at line 1799 of file icode.hpp.
Referenced by generate(), getArrayInfoForArrayAccess(), getTypeFromString(), isArrayTypeName(), registerImportedVar(), visit(), visit(), visit(), visit(), visit(), and visit().
|
private |
| BuiltinFunctionRegistry pascal::CodeGenVisitor::builtinRegistry |
registry of built-in function handlers
Definition at line 889 of file icode.hpp.
Referenced by getExpressionType(), initializeBuiltins(), visit(), and visit().
|
private |
Definition at line 180 of file icode.hpp.
Referenced by evaluateConstantExpression(), generate(), registerImportedConst(), tryGetConstNumeric(), visit(), visit(), visit(), and visit().
|
private |
Definition at line 201 of file icode.hpp.
Referenced by updateDataSectionInitialValue(), and writeTo().
|
private |
|
private |
Definition at line 332 of file icode.hpp.
Referenced by generate(), getCurrentEndLabel(), visit(), visit(), visit(), and visit().
|
private |
slot variable that holds the return value until FUNC_END
Definition at line 333 of file icode.hpp.
Referenced by generate(), visit(), and visit().
|
private |
Definition at line 203 of file icode.hpp.
Referenced by generate(), visit(), and visit().
|
private |
Definition at line 183 of file icode.hpp.
Referenced by generate(), getVarRecordTypeName(), getVarRecordTypeNameFromExpr(), and visit().
|
private |
Definition at line 350 of file icode.hpp.
Referenced by findMangledFuncName(), generate(), getCurrentEndLabel(), and visit().
|
private |
Definition at line 349 of file icode.hpp.
Referenced by findMangledFuncName(), getCurrentEndLabel(), visit(), and visit().
|
private |
Definition at line 331 of file icode.hpp.
Referenced by generate(), getCurrentScopeName(), and visit().
|
private |
Definition at line 204 of file icode.hpp.
Referenced by generate(), and visit().
|
private |
| std::unordered_map<std::string, int> pascal::CodeGenVisitor::enumConstants |
| std::unordered_map<std::string, std::vector<std::string> > pascal::CodeGenVisitor::enumTypes |
|
private |
Definition at line 1795 of file icode.hpp.
Referenced by generate(), visit(), and visit().
|
private |
Definition at line 343 of file icode.hpp.
Referenced by eval(), popValue(), and pushValue().
|
private |
| std::unordered_map<std::string, std::string> pascal::CodeGenVisitor::fileVarNames |
Maps file variable name to companion filename variable name.
Definition at line 1500 of file icode.hpp.
Referenced by pascal::FileFunctionHandler::generate(), and visit().
| std::unordered_set<std::string> pascal::CodeGenVisitor::fileVars |
Set of variable names that are file types (pointer to FILE).
Definition at line 1498 of file icode.hpp.
Referenced by pascal::IOFunctionHandler::generate(), and visit().
|
private |
Definition at line 320 of file icode.hpp.
Referenced by allocFloatReg(), expandFloatRegisters(), freeFloatReg(), generate(), and initializeFloatRegisters().
|
private |
Definition at line 319 of file icode.hpp.
Referenced by allocFloatReg(), expandFloatRegisters(), freeFloatReg(), generate(), initializeFloatRegisters(), isFloatReg(), isReg(), slotVar(), visit(), visit(), and writeTo().
|
private |
|
private |
Definition at line 192 of file icode.hpp.
Referenced by allocateRecordFieldArrays(), generate(), visit(), and visit().
|
private |
Definition at line 335 of file icode.hpp.
Referenced by generate(), visit(), and visit().
|
private |
Definition at line 351 of file icode.hpp.
Referenced by generate(), getCurrentScopeName(), and visit().
|
private |
Definition at line 191 of file icode.hpp.
Referenced by allocateRecordFieldArrays(), generate(), visit(), and visit().
|
private |
|
private |
array metadata for imported unit vars
Definition at line 189 of file icode.hpp.
Referenced by generate(), and registerImportedVar().
|
private |
names of units imported via uses clause
Definition at line 188 of file icode.hpp.
Referenced by isImportedUnit(), registerExternalFunc(), registerImportedConst(), and registerImportedVar().
|
private |
var types for imported unit vars
Definition at line 190 of file icode.hpp.
Referenced by generate(), and registerImportedVar().
|
private |
Definition at line 342 of file icode.hpp.
Referenced by emit(), emit3(), emitLabel(), generate(), and writeTo().
|
private |
true when generating code for a unit (object output)
Definition at line 186 of file icode.hpp.
Referenced by generate(), visit(), and writeTo().
|
private |
Definition at line 338 of file icode.hpp.
Referenced by newLabel().
|
private |
|
private |
| std::string pascal::CodeGenVisitor::name = "App" |
program name emitted in the output header
Definition at line 977 of file icode.hpp.
Referenced by allocReg(), findMangledArrayName(), findMangledFuncName(), findMangledName(), funcLabel(), generate(), getVarType(), isFloatReg(), isImportedUnit(), isParmReg(), isPtrReg(), isReg(), isStringVar(), isTempPtr(), isTempVar(), newSlotFor(), setVarType(), tryGetConstNumeric(), visit(), visit(), and writeTo().
|
private |
Definition at line 273 of file icode.hpp.
Referenced by emptyString(), and writeTo().
|
private |
Definition at line 336 of file icode.hpp.
Referenced by newSlotFor(), and writeTo().
|
private |
Definition at line 315 of file icode.hpp.
Referenced by allocReg().
|
private |
Definition at line 337 of file icode.hpp.
Referenced by allocTempPtr(), and newTemp().
|
private |
|
private |
Definition at line 2003 of file icode.hpp.
Referenced by generate(), getPointerBaseTypeName(), and visit().
|
private |
Definition at line 341 of file icode.hpp.
Referenced by generate(), visit(), and writeTo().
|
private |
Definition at line 329 of file icode.hpp.
Referenced by CodeGenVisitor(), allocPtrReg(), freePtrReg(), and generate().
|
private |
Definition at line 317 of file icode.hpp.
Referenced by CodeGenVisitor(), allocPtrReg(), freePtrReg(), generate(), isParmReg(), isPtrReg(), visit(), visit(), and writeTo().
|
private |
Definition at line 182 of file icode.hpp.
Referenced by generateRealConstantName().
|
private |
Definition at line 1797 of file icode.hpp.
Referenced by coerceToIntImmediate(), ensureFloatConstSymbol(), generate(), pushFloatCmpResult(), registerImportedConst(), visit(), and writeTo().
|
private |
Definition at line 347 of file icode.hpp.
Referenced by generate(), and visit().
|
private |
Definition at line 2001 of file icode.hpp.
Referenced by allocateRecordFieldArrays(), generate(), getArrayElementSize(), getArrayInfoForArrayAccess(), getExpressionType(), getRecordFieldOffsetAndSize(), getRecordTypeSize(), getTypeSizeByName(), getVarRecordTypeNameFromExpr(), isRecordTypeName(), visit(), visit(), visit(), visit(), visit(), visit(), visit(), and visit().
|
private |
Definition at line 328 of file icode.hpp.
Referenced by CodeGenVisitor(), allocReg(), freeReg(), generate(), visit(), and visit().
|
private |
Definition at line 316 of file icode.hpp.
Referenced by CodeGenVisitor(), allocReg(), freeReg(), generate(), isParmReg(), isReg(), slotVar(), visit(), visit(), and writeTo().
|
private |
Definition at line 193 of file icode.hpp.
Referenced by findMangledArrayName(), findMangledFuncName(), findMangledName(), generate(), getCurrentScopeName(), mangleVariableName(), visit(), and visit().
|
private |
Definition at line 199 of file icode.hpp.
Referenced by generate().
| std::unordered_set<std::string> pascal::CodeGenVisitor::setVars |
|
private |
Definition at line 346 of file icode.hpp.
Referenced by newSlotFor(), and slotVar().
|
private |
Definition at line 271 of file icode.hpp.
Referenced by ensurePtrBase(), getVarType(), setSlotType(), and writeTo().
|
private |
Definition at line 344 of file icode.hpp.
Referenced by internString(), and writeTo().
|
private |
Definition at line 348 of file icode.hpp.
Referenced by addTempPtr(), allocTempPtr(), generate(), and writeTo().
|
private |
Definition at line 206 of file icode.hpp.
Referenced by allocTempPtr(), freeTempPtr(), and releaseTempPtr().
|
private |
Definition at line 200 of file icode.hpp.
Referenced by buildArrayInfoFromNode(), generate(), getVarRecordTypeNameFromExpr(), resolveTypeName(), visit(), visit(), and visit().
|
private |
Definition at line 184 of file icode.hpp.
Referenced by pascal::FileFunctionHandler::generate(), pascal::IOFunctionHandler::generate(), pascal::SDLFunctionHandler::generate(), pascal::StdFunctionHandler::generate(), pascal::FileFunctionHandler::generateWithResult(), pascal::IOFunctionHandler::generateWithResult(), pascal::SDLFunctionHandler::generateWithResult(), pascal::StdFunctionHandler::generateWithResult(), pascal::StringFunctionHandler::generateWithResult(), visit(), visit(), visit(), and writeTo().
|
private |
Definition at line 181 of file icode.hpp.
Referenced by ensureFloatConstSymbol(), generate(), and pushFloatCmpResult().
|
private |
Definition at line 345 of file icode.hpp.
Referenced by generate(), pascal::IOFunctionHandler::generate(), and writeTo().
|
private |
Definition at line 366 of file icode.hpp.
Referenced by generate(), and recordLocation().
|
private |
Definition at line 2002 of file icode.hpp.
Referenced by generate(), getVarRecordTypeName(), getVarRecordTypeNameFromExpr(), visit(), and visit().
|
private |
Definition at line 340 of file icode.hpp.
Referenced by ensurePtrBase(), findMangledArrayName(), findMangledName(), pascal::FileFunctionHandler::generate(), getVarType(), newSlotFor(), storageSymbolFor(), visit(), visit(), visit(), and visit().
|
private |
Definition at line 270 of file icode.hpp.
Referenced by generate(), getVarType(), and setVarType().
|
private |