hoshi-lang dev
Yet another programming language
Loading...
Searching...
No Matches
compilerContext Class Reference

#include <compilerContext.h>

Inheritance diagram for compilerContext:
Collaboration diagram for compilerContext:

Public Member Functions

 compilerContext ()=default
 
 compilerContext (const compilerContext &context)=default
 
std::shared_ptr< IRModulegetImportedModule (yoi::indexT index)
 
std::shared_ptr< yoi::moduleContextgetModuleContext (yoi::indexT index)
 get module context by index
 
std::shared_ptr< IRModulegetImportedModule (const yoi::wstr &modRealPath)
 
const std::map< yoi::indexT, std::shared_ptr< IRModule > > & getCompiledModules () const
 
yoi::indexT getModuleIndexByRealPath (const yoi::wstr &modRealPath)
 
yoi::indexT compileModule (const yoi::wstr &filepath)
 
const std::shared_ptr< IRObjectFile > & getIRObjectFile () const
 
void setIRObjectFile (const std::shared_ptr< IRObjectFile > &irObjectFile)
 
void initializeSharedObjects ()
 
std::shared_ptr< yoi::IRValueTypegetIntObjectType (bool forceRawAttr=false)
 
std::shared_ptr< yoi::IRValueTypegetBoolObjectType (bool forceRawAttr=false)
 
std::shared_ptr< yoi::IRValueTypegetDeciObjectType (bool forceRawAttr=false)
 
std::shared_ptr< yoi::IRValueTypegetStrObjectType (bool forceRawAttr=false)
 
std::shared_ptr< yoi::IRValueTypegetCharObjectType (bool forceRawAttr=false)
 
std::shared_ptr< yoi::IRValueTypegetShortObjectType (bool forceRawAttr=false)
 
std::shared_ptr< yoi::IRValueTypegetUnsignedObjectType (bool forceRawAttr=false)
 
std::shared_ptr< yoi::IRValueTypegetNoneObjectType ()
 
std::shared_ptr< yoi::IRValueTypegetForeignInt32ObjectType ()
 
std::shared_ptr< yoi::IRValueTypegetForeignFloatObjectType ()
 
std::shared_ptr< yoi::IRValueTypegetPointerType ()
 
std::shared_ptr< yoi::IRValueTypegetNullInterfaceType ()
 
yoi::IRValueType normalizeForeignBasicType (const std::shared_ptr< yoi::IRValueType > &type, bool handlePointer=true)
 
std::shared_ptr< IRBuildConfiggetBuildConfig () const
 
void setBuildConfig (const std::shared_ptr< IRBuildConfig > &buildConfig)
 
std::shared_ptr< IRFFITablegetIRFFITable ()
 
void runOptimizer ()
 
 ~compilerContext ()
 

Private Attributes

yoi::indexTable< yoi::wstr, std::shared_ptr< yoi::moduleContext > > modules
 
yoi::indexTable< yoi::wstr, std::shared_ptr< IRValueType > > sharedValueType
 
std::map< yoi::indexT, std::shared_ptr< IRModule > > moduleImported
 
std::shared_ptr< IRObjectFileirObjectFile
 
std::shared_ptr< IRBuildConfigbuildConfig
 
std::shared_ptr< IRFFITableirFFITable
 
std::shared_ptr< BuiltinModuleBuilderbuiltinModuleBuilder
 
std::set< hoshiModule * > astToFinalize
 
std::shared_ptr< moduleContextbuiltinModuleContext
 

Detailed Description

Definition at line 35 of file compilerContext.h.

Constructor & Destructor Documentation

◆ compilerContext() [1/2]

compilerContext ( )
default

◆ compilerContext() [2/2]

compilerContext ( const compilerContext context)
default

◆ ~compilerContext()

Definition at line 199 of file compilerContext.cpp.

References compilerContext::astToFinalize, and yoi::finalizeAST().

Here is the call graph for this function:

Member Function Documentation

◆ compileModule()

◆ getBoolObjectType()

std::shared_ptr< yoi::IRValueType > getBoolObjectType ( bool  forceRawAttr = false)

Definition at line 145 of file compilerContext.cpp.

References compilerContext::builtinModuleBuilder, and yoi::managedPtr().

Here is the call graph for this function:

◆ getBuildConfig()

std::shared_ptr< IRBuildConfig > getBuildConfig ( ) const

Definition at line 170 of file compilerContext.cpp.

References compilerContext::buildConfig.

◆ getCharObjectType()

std::shared_ptr< yoi::IRValueType > getCharObjectType ( bool  forceRawAttr = false)

Definition at line 157 of file compilerContext.cpp.

References compilerContext::builtinModuleBuilder, and yoi::managedPtr().

Here is the call graph for this function:

◆ getCompiledModules()

const std::map< indexT, std::shared_ptr< IRModule > > & getCompiledModules ( ) const

Get all compiled IR modules.

Returns
A map from module ID to the IRModule.

Definition at line 35 of file compilerContext.cpp.

References compilerContext::moduleImported.

◆ getDeciObjectType()

std::shared_ptr< yoi::IRValueType > getDeciObjectType ( bool  forceRawAttr = false)

Definition at line 149 of file compilerContext.cpp.

References compilerContext::builtinModuleBuilder, and yoi::managedPtr().

Referenced by compilerContext::normalizeForeignBasicType().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getForeignFloatObjectType()

std::shared_ptr< yoi::IRValueType > getForeignFloatObjectType ( )

Definition at line 187 of file compilerContext.cpp.

References compilerContext::builtinModuleBuilder.

◆ getForeignInt32ObjectType()

std::shared_ptr< yoi::IRValueType > getForeignInt32ObjectType ( )

Definition at line 183 of file compilerContext.cpp.

References compilerContext::builtinModuleBuilder.

◆ getImportedModule() [1/2]

std::shared_ptr< IRModule > getImportedModule ( const yoi::wstr modRealPath)

Get the IRModule by module real path.

Parameters
modRealPathThe real path of the module.
Returns
The IRModule, nullptr if not found.

Definition at line 23 of file compilerContext.cpp.

References compilerContext::getModuleIndexByRealPath(), and compilerContext::moduleImported.

Here is the call graph for this function:

◆ getImportedModule() [2/2]

std::shared_ptr< IRModule > getImportedModule ( yoi::indexT  index)

Get the IRModule by module name.

Parameters
indexThe index of the module.
Returns
The IRModule.

Definition at line 19 of file compilerContext.cpp.

References compilerContext::moduleImported.

◆ getIntObjectType()

std::shared_ptr< yoi::IRValueType > getIntObjectType ( bool  forceRawAttr = false)

Definition at line 141 of file compilerContext.cpp.

References compilerContext::builtinModuleBuilder, and yoi::managedPtr().

Referenced by compilerContext::normalizeForeignBasicType().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getIRFFITable()

std::shared_ptr< IRFFITable > getIRFFITable ( )

Definition at line 179 of file compilerContext.cpp.

References compilerContext::irFFITable.

◆ getIRObjectFile()

const std::shared_ptr< IRObjectFile > & getIRObjectFile ( ) const

Definition at line 118 of file compilerContext.cpp.

References compilerContext::irObjectFile.

◆ getModuleContext()

std::shared_ptr< yoi::moduleContext > getModuleContext ( yoi::indexT  index)

get module context by index

Parameters
indexThe index of the module.

Definition at line 195 of file compilerContext.cpp.

References compilerContext::builtinModuleContext, HOSHI_COMPILER_CTX_GLOB_ID_CONST, and compilerContext::modules.

◆ getModuleIndexByRealPath()

yoi::indexT getModuleIndexByRealPath ( const yoi::wstr modRealPath)

Get the index of the module by module real path.

Parameters
modRealPathThe real path of the module.
Returns
The index of the module.
Exceptions
std::runtime_errorif the module is not found.

Definition at line 40 of file compilerContext.cpp.

References indexTable< A, B >::getIndex(), and compilerContext::modules.

Referenced by compilerContext::getImportedModule().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getNoneObjectType()

std::shared_ptr< yoi::IRValueType > getNoneObjectType ( )

Definition at line 161 of file compilerContext.cpp.

References compilerContext::builtinModuleBuilder.

◆ getNullInterfaceType()

std::shared_ptr< yoi::IRValueType > getNullInterfaceType ( )

Definition at line 191 of file compilerContext.cpp.

References compilerContext::builtinModuleBuilder.

◆ getPointerType()

std::shared_ptr< yoi::IRValueType > getPointerType ( )

Definition at line 211 of file compilerContext.cpp.

References compilerContext::builtinModuleBuilder.

◆ getShortObjectType()

std::shared_ptr< yoi::IRValueType > getShortObjectType ( bool  forceRawAttr = false)

Definition at line 230 of file compilerContext.cpp.

References compilerContext::builtinModuleBuilder, and yoi::managedPtr().

Here is the call graph for this function:

◆ getStrObjectType()

std::shared_ptr< yoi::IRValueType > getStrObjectType ( bool  forceRawAttr = false)

Definition at line 153 of file compilerContext.cpp.

References compilerContext::builtinModuleBuilder, and yoi::managedPtr().

Here is the call graph for this function:

◆ getUnsignedObjectType()

std::shared_ptr< yoi::IRValueType > getUnsignedObjectType ( bool  forceRawAttr = false)

Definition at line 234 of file compilerContext.cpp.

References compilerContext::builtinModuleBuilder, and yoi::managedPtr().

Referenced by compilerContext::normalizeForeignBasicType().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initializeSharedObjects()

◆ normalizeForeignBasicType()

yoi::IRValueType normalizeForeignBasicType ( const std::shared_ptr< yoi::IRValueType > &  type,
bool  handlePointer = true 
)

◆ runOptimizer()

void runOptimizer ( )

Definition at line 205 of file compilerContext.cpp.

References IROptimizer::buildCallGraph().

Here is the call graph for this function:

◆ setBuildConfig()

void setBuildConfig ( const std::shared_ptr< IRBuildConfig > &  buildConfig)

Definition at line 174 of file compilerContext.cpp.

References compilerContext::buildConfig.

◆ setIRObjectFile()

void setIRObjectFile ( const std::shared_ptr< IRObjectFile > &  irObjectFile)

Definition at line 165 of file compilerContext.cpp.

References compilerContext::irObjectFile.

Member Data Documentation

◆ astToFinalize

◆ buildConfig

std::shared_ptr<IRBuildConfig> buildConfig
private

◆ builtinModuleBuilder

◆ builtinModuleContext

std::shared_ptr<moduleContext> builtinModuleContext
private

◆ irFFITable

std::shared_ptr<IRFFITable> irFFITable
private

◆ irObjectFile

std::shared_ptr<IRObjectFile> irObjectFile
private

◆ moduleImported

◆ modules

◆ sharedValueType

yoi::indexTable<yoi::wstr, std::shared_ptr<IRValueType> > sharedValueType
private

Definition at line 37 of file compilerContext.h.


The documentation for this class was generated from the following files: