Vuo 2.4.4
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
VuoCompilerType Class Reference

Description

The compiler detail class for VuoType.

Definition at line 20 of file VuoCompilerType.hh.

Public Member Functions

Value * generateRetainedValueFromString (Module *module, BasicBlock *block, Value *stringValue)
 Generates code that unserializes data from a string.
 
Value * generateStringFromValueFunctionCall (Module *module, BasicBlock *block, Value *arg)
 Generates a call to [Type]_getString().
 
Value * generateInterprocessStringFromValueFunctionCall (Module *module, BasicBlock *block, Value *arg)
 Generates a call to [Type]_getInterprocessString().
 
Value * generateSummaryFromValueFunctionCall (Module *module, BasicBlock *block, Value *arg)
 Generates a call to [Type]_getSummary().
 
void generateRetainCall (Module *module, BasicBlock *block, Value *arg)
 Generates a call to [Type]_retain(), if needed.
 
void generateReleaseCall (Module *module, BasicBlock *block, Value *arg)
 Generates a call to [Type]_release(), if needed.
 
vector< Value * > convertPortDataToArgs (Module *module, BasicBlock *block, Value *arg, FunctionType *functionType, int parameterIndex, bool isUnloweredStructPointerParameter)
 Generates an argument or arguments representing the port data, lowered for the C ABI.
 
Value * convertArgsToPortData (Module *module, BasicBlock *block, Function *function, int parameterIndex)
 Unlowers the function argument at parameterIndex (and the one after, if this data type is lowered to 2 arguments) into port data (the same data type as portContext->data).
 
size_t getAllocationSize (Module *module)
 Returns the offset in bytes between successive objects of the type, including alignment padding.
 
size_t getStorageSize (Module *module)
 Returns the maximum number of bytes that may be overwritten by storing the type.
 
Value * convertToPortData (BasicBlock *block, Value *voidPointer)
 Casts a void * to a pointer to this type's storage.
 
vector< Type * > getFunctionParameterTypes (void)
 Returns the LLVM type(s) for when this Vuo type is passed to a function.
 
PointerType * getFunctionParameterPointerType (void)
 Returns the LLVM type for when a pointer to this Vuo type is passed to a function.
 
AttributeList getFunctionAttributes (void)
 Returns the LLVM attributes for this Vuo type when it appears as a function parameter.
 
void copyFunctionParameterAttributes (Function *dstFunction)
 Copies the LLVM attributes for this Vuo type as a function parameter onto the parameter(s) of dstFunction.
 
void copyFunctionParameterAttributes (Module *module, CallInst *dstCall)
 Copies the LLVM attributes for this Vuo type as a function parameter onto the parameter(s) of dstCall.
 
bool hasInterprocessStringFunction (void)
 Returns true if the type's getInterprocessString() function is defined.
 
bool supportsComparison (void)
 Returns true if the type's areEqual and isLessThan functions are defined.
 
- Public Member Functions inherited from VuoBaseDetail< VuoType >
 VuoBaseDetail (string description, VuoType *base)
 Creates a detail class.
 
VuoTypegetBase (void) const
 Returns the detail class instance's base class instance.
 
void setBase (VuoType *base)
 Sets the detail class instance's base class instance.
 
- Public Member Functions inherited from VuoCompilerModule
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.
 
VuoModulegetPseudoBase (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< VuoMakeDependenciesgetMakeDependencies (void)
 Returns the stored dependency file contents for this module, if any.
 

Static Public Member Functions

static VuoCompilerTypenewType (string typeName, Module *module)
 Creates a type from the type definition in the module.
 
static bool isListType (VuoCompilerType *type)
 Returns true if the type is a list type.
 
- Static Public Member Functions inherited from VuoCompilerModule
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.
 
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

 VuoCompilerType (string typeName, Module *module)
 Creates a type from an LLVM module, and creates its corresponding base VuoType.
 
- Protected Member Functions inherited from VuoCompilerModule
 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 parseMetadata (void)
 Parses the metadata of this VuoCompilerModule (name, description, ...) from the LLVM module.
 
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.
 

Friends

class TestVuoCompilerType
 
class TestTypes
 

Additional Inherited Members

- Static Protected Member Functions inherited from VuoCompilerModule
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 inherited from VuoCompilerModule
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 *VuoCompilerBitcodeParserparser
 < 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< VuoMakeDependenciesmakeDependencies
 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.
 

Constructor & Destructor Documentation

◆ VuoCompilerType()

VuoCompilerType::VuoCompilerType ( string  typeName,
Module *  module 
)
protected

Creates a type from an LLVM module, and creates its corresponding base VuoType.

Definition at line 22 of file VuoCompilerType.cc.

Member Function Documentation

◆ convertArgsToPortData()

Value * VuoCompilerType::convertArgsToPortData ( Module *  module,
BasicBlock *  block,
Function *  function,
int  parameterIndex 
)

Unlowers the function argument at parameterIndex (and the one after, if this data type is lowered to 2 arguments) into port data (the same data type as portContext->data).

Definition at line 476 of file VuoCompilerType.cc.

◆ convertPortDataToArgs()

vector< Value * > VuoCompilerType::convertPortDataToArgs ( Module *  module,
BasicBlock *  block,
Value *  arg,
FunctionType *  functionType,
int  parameterIndex,
bool  isUnloweredStructPointerParameter 
)

Generates an argument or arguments representing the port data, lowered for the C ABI.

arg should be the same data type as portContext->data.

Definition at line 409 of file VuoCompilerType.cc.

◆ convertToPortData()

Value * VuoCompilerType::convertToPortData ( BasicBlock *  block,
Value *  voidPointer 
)

Casts a void * to a pointer to this type's storage.

Definition at line 559 of file VuoCompilerType.cc.

◆ copyFunctionParameterAttributes() [1/2]

void VuoCompilerType::copyFunctionParameterAttributes ( Function *  dstFunction)

Copies the LLVM attributes for this Vuo type as a function parameter onto the parameter(s) of dstFunction.

Definition at line 601 of file VuoCompilerType.cc.

◆ copyFunctionParameterAttributes() [2/2]

void VuoCompilerType::copyFunctionParameterAttributes ( Module *  module,
CallInst *  dstCall 
)

Copies the LLVM attributes for this Vuo type as a function parameter onto the parameter(s) of dstCall.

Definition at line 609 of file VuoCompilerType.cc.

◆ generateInterprocessStringFromValueFunctionCall()

Value * VuoCompilerType::generateInterprocessStringFromValueFunctionCall ( Module *  module,
BasicBlock *  block,
Value *  arg 
)

Generates a call to [Type]_getInterprocessString().

Parameters
moduleThe destination LLVM module (i.e., generated code).
blockThe LLVM block to which to append the function call.
argThe argument to pass to [Type]_getInterprocessString().
Returns
The return value of [Type]_getInterprocessString(), or the return value of [Type]_getString() if the interprocess function doesn't exist.

Definition at line 367 of file VuoCompilerType.cc.

◆ generateReleaseCall()

void VuoCompilerType::generateReleaseCall ( Module *  module,
BasicBlock *  block,
Value *  arg 
)

Generates a call to [Type]_release(), if needed.

Definition at line 399 of file VuoCompilerType.cc.

◆ generateRetainCall()

void VuoCompilerType::generateRetainCall ( Module *  module,
BasicBlock *  block,
Value *  arg 
)

Generates a call to [Type]_retain(), if needed.

Definition at line 391 of file VuoCompilerType.cc.

◆ generateRetainedValueFromString()

Value * VuoCompilerType::generateRetainedValueFromString ( Module *  module,
BasicBlock *  block,
Value *  stringValue 
)

Generates code that unserializes data from a string.

Example:
json_object *js = json_tokener_parse(str);
VuoRetain(value);
json_object_put(js);
Parameters
moduleThe destination LLVM module (i.e., generated code).
blockThe LLVM block to which to append the function call.
stringValueThe serialized data, which will be passed to json_tokener_parse().
Returns
The unserialized port data (the same data type as portContext->data).

Definition at line 313 of file VuoCompilerType.cc.

◆ generateStringFromValueFunctionCall()

Value * VuoCompilerType::generateStringFromValueFunctionCall ( Module *  module,
BasicBlock *  block,
Value *  arg 
)

Generates a call to [Type]_getString().

Parameters
moduleThe destination LLVM module (i.e., generated code).
blockThe LLVM block to which to append the function call.
argThe argument to pass to [Type]_getString().
Returns
The return value of [Type]_getString().

Definition at line 354 of file VuoCompilerType.cc.

◆ generateSummaryFromValueFunctionCall()

Value * VuoCompilerType::generateSummaryFromValueFunctionCall ( Module *  module,
BasicBlock *  block,
Value *  arg 
)

Generates a call to [Type]_getSummary().

Parameters
moduleThe destination LLVM module (i.e., generated code).
blockThe LLVM block to which to append the function call.
argThe argument to pass to [Type]_getSummary().
Returns
The return value of [Type]_getSummary().

Definition at line 383 of file VuoCompilerType.cc.

◆ getAllocationSize()

size_t VuoCompilerType::getAllocationSize ( Module *  module)

Returns the offset in bytes between successive objects of the type, including alignment padding.

Definition at line 535 of file VuoCompilerType.cc.

◆ getFunctionAttributes()

AttributeList VuoCompilerType::getFunctionAttributes ( void  )

Returns the LLVM attributes for this Vuo type when it appears as a function parameter.

This is needed, for example, for struct parameters with the "byval" attribute.

Definition at line 593 of file VuoCompilerType.cc.

◆ getFunctionParameterPointerType()

PointerType * VuoCompilerType::getFunctionParameterPointerType ( void  )

Returns the LLVM type for when a pointer to this Vuo type is passed to a function.

Definition at line 583 of file VuoCompilerType.cc.

◆ getFunctionParameterTypes()

vector< Type * > VuoCompilerType::getFunctionParameterTypes ( void  )

Returns the LLVM type(s) for when this Vuo type is passed to a function.

Definition at line 571 of file VuoCompilerType.cc.

◆ getStorageSize()

size_t VuoCompilerType::getStorageSize ( Module *  module)

Returns the maximum number of bytes that may be overwritten by storing the type.

Definition at line 547 of file VuoCompilerType.cc.

◆ hasInterprocessStringFunction()

bool VuoCompilerType::hasInterprocessStringFunction ( void  )

Returns true if the type's getInterprocessString() function is defined.

Definition at line 628 of file VuoCompilerType.cc.

◆ isListType()

bool VuoCompilerType::isListType ( VuoCompilerType type)
static

Returns true if the type is a list type.

Definition at line 617 of file VuoCompilerType.cc.

◆ newType()

VuoCompilerType * VuoCompilerType::newType ( string  typeName,
Module *  module 
)
static

Creates a type from the type definition in the module.

If the module does not contain a type definition, returns NULL.

Definition at line 50 of file VuoCompilerType.cc.

◆ supportsComparison()

bool VuoCompilerType::supportsComparison ( void  )

Returns true if the type's areEqual and isLessThan functions are defined.

Definition at line 636 of file VuoCompilerType.cc.

Friends And Related Symbol Documentation

◆ TestTypes

friend class TestTypes
friend

Definition at line 47 of file VuoCompilerType.hh.

◆ TestVuoCompilerType

friend class TestVuoCompilerType
friend

Definition at line 46 of file VuoCompilerType.hh.


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