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< DiagnosticEnginegetDiagnosticEngine () const
 
void setDiagnosticEngine (const std::shared_ptr< DiagnosticEngine > &engine)
 
std::shared_ptr< IRFFITablegetIRFFITable ()
 
bool isInitialized () const
 
void registerModule (yoi::indexT idx, std::shared_ptr< IRModule > mod)
 
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
 
std::shared_ptr< DiagnosticEnginediagnosticEngine
 

Detailed Description

Definition at line 36 of file compilerContext.h.

Constructor & Destructor Documentation

◆ compilerContext() [1/2]

compilerContext ( )
default

◆ compilerContext() [2/2]

compilerContext ( const compilerContext context)
default

◆ ~compilerContext()

Definition at line 227 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 173 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 198 of file compilerContext.cpp.

References compilerContext::buildConfig.

◆ getCharObjectType()

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

Definition at line 185 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 177 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:

◆ getDiagnosticEngine()

std::shared_ptr< DiagnosticEngine > getDiagnosticEngine ( ) const

Definition at line 44 of file compilerContext.cpp.

References compilerContext::diagnosticEngine.

◆ getForeignFloatObjectType()

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

Definition at line 215 of file compilerContext.cpp.

References compilerContext::builtinModuleBuilder.

◆ getForeignInt32ObjectType()

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

Definition at line 211 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 169 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 207 of file compilerContext.cpp.

References compilerContext::irFFITable.

◆ getIRObjectFile()

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

Definition at line 137 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 223 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 189 of file compilerContext.cpp.

References compilerContext::builtinModuleBuilder.

◆ getNullInterfaceType()

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

Definition at line 219 of file compilerContext.cpp.

References compilerContext::builtinModuleBuilder.

◆ getPointerType()

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

Definition at line 239 of file compilerContext.cpp.

References compilerContext::builtinModuleBuilder.

◆ getShortObjectType()

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

Definition at line 258 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 181 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 262 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()

◆ isInitialized()

bool isInitialized ( ) const

Definition at line 266 of file compilerContext.cpp.

References compilerContext::builtinModuleBuilder.

◆ normalizeForeignBasicType()

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

◆ registerModule()

void registerModule ( yoi::indexT  idx,
std::shared_ptr< IRModule mod 
)

Definition at line 270 of file compilerContext.cpp.

References compilerContext::moduleImported.

◆ runOptimizer()

void runOptimizer ( )

Definition at line 233 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 202 of file compilerContext.cpp.

References compilerContext::buildConfig.

◆ setDiagnosticEngine()

void setDiagnosticEngine ( const std::shared_ptr< DiagnosticEngine > &  engine)

Definition at line 48 of file compilerContext.cpp.

References compilerContext::diagnosticEngine.

◆ setIRObjectFile()

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

Definition at line 193 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

◆ diagnosticEngine

◆ 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 38 of file compilerContext.h.


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