|
hoshi-lang dev
Yet another programming language
|
#include <IRLinker.hpp>
Public Member Functions | |
| IRLinker () | |
| std::shared_ptr< IRObjectFile > | link (const std::shared_ptr< compilerContext > &context, indexT entryModuleId) |
| Links all compiled modules from the context into a single IRObjectFile. | |
Private Member Functions | |
| wstr | mangleName (indexT moduleId, const wstr &originalName) |
| Mangles a symbol name with its module ID, unless it's the main function in the entry module. | |
| void | linkStringLiterals () |
| void | linkStructsAndInterfaces () |
| void | linkDataStructs () |
| void | linkInterfaceImplementations () |
| void | linkGlobals () |
| void | linkFunctions () |
| void | linkMetadata () |
| void | createEntryFunction () |
| void | patchIRFFITable () |
| std::tuple< IRValueType::valueType, indexT, indexT > | patchUniqueKey (const std::tuple< IRValueType::valueType, indexT, indexT > &key) |
| std::shared_ptr< IRValueType > | patchType (const std::shared_ptr< IRValueType > &oldType) |
| IR | patchInstruction (const IR &instr, indexT currentModuleId) |
Private Attributes | |
| std::shared_ptr< compilerContext > | compilerCtx |
| std::shared_ptr< IRModule > | finalModule |
| indexT | entryModuleId |
| std::map< indexT, std::map< indexT, indexT > > | structRemapping |
| std::map< indexT, std::map< indexT, indexT > > | datastructRemapping |
| std::map< indexT, std::map< indexT, indexT > > | interfaceRemapping |
| std::map< indexT, std::map< indexT, indexT > > | interfaceImplRemapping |
| std::map< indexT, std::map< indexT, indexT > > | globalRemapping |
| std::map< indexT, std::map< indexT, indexT > > | functionRemapping |
| std::map< indexT, std::map< indexT, indexT > > | stringRemapping |
| yoi::vec< yoi::indexT > | globInitializerIndexes |
Definition at line 16 of file IRLinker.hpp.
|
default |
|
private |
Definition at line 332 of file IRLinker.cpp.
References IRLinker::compilerCtx, IRBuilder::createCodeBlock(), IRBuildConfig::executable, IRLinker::finalModule, IRLinker::globInitializerIndexes, HOSHI_COMPILER_CTX_GLOB_ID_CONST, IROperand::integer, IRBuilder::invokeOp(), yoi::panic(), IR::push_integer, IRBuilder::pushOp(), IRBuilder::retOp(), IRFunctionDefinition::Builder::setDebugInfo(), IRFunctionDefinition::Builder::setName(), IRFunctionDefinition::Builder::setReturnType(), IRBuilder::switchCodeBlock(), IRFunctionDefinition::Unreachable, and IRBuilder::yield().
Referenced by IRLinker::link().


| std::shared_ptr< IRObjectFile > link | ( | const std::shared_ptr< compilerContext > & | context, |
| indexT | entryModuleId | ||
| ) |
Links all compiled modules from the context into a single IRObjectFile.
| context | The compiler context containing all compiled modules. |
| entryModuleId | The ID of the main entry module. |
Definition at line 18 of file IRLinker.cpp.
References IRLinker::compilerCtx, IRLinker::createEntryFunction(), ENTRY_MODULE_ID_CONST, IRLinker::entryModuleId, IRLinker::finalModule, IRLinker::linkDataStructs(), IRLinker::linkFunctions(), IRLinker::linkGlobals(), IRLinker::linkInterfaceImplementations(), IRLinker::linkMetadata(), IRLinker::linkStringLiterals(), IRLinker::linkStructsAndInterfaces(), and IRLinker::patchIRFFITable().
Referenced by IRLinker::linkMetadata(), and main().


|
private |
Definition at line 426 of file IRLinker.cpp.
References IRLinker::compilerCtx, IRLinker::datastructRemapping, IRLinker::finalModule, yoi::managedPtr(), and IRLinker::patchType().
Referenced by IRLinker::link().


|
private |
Definition at line 156 of file IRLinker.cpp.
References IRLinker::compilerCtx, IRLinker::finalModule, IRLinker::functionRemapping, IRLinker::globInitializerIndexes, IRLinker::mangleName(), IRLinker::patchInstruction(), and IRLinker::patchType().
Referenced by IRLinker::link().


|
private |
Definition at line 142 of file IRLinker.cpp.
References IRLinker::compilerCtx, IRLinker::finalModule, IRLinker::globalRemapping, IRLinker::mangleName(), and IRLinker::patchType().
Referenced by IRLinker::link().


|
private |
Definition at line 358 of file IRLinker.cpp.
References IRLinker::finalModule, IRLinker::patchType(), IRLinker::patchUniqueKey(), and virtualMethod.
Referenced by IRLinker::link().


|
private |
Definition at line 412 of file IRLinker.cpp.
References ENTRY_MODULE_ID_CONST, IRLinker::finalModule, IRLinker::interfaceImplRemapping, and IRLinker::link().
Referenced by IRLinker::link().


|
private |
Definition at line 55 of file IRLinker.cpp.
References IRLinker::compilerCtx, IRLinker::finalModule, and IRLinker::stringRemapping.
Referenced by IRLinker::link().

