Vuo  0.8.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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.

Public Member Functions

VuoCompilerTargetSet parseTargetSet (json_object *o, string key)
 Parses the target set value for key in the top level of the JSON object.
 
VuoCompilerTargetSet::MacVersion parseMacVersion (string version)
 Parses a Mac OS version from a string.
 
vector< string > getDependencies (void)
 Returns a list of this VuoCompilerModule's dependencies.
 
VuoCompilerTargetSet 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.
 
VuoModulegetPseudoBase (void)
 Returns the (psuedo) base for this (psuedo) compiler detail class.
 
bool getPremium (void)
 Returns a boolean indicating whether this module contains premium content.
 
void setPremium (bool premium)
 Sets the boolean indicating whether this module contains premium content.
 

Static Public Member Functions

static VuoCompilerModulenewModule (string moduleKey, Module *module)
 Instantiates a VuoCompilerModule (or child class) corresponding to the type of VuoCompilerModule defined in the LLVM module.
 
static Function * declareFunctionInModule (Module *module, Function *function)
 Copies the function's header into the LLVM module, if it's not already there.
 

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 ~VuoCompilerModule ()
 Destructor.
 
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 string parseString (json_object *o, string key, bool *foundValue=NULL)
 Parses the string value for key in the top level of the JSON object.
 
static int parseInt (json_object *o, string key, bool *foundValue=NULL)
 Parses the integer value for key in the top level of the JSON object.
 
static bool parseBool (json_object *o, string key, bool *foundValue=NULL)
 Parses the boolean value for key in the top level of the JSON object.
 
static vector< string > parseArrayOfStrings (json_object *o, string key)
 Parses the array-of-strings value for key in the top level of the JSON object.
 
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.
 
vector< string > dependencies
 The dependencies found in this module's metadata.
 
Module * module
 The LLVM module that defines this node class or type.
 
VuoModulebase
 The (pseudo) base for this (pseudo) compiler detail class.
 
VuoCompilerBitcodeParserparser
 The parser of the LLVM module.
 
bool isPremium
 A boolean indicating whether this module contains premium content.
 

Friends

class TestVuoCompilerModule
 

Constructor & Destructor Documentation

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.

VuoCompilerModule::~VuoCompilerModule ( )
protectedvirtual

Destructor.

Todo:

Member Function Documentation

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.

VuoCompilerTargetSet VuoCompilerModule::getCompatibleTargets ( void  )

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

vector< string > VuoCompilerModule::getDependencies ( void  )

Returns a list of this VuoCompilerModule's dependencies.

Module * VuoCompilerModule::getModule ( void  )

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

bool VuoCompilerModule::getPremium ( void  )

Returns a boolean indicating whether this module contains premium content.

VuoModule * VuoCompilerModule::getPseudoBase ( void  )

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

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.

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.

string VuoCompilerModule::nameForGlobal ( string  genericGlobalVarOrFuncName)
protected

Returns the mangled name for a function or global variable.

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

Returns the mangled name for a function or global variable.

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

void VuoCompilerModule::parse ( void  )
protectedvirtual

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

vector< string > VuoCompilerModule::parseArrayOfStrings ( json_object *  o,
string  key 
)
staticprotected

Parses the array-of-strings value for key in the top level of the JSON object.

If no such value is found, returns an empty vector.

bool VuoCompilerModule::parseBool ( json_object *  o,
string  key,
bool *  foundValue = NULL 
)
staticprotected

Parses the boolean value for key in the top level of the JSON object.

If no such value is found, returns false.

int VuoCompilerModule::parseInt ( json_object *  o,
string  key,
bool *  foundValue = NULL 
)
staticprotected

Parses the integer value for key in the top level of the JSON object.

If no such value is found, returns 0.

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.

void VuoCompilerModule::parseMetadata ( void  )
protectedvirtual

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

string VuoCompilerModule::parseString ( json_object *  o,
string  key,
bool *  foundValue = NULL 
)
staticprotected

Parses the string value for key in the top level of the JSON object.

If no such value is found, returns an empty string.

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.

void VuoCompilerModule::renameGlobalVarsAndFuncs ( void  )
protected

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

void VuoCompilerModule::setPremium ( bool  premium)

Sets the boolean indicating whether this module contains premium content.

This attribute may be used, e.g., for purposes of automatic documentation generation.

Member Data Documentation

VuoModule* VuoCompilerModule::base
protected

The (pseudo) base for this (pseudo) compiler detail class.

vector<string> VuoCompilerModule::dependencies
protected

The dependencies found in this module's metadata.

bool VuoCompilerModule::isPremium
protected

A boolean indicating whether this module contains premium content.

Module* VuoCompilerModule::module
protected

The LLVM module that defines this node class or type.

struct json_object* VuoCompilerModule::moduleDetails
protected

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

VuoCompilerBitcodeParser* VuoCompilerModule::parser
protected

The parser of the LLVM module.


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