Vuo  2.3.2
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
VuoCompilerModule Class Reference

Description

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 22 of file VuoCompilerModule.hh.

Public Member Functions

virtual ~VuoCompilerModule (void)
 Destructor. More...
 
VuoCompilerCompatibility parseCompatibility (json_object *o, string key)
 Parses the target set value for key in the top level of the JSON object. More...
 
virtual set< string > getDependencies (void)
 Returns a list of this VuoCompilerModule's dependencies. More...
 
virtual string getDependencyName (void)
 Returns the name that would represent this VuoCompilerModule in another VuoCompilerModule's list of dependencies. More...
 
VuoCompilerCompatibility getCompatibleTargets (void)
 Returns the set of targets (operating system versions) with which this module is compatible. More...
 
Module * getModule (void)
 Returns this VuoCompilerModule's LLVM module, which other LLVM modules can link to. More...
 
VuoModulegetPseudoBase (void)
 Returns the (pseudo) base for this (pseudo) compiler detail class. More...
 
bool isBuiltIn (void)
 Returns true if this module is one of the built-in modules distributed with Vuo. More...
 
void setBuiltIn (bool builtIn)
 Sets whether this module is one of the built-in modules distributed with Vuo. More...
 
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. More...
 

Static Public Member Functions

static VuoCompilerModulenewModule (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. More...
 
static Function * declareFunctionInModule (Module *module, Function *function)
 Copies the function's header into the LLVM module, if it's not already there. More...
 

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. More...
 
virtual void parse (void)
 Renames globals in the LLVM module that might conflict with other VuoCompilerModules, and parses those globals. More...
 
virtual void parseMetadata (void)
 Parses the metadata of this VuoCompilerModule (name, description, ...) from the LLVM module. More...
 
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. More...
 
string nameForGlobal (string genericGlobalVarOrFuncName)
 Returns the mangled name for a function or global variable. More...
 
void renameGlobalVarsAndFuncs (void)
 Renames the global variables and functions within the LLVM module so that they are unique to this VuoCompilerModule. More...
 

Static Protected Member Functions

static string nameForGlobal (string nameBeforeCompilation, string moduleKey)
 Returns the mangled name for a function or global variable. More...
 
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. More...
 

Protected Attributes

struct json_objectmoduleDetails
 This module's metadata, found in the argument to VuoModuleMetadata in the module definition. More...
 
set< string > dependencies
 The dependencies found in this module's metadata. More...
 
VuoCompilerCompatibility compatibleTargets
 The set of targets with which this module is compatible. More...
 
Module * module
 The LLVM module that defines this node class or type. More...
 
VuoCompilerBitcodeParserparser
 The parser of the LLVM module. More...
 

Friends

class TestVuoCompilerModule
 
class TestModules
 

Constructor & Destructor Documentation

◆ VuoCompilerModule()

VuoCompilerModule::VuoCompilerModule ( VuoModule base,
Module *  module 
)
protected

Creates a VuoCompilerModule associated with the given LLVM module, as a pseudo compiler detail class of the given VuoModule.

Definition at line 21 of file VuoCompilerModule.cc.

◆ ~VuoCompilerModule()

VuoCompilerModule::~VuoCompilerModule ( void  )
virtual

Destructor.

Definition at line 43 of file VuoCompilerModule.cc.

Member Function Documentation

◆ declareFunctionInModule()

Function * VuoCompilerModule::declareFunctionInModule ( Module *  module,
Function *  functionSrc 
)
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 225 of file VuoCompilerModule.cc.

◆ getCompatibleTargets()

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 261 of file VuoCompilerModule.cc.

◆ getDependencies()

set< string > VuoCompilerModule::getDependencies ( void  )
virtual

Returns a list of this VuoCompilerModule's dependencies.

Reimplemented in VuoCompilerSpecializedNodeClass.

Definition at line 242 of file VuoCompilerModule.cc.

◆ getDependencyName()

string VuoCompilerModule::getDependencyName ( void  )
virtual

Returns the name that would represent this VuoCompilerModule in another VuoCompilerModule's list of dependencies.

Reimplemented in VuoCompilerSpecializedNodeClass.

Definition at line 251 of file VuoCompilerModule.cc.

◆ getModule()

Module * VuoCompilerModule::getModule ( void  )

Returns this VuoCompilerModule's LLVM module, which other LLVM modules can link to.

Definition at line 269 of file VuoCompilerModule.cc.

◆ getModulePath()

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 302 of file VuoCompilerModule.cc.

◆ getPseudoBase()

VuoModule * VuoCompilerModule::getPseudoBase ( void  )

Returns the (pseudo) base for this (pseudo) compiler detail class.

Definition at line 277 of file VuoCompilerModule.cc.

◆ globalsToRename()

set< string > VuoCompilerModule::globalsToRename ( void  )
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 153 of file VuoCompilerModule.cc.

◆ hasOriginalOrMangledGlobal()

bool VuoCompilerModule::hasOriginalOrMangledGlobal ( string  nameBeforeCompilation,
Module *  module,
string  moduleKey 
)
staticprotected

Returns true if the module contains a function or global variable with name nameBeforeCompilation or with the corresponding mangled name.

Definition at line 180 of file VuoCompilerModule.cc.

◆ isBuiltIn()

bool VuoCompilerModule::isBuiltIn ( void  )

Returns true if this module is one of the built-in modules distributed with Vuo.

Definition at line 285 of file VuoCompilerModule.cc.

◆ nameForGlobal() [1/2]

string VuoCompilerModule::nameForGlobal ( string  genericGlobalVarOrFuncName)
protected

Returns the mangled name for a function or global variable.

Definition at line 163 of file VuoCompilerModule.cc.

◆ nameForGlobal() [2/2]

string VuoCompilerModule::nameForGlobal ( string  nameBeforeCompilation,
string  moduleKey 
)
staticprotected

Returns the mangled name for a function or global variable.

Definition at line 171 of file VuoCompilerModule.cc.

◆ newModule()

VuoCompilerModule * VuoCompilerModule::newModule ( const string &  moduleKey,
Module *  module,
const string &  modulePath,
const VuoCompilerCompatibility moduleCompatibility 
)
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 63 of file VuoCompilerModule.cc.

◆ parse()

void VuoCompilerModule::parse ( void  )
protectedvirtual

Renames globals in the LLVM module that might conflict with other VuoCompilerModules, and parses those globals.

Definition at line 104 of file VuoCompilerModule.cc.

◆ parseCompatibility()

VuoCompilerCompatibility VuoCompilerModule::parseCompatibility ( json_object o,
string  key 
)

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 140 of file VuoCompilerModule.cc.

◆ parseMetadata()

void VuoCompilerModule::parseMetadata ( void  )
protectedvirtual

Parses the metadata of this VuoCompilerModule (name, description, ...) from the LLVM module.

Definition at line 114 of file VuoCompilerModule.cc.

◆ renameGlobalVarsAndFuncs()

void VuoCompilerModule::renameGlobalVarsAndFuncs ( void  )
protected

Renames the global variables and functions within the LLVM module so that they are unique to this VuoCompilerModule.

Definition at line 190 of file VuoCompilerModule.cc.

◆ setBuiltIn()

void VuoCompilerModule::setBuiltIn ( bool  builtIn)

Sets whether this module is one of the built-in modules distributed with Vuo.

Definition at line 293 of file VuoCompilerModule.cc.

Member Data Documentation

◆ compatibleTargets

VuoCompilerCompatibility VuoCompilerModule::compatibleTargets
protected

The set of targets with which this module is compatible.

Definition at line 34 of file VuoCompilerModule.hh.

◆ dependencies

set<string> VuoCompilerModule::dependencies
protected

The dependencies found in this module's metadata.

Definition at line 33 of file VuoCompilerModule.hh.

◆ module

Module* VuoCompilerModule::module
protected

The LLVM module that defines this node class or type.

Definition at line 35 of file VuoCompilerModule.hh.

◆ moduleDetails

struct json_object* VuoCompilerModule::moduleDetails
protected

This module's metadata, found in the argument to VuoModuleMetadata in the module definition.

Definition at line 32 of file VuoCompilerModule.hh.

◆ parser

VuoCompilerBitcodeParser* VuoCompilerModule::parser
protected

The parser of the LLVM module.

Definition at line 36 of file VuoCompilerModule.hh.


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