A node class or type defined in an LLVM module.
This class would be the compiler detail class for VuoModule
, except that the inheritance doesn't work out.
Definition at line 23 of file VuoCompilerModule.hh.
Public Member Functions | |
virtual | ~VuoCompilerModule (void) |
Destructor. | |
virtual set< string > | getDependencies (void) |
Returns a list of this VuoCompilerModule's dependencies. | |
virtual string | getDependencyName (void) |
Returns the name that would represent this VuoCompilerModule in another VuoCompilerModule's list of dependencies. | |
virtual string | getDependencyPath (void) |
Returns the path that would represent this VuoCompilerModule in a dependency file. | |
virtual string | getFileName (void) |
Returns the file name (with extension) that this module should have when saved to file. | |
VuoCompilerCompatibility | getCompatibleTargets (void) |
Returns the set of targets (operating system versions) with which this module is compatible. | |
Module * | getModule (void) |
Returns this VuoCompilerModule's LLVM module, which other LLVM modules can link to. | |
VuoModule * | getPseudoBase (void) |
Returns the (pseudo) base for this (pseudo) compiler detail class. | |
bool | isBuiltIn (void) |
Returns true if this module is one of the built-in modules distributed with Vuo. | |
void | setBuiltIn (bool builtIn) |
Sets whether this module is one of the built-in modules distributed with Vuo. | |
string | getModulePath (void) |
Returns the file from which the LLVM module was loaded, or an empty string if the module was contained in an archive or generated by the compiler. | |
void | setSourcePath (const string &sourcePath) |
Stores the path of the source file for this module. | |
string | getSourcePath (void) |
Returns the stored path of the source file for this module, if any. | |
void | setSourceCode (const string &sourceCode) |
Stores the source code for this module. | |
string | getSourceCode (void) |
Returns the stored source code for this module, if any. | |
shared_ptr< VuoMakeDependencies > | getMakeDependencies (void) |
Returns the stored dependency file contents for this module, if any. | |
Static Public Member Functions | |
static VuoCompilerModule * | newModule (const string &moduleKey, Module *module, const string &modulePath, const VuoCompilerCompatibility &moduleCompatibility) |
Instantiates a VuoCompilerModule (or child class) corresponding to the type of VuoCompilerModule defined in the LLVM module. | |
static VuoCompilerCompatibility | parseCompatibility (json_object *o, string key) |
Parses the target set value for key in the top level of the JSON object. | |
static void | parseGenericTypes (json_object *moduleDetails, vector< string > &genericTypeNames, map< string, string > &defaultSpecializedForGenericTypeName, map< string, vector< string > > &compatibleSpecializedForGenericTypeName) |
Parses the "genericTypes" portion of a module's metadata. | |
static Function * | declareFunctionInModule (Module *module, Function *function) |
Copies the function's header into the LLVM module, if it's not already there. | |
static string | getFileNameForModuleKey (const string &moduleKey) |
Returns the file name (with extension) that a module with the given module key would have when saved to file. | |
static bool | isModuleKeyMangledInFileName (const string &fileName) |
Returns true if a module with the given file name (with extension) would have a module key other than the file name minus extension. | |
Protected Member Functions | |
VuoCompilerModule (VuoModule *base, Module *module) | |
Creates a VuoCompilerModule associated with the given LLVM module, as a pseudo compiler detail class of the given VuoModule. | |
virtual void | parse (void) |
Renames globals in the LLVM module that might conflict with other VuoCompilerModules, and parses those globals. | |
virtual void | parseMetadata (void) |
Parses the metadata of this VuoCompilerModule (name, description, ...) from the LLVM module. | |
virtual set< string > | globalsToRename (void) |
Returns a list of global variables and functions that may be defined in multiple modules, and thus need to be renamed. | |
string | nameForGlobal (string genericGlobalVarOrFuncName) |
Returns the mangled name for a function or global variable. | |
void | renameGlobalVarsAndFuncs (void) |
Renames the global variables and functions within the LLVM module so that they are unique to this VuoCompilerModule. | |
Static Protected Member Functions | |
static bool | isSpecializedModule (Module *module, string moduleKey) |
Returns true if the moduleDetails global variable within the LLVM module contains a key indicating that it is intended to be a specialized module definition. | |
static string | nameForGlobal (string nameBeforeCompilation, string moduleKey) |
Returns the mangled name for a function or global variable. | |
static bool | hasOriginalOrMangledGlobal (string nameBeforeCompilation, Module *module, string moduleKey) |
Returns true if the module contains a function or global variable with name nameBeforeCompilation or with the corresponding mangled name. | |
Protected Attributes | |
struct json_object * | moduleDetails |
This module's metadata, found in the argument to VuoModuleMetadata in the module definition. | |
set< string > | dependencies |
The modules and libraries needed to compile a composition containing this module. | |
VuoCompilerCompatibility | compatibleTargets |
The set of targets with which this module is compatible. | |
Module *VuoCompilerBitcodeParser * | parser |
< The LLVM module that defines this node class or type | |
string | sourcePath |
The file containing the module's source code, if known. | |
string | sourceCode |
The module's source code, if known. | |
shared_ptr< VuoMakeDependencies > | makeDependencies |
The source files needed to compile this module. | |
map< string, string > | defaultSpecializedForGenericTypeName |
For generic modules: the types to use when creating an unspecialized instance. | |
map< string, vector< string > > | compatibleSpecializedForGenericTypeName |
For generic modules: the types to which each generic type is allowed to be specialized. | |
Friends | |
class | TestVuoCompilerModule |
class | TestModules |
|
protected |
Creates a VuoCompilerModule associated with the given LLVM module, as a pseudo compiler detail class of the given VuoModule.
Definition at line 23 of file VuoCompilerModule.cc.
|
virtual |
Destructor.
Definition at line 45 of file VuoCompilerModule.cc.
|
static |
Copies the function's header into the LLVM module, if it's not already there.
Use this when an LLVM module needs to call a function defined in another LLVM module.
Definition at line 274 of file VuoCompilerModule.cc.
VuoCompilerCompatibility VuoCompilerModule::getCompatibleTargets | ( | void | ) |
Returns the set of targets (operating system versions) with which this module is compatible.
Only checks the compatibility of the module itself, not its dependencies.
Definition at line 358 of file VuoCompilerModule.cc.
|
virtual |
Returns a list of this VuoCompilerModule's dependencies.
Reimplemented in VuoCompilerSpecializedNodeClass.
Definition at line 291 of file VuoCompilerModule.cc.
|
virtual |
Returns the name that would represent this VuoCompilerModule in another VuoCompilerModule's list of dependencies.
Reimplemented in VuoCompilerSpecializedNodeClass.
Definition at line 300 of file VuoCompilerModule.cc.
|
virtual |
Returns the path that would represent this VuoCompilerModule in a dependency file.
Definition at line 310 of file VuoCompilerModule.cc.
|
virtual |
Returns the file name (with extension) that this module should have when saved to file.
Reimplemented in VuoCompilerNodeClass, and VuoCompilerPublishedNodeClass.
Definition at line 322 of file VuoCompilerModule.cc.
|
static |
Returns the file name (with extension) that a module with the given module key would have when saved to file.
Definition at line 331 of file VuoCompilerModule.cc.
shared_ptr< VuoMakeDependencies > VuoCompilerModule::getMakeDependencies | ( | void | ) |
Returns the stored dependency file contents for this module, if any.
Definition at line 439 of file VuoCompilerModule.cc.
Module * VuoCompilerModule::getModule | ( | void | ) |
Returns this VuoCompilerModule's LLVM module, which other LLVM modules can link to.
Definition at line 366 of file VuoCompilerModule.cc.
string VuoCompilerModule::getModulePath | ( | void | ) |
Returns the file from which the LLVM module was loaded, or an empty string if the module was contained in an archive or generated by the compiler.
Definition at line 399 of file VuoCompilerModule.cc.
VuoModule * VuoCompilerModule::getPseudoBase | ( | void | ) |
Returns the (pseudo) base for this (pseudo) compiler detail class.
Definition at line 374 of file VuoCompilerModule.cc.
string VuoCompilerModule::getSourceCode | ( | void | ) |
Returns the stored source code for this module, if any.
Definition at line 431 of file VuoCompilerModule.cc.
string VuoCompilerModule::getSourcePath | ( | void | ) |
Returns the stored path of the source file for this module, if any.
Definition at line 415 of file VuoCompilerModule.cc.
|
protectedvirtual |
Returns a list of global variables and functions that may be defined in multiple modules, and thus need to be renamed.
Definition at line 202 of file VuoCompilerModule.cc.
|
staticprotected |
Returns true if the module contains a function or global variable with name nameBeforeCompilation
or with the corresponding mangled name.
Definition at line 229 of file VuoCompilerModule.cc.
bool VuoCompilerModule::isBuiltIn | ( | void | ) |
Returns true if this module is one of the built-in modules distributed with Vuo.
Definition at line 382 of file VuoCompilerModule.cc.
|
static |
Returns true if a module with the given file name (with extension) would have a module key other than the file name minus extension.
Definition at line 343 of file VuoCompilerModule.cc.
|
staticprotected |
Returns true if the moduleDetails
global variable within the LLVM module contains a key indicating that it is intended to be a specialized module definition.
Definition at line 106 of file VuoCompilerModule.cc.
|
protected |
Returns the mangled name for a function or global variable.
Definition at line 212 of file VuoCompilerModule.cc.
|
staticprotected |
Returns the mangled name for a function or global variable.
Definition at line 220 of file VuoCompilerModule.cc.
|
static |
Instantiates a VuoCompilerModule (or child class) corresponding to the type of VuoCompilerModule defined in the LLVM module.
If no type of VuoCompilerModule is defined, returns NULL.
moduleKey The node class name, type name, or library module key. module The LLVM module containing the module implementation. modulePath The path of the file from which this module was loaded (empty if none). moduleCompatibility Any restrictions to compatibility known just from loading the module (e.g. architecture), not including further restrictions that may be declared in the module's VuoModuleMetadata
.
Definition at line 65 of file VuoCompilerModule.cc.
|
protectedvirtual |
Renames globals in the LLVM module that might conflict with other VuoCompilerModules, and parses those globals.
Definition at line 124 of file VuoCompilerModule.cc.
|
static |
Parses the target set value for key in the top level of the JSON object.
If no such value is found, returns an unrestricted target set.
Definition at line 165 of file VuoCompilerModule.cc.
|
static |
Parses the "genericTypes" portion of a module's metadata.
Definition at line 177 of file VuoCompilerModule.cc.
|
protectedvirtual |
Parses the metadata of this VuoCompilerModule (name, description, ...) from the LLVM module.
Definition at line 136 of file VuoCompilerModule.cc.
|
protected |
Renames the global variables and functions within the LLVM module so that they are unique to this VuoCompilerModule.
Definition at line 239 of file VuoCompilerModule.cc.
void VuoCompilerModule::setBuiltIn | ( | bool | builtIn | ) |
Sets whether this module is one of the built-in modules distributed with Vuo.
Definition at line 390 of file VuoCompilerModule.cc.
void VuoCompilerModule::setSourceCode | ( | const string & | sourceCode | ) |
Stores the source code for this module.
Definition at line 423 of file VuoCompilerModule.cc.
void VuoCompilerModule::setSourcePath | ( | const string & | sourcePath | ) |
Stores the path of the source file for this module.
Definition at line 407 of file VuoCompilerModule.cc.
|
friend |
Definition at line 57 of file VuoCompilerModule.hh.
|
friend |
Definition at line 56 of file VuoCompilerModule.hh.
|
protected |
For generic modules: the types to which each generic type is allowed to be specialized.
Definition at line 54 of file VuoCompilerModule.hh.
|
protected |
The set of targets with which this module is compatible.
Definition at line 35 of file VuoCompilerModule.hh.
|
protected |
For generic modules: the types to use when creating an unspecialized instance.
Definition at line 53 of file VuoCompilerModule.hh.
|
protected |
The modules and libraries needed to compile a composition containing this module.
Definition at line 34 of file VuoCompilerModule.hh.
|
protected |
The source files needed to compile this module.
Definition at line 40 of file VuoCompilerModule.hh.
|
protected |
This module's metadata, found in the argument to VuoModuleMetadata
in the module definition.
Definition at line 33 of file VuoCompilerModule.hh.
|
protected |
< The LLVM module that defines this node class or type
The parser of the LLVM module
Definition at line 37 of file VuoCompilerModule.hh.
|
protected |
The module's source code, if known.
Definition at line 39 of file VuoCompilerModule.hh.
|
protected |
The file containing the module's source code, if known.
Definition at line 38 of file VuoCompilerModule.hh.