|
private |
Definition at line 67 of file IRLinker.cpp.
References IRLinker::compilerCtx, ENTRY_MODULE_ID_CONST, IRLinker::finalModule, IRLinker::interfaceImplRemapping, IRLinker::interfaceRemapping, IRLinker::mangleName(), IRLinker::patchType(), and IRLinker::structRemapping.
Referenced by IRLinker::link().


Mangles a symbol name with its module ID, unless it's the main function in the entry module.
Definition at line 45 of file IRLinker.cpp.
References IRLinker::entryModuleId.
Referenced by IRLinker::linkFunctions(), IRLinker::linkGlobals(), and IRLinker::linkStructsAndInterfaces().

Definition at line 214 of file IRLinker.cpp.
References IR::construct_interface_impl, IRLinker::datastructRemapping, IR::dyn_cast_any, ENTRY_MODULE_ID_CONST, IRLinker::functionRemapping, IRLinker::globalRemapping, IRLinker::interfaceImplRemapping, IRValueType::interfaceObject, IRLinker::interfaceRemapping, IR::invoke, IR::invoke_dangling, IR::invoke_virtual, IR::load_global, IR::new_array_interface, IR::new_array_struct, IR::new_datastruct, IR::new_dynamic_array_interface, IR::new_dynamic_array_struct, IR::new_struct, IR::opcode, IR::operands, IR::push_string, IR::store_global, IRLinker::stringRemapping, IRValueType::structObject, IRLinker::structRemapping, and IR::typeid_object_non_stack.
Referenced by IRLinker::linkFunctions().

|
private |
Definition at line 366 of file IRLinker.cpp.
References IRLinker::compilerCtx, ENTRY_MODULE_ID_CONST, IRLinker::functionRemapping, and IRLinker::patchType().
Referenced by IRLinker::link().


|
private |
Definition at line 292 of file IRLinker.cpp.
References IRValueType::datastructObject, IRLinker::datastructRemapping, ENTRY_MODULE_ID_CONST, IRLinker::functionRemapping, IRValueType::interfaceObject, IRLinker::interfaceRemapping, yoi::managedPtr(), IRValueType::structObject, IRLinker::structRemapping, and IRValueType::virtualMethod.
Referenced by IRLinker::linkDataStructs(), IRLinker::linkFunctions(), IRLinker::linkGlobals(), IRLinker::linkInterfaceImplementations(), IRLinker::linkStructsAndInterfaces(), and IRLinker::patchIRFFITable().


|
private |
Definition at line 387 of file IRLinker.cpp.
References IRValueType::datastructObject, IRLinker::datastructRemapping, ENTRY_MODULE_ID_CONST, IRLinker::functionRemapping, IRValueType::interfaceObject, IRLinker::interfaceRemapping, IRValueType::structObject, IRLinker::structRemapping, and IRValueType::virtualMethod.
Referenced by IRLinker::linkInterfaceImplementations().

|
private |
Definition at line 29 of file IRLinker.hpp.
Referenced by IRLinker::createEntryFunction(), IRLinker::link(), IRLinker::linkDataStructs(), IRLinker::linkFunctions(), IRLinker::linkGlobals(), IRLinker::linkStringLiterals(), IRLinker::linkStructsAndInterfaces(), and IRLinker::patchIRFFITable().
Definition at line 35 of file IRLinker.hpp.
Referenced by IRLinker::linkDataStructs(), IRLinker::patchInstruction(), IRLinker::patchType(), and IRLinker::patchUniqueKey().
|
private |
Definition at line 31 of file IRLinker.hpp.
Referenced by IRLinker::link(), and IRLinker::mangleName().
|
private |
Definition at line 30 of file IRLinker.hpp.
Referenced by IRLinker::createEntryFunction(), IRLinker::link(), IRLinker::linkDataStructs(), IRLinker::linkFunctions(), IRLinker::linkGlobals(), IRLinker::linkInterfaceImplementations(), IRLinker::linkMetadata(), IRLinker::linkStringLiterals(), and IRLinker::linkStructsAndInterfaces().
Definition at line 39 of file IRLinker.hpp.
Referenced by IRLinker::linkFunctions(), IRLinker::patchInstruction(), IRLinker::patchIRFFITable(), IRLinker::patchType(), and IRLinker::patchUniqueKey().
Definition at line 38 of file IRLinker.hpp.
Referenced by IRLinker::linkGlobals(), and IRLinker::patchInstruction().
|
private |
Definition at line 41 of file IRLinker.hpp.
Referenced by IRLinker::createEntryFunction(), and IRLinker::linkFunctions().
Definition at line 37 of file IRLinker.hpp.
Referenced by IRLinker::linkMetadata(), IRLinker::linkStructsAndInterfaces(), and IRLinker::patchInstruction().
Definition at line 36 of file IRLinker.hpp.
Referenced by IRLinker::linkStructsAndInterfaces(), IRLinker::patchInstruction(), IRLinker::patchType(), and IRLinker::patchUniqueKey().
Definition at line 40 of file IRLinker.hpp.
Referenced by IRLinker::linkStringLiterals(), and IRLinker::patchInstruction().
Definition at line 34 of file IRLinker.hpp.
Referenced by IRLinker::linkStructsAndInterfaces(), IRLinker::patchInstruction(), IRLinker::patchType(), and IRLinker::patchUniqueKey().