Vuo  2.0.0
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...
 
VuoCompilerTargetSet parseTargetSet (json_object *o, string key)
 Parses the target set value for key in the top level of the JSON object. More...
 
VuoCompilerTargetSet::MacVersion parseMacVersion (string version)
 Parses a Mac OS version from a string. 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...
 
VuoCompilerTargetSet 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)
 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...
 
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 42 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 252 of file VuoCompilerModule.cc.

◆ getCompatibleTargets()

VuoCompilerTargetSet VuoCompilerModule::getCompatibleTargets ( void  )

Returns the set of targets (operating system versions) with which this module is compatible.

Definition at line 286 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 269 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 278 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 294 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 327 of file VuoCompilerModule.cc.

◆ getPseudoBase()

VuoModule * VuoCompilerModule::getPseudoBase ( void  )

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

Definition at line 302 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 180 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 207 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 310 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 190 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 198 of file VuoCompilerModule.cc.

◆ newModule()

VuoCompilerModule * VuoCompilerModule::newModule ( const string &  moduleKey,
Module *  module,
const string &  modulePath 
)
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.

Definition at line 53 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 92 of file VuoCompilerModule.cc.

◆ parseMacVersion()

VuoCompilerTargetSet::MacVersion VuoCompilerModule::parseMacVersion ( string  version)

Parses a Mac OS version from a string.

If the string doesn't represent a Mac OS version, returns VuoCompilerTargetSet::MacVersion_Any.

Definition at line 152 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 102 of file VuoCompilerModule.cc.

◆ parseTargetSet()

VuoCompilerTargetSet VuoCompilerModule::parseTargetSet ( 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 128 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 217 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 318 of file VuoCompilerModule.cc.

Member Data Documentation

◆ dependencies

set<string> VuoCompilerModule::dependencies
protected

The dependencies found in this module's metadata.

Definition at line 34 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 33 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: