Vuo  1.2.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | List of all members
VuoCompilerNode Class Reference

Description

The compiler detail class for VuoNode.

Public Member Functions

 VuoCompilerNode (VuoNode *baseNode)
 Creates a compiler detail for the specified baseNode.
 
void setConstantStringCache (VuoCompilerConstantStringCache *constantStrings)
 Sets the cache used to generate constant string values.
 
Value * generateIdentifierValue (Module *module, BasicBlock *block, Value *compositionIdentifierValue)
 Generates a char * value prefixed with compositionIdentifierValue and suffixed with this node's identifier.
 
Value * generateGetContext (Module *module, BasicBlock *block, Value *compositionIdentifierValue)
 Generates code to look up the NodeContext * indexed under this node's full identifier (prefixed with the composition's identifier).
 
Value * generateContextInit (Module *module, BasicBlock *block, Value *compositionIdentifierValue, unsigned long nodeIndex, const vector< VuoCompilerType * > &orderedTypes)
 Generates code to create and initialize a data structure containing port values and other information specific to this node.
 
void generateContextFini (Module *module, BasicBlock *block, BasicBlock *finiBlock, Value *compositionIdentifierValue, Value *nodeIdentifierValue, Value *nodeContextValue)
 Generates code to deallocate the data structure created by code generated by VuoCompilerNode::generateContextInit().
 
void generateEventFunctionCall (Module *module, Function *function, BasicBlock *&currentBlock, Value *nodeIdentifierValue)
 Generates a call to nodeEvent or nodeInstanceEvent.
 
void generateInitFunctionCall (Module *module, BasicBlock *block, Value *compositionIdentifierValue)
 Generates a call to nodeInstanceInit, stores the return value into the node's instance data, and retains the node's instance data.
 
void generateFiniFunctionCall (Module *module, BasicBlock *block, Value *compositionIdentifierValue)
 Generates a call to nodeInstanceFini and releases the node's instance data.
 
void generateCallbackStartFunctionCall (Module *module, BasicBlock *block, Value *compositionIdentifierValue)
 Generates a call to nodeInstanceTriggerStart, if the function exists.
 
void generateCallbackUpdateFunctionCall (Module *module, BasicBlock *block, Value *compositionIdentifierValue)
 Generates a call to nodeInstanceTriggerUpdate, if the function exists.
 
void generateCallbackStopFunctionCall (Module *module, BasicBlock *block, Value *compositionIdentifierValue)
 Generates a call to nodeInstanceTriggerStop, if the function exists.
 
Value * generateReceivedEventCondition (Module *module, BasicBlock *block, Value *nodeContextValue)
 Generates a condition that is true if any of this node's input event ports have received an event.
 
Value * generateReceivedEventCondition (Module *module, BasicBlock *block, Value *nodeContextValue, vector< VuoPort * > selectedInputPorts, const map< VuoCompilerEventPort *, Value * > &portContextForEventPort=(map< VuoCompilerEventPort *, Value * >()))
 Generates a condition that is true if any of the given input event ports of this node have received an event.
 
VuoCompilerInstanceDatagetInstanceData (void)
 If this node is stateful, returns the instance data.
 
string getIdentifier (void)
 Returns the identifier prefix in the generated LLVM bitcode for this node instance.
 
string getGraphvizIdentifierPrefix (void)
 Returns a suggested UpperCamelCase prefix for the node's Graphviz identifier, based on its title.
 
void setGraphvizIdentifier (string graphvizIdentifier)
 Sets the identifier that will appear in .vuo (Graphviz dot format) files.
 
string getGraphvizIdentifier (void)
 Gets the identifier that will appear in .vuo (Graphviz dot format) files.
 
string getGraphvizDeclaration (bool shouldPrintPosition=false, double xPositionOffset=0, double yPositionOffset=0)
 Returns a string containing the declaration for this node as it would appear in a .vuo (Graphviz dot format) file.
 
Value * generateSerializedString (Module *module, BasicBlock *block, Value *compositionIdentifierValue)
 Generates code that creates a Graphviz-formatted declaration for this node, with the node's fully-qualified identifier (including composition prefix) and the port and instance data values.
 
void generateUnserialization (Module *module, Function *function, BasicBlock *&block, Value *compositionIdentifierValue, Value *graphValue)
 Generates code that sets this node's input port values and instance data from the declaration found in the given Graphviz graph (graph_t *).
 
- Public Member Functions inherited from VuoBaseDetail< VuoNode >
 VuoBaseDetail (string description, VuoNode *base)
 Creates a VuoNode detail class.
 
VuoNodegetBase (void) const
 Returns the VuoNode detail class instance's base class instance.
 
void setBase (VuoNode *base)
 Sets the VuoNode detail class instance's base class instance.
 

Constructor & Destructor Documentation

VuoCompilerNode::VuoCompilerNode ( VuoNode baseNode)

Creates a compiler detail for the specified baseNode.

Member Function Documentation

void VuoCompilerNode::generateCallbackStartFunctionCall ( Module *  module,
BasicBlock *  block,
Value *  compositionIdentifierValue 
)

Generates a call to nodeInstanceTriggerStart, if the function exists.

Parameters
moduleThe destination LLVM module (i.e., generated code).
blockThe LLVM block to which to append the function call.
compositionIdentifierValueThe identifier of the composition containing this node.
void VuoCompilerNode::generateCallbackStopFunctionCall ( Module *  module,
BasicBlock *  block,
Value *  compositionIdentifierValue 
)

Generates a call to nodeInstanceTriggerStop, if the function exists.

Parameters
moduleThe destination LLVM module (i.e., generated code).
blockThe LLVM block to which to append the function call.
compositionIdentifierValueThe identifier of the composition containing this node.
void VuoCompilerNode::generateCallbackUpdateFunctionCall ( Module *  module,
BasicBlock *  block,
Value *  compositionIdentifierValue 
)

Generates a call to nodeInstanceTriggerUpdate, if the function exists.

Parameters
moduleThe destination LLVM module (i.e., generated code).
blockThe LLVM block to which to append the function call.
compositionIdentifierValueThe identifier of the composition containing this node.
void VuoCompilerNode::generateContextFini ( Module *  module,
BasicBlock *  block,
BasicBlock *  releaseInputsBlock,
Value *  compositionIdentifierValue,
Value *  nodeIdentifierValue,
Value *  nodeContextValue 
)

Generates code to deallocate the data structure created by code generated by VuoCompilerNode::generateContextInit().

If this node is a subcomposition, compositionContextFini() is called.

The generated code releases the data of each data-and-event port, except for the input ports of nodes being carried across a live-coding reload.

Value * VuoCompilerNode::generateContextInit ( Module *  module,
BasicBlock *  block,
Value *  compositionIdentifierValue,
unsigned long  nodeIndex,
const vector< VuoCompilerType * > &  orderedTypes 
)

Generates code to create and initialize a data structure containing port values and other information specific to this node.

If this node is a subcomposition, compositionContextInit() is called.

The generated code registers the created node context with the runtime.

void VuoCompilerNode::generateEventFunctionCall ( Module *  module,
Function *  function,
BasicBlock *&  currentBlock,
Value *  nodeIdentifierValue 
)

Generates a call to nodeEvent or nodeInstanceEvent.

The generated code sets up the arguments for the call, does the call, transmits events from input ports to output ports, and handles memory management for the node's runtime representation.

Parameters
moduleThe destination LLVM module (i.e., generated code).
functionThe function in which to generate code.
currentBlockThe block in which to generate code.
nodeIdentifierValueThis node's fully qualified identifier.
void VuoCompilerNode::generateFiniFunctionCall ( Module *  module,
BasicBlock *  block,
Value *  compositionIdentifierValue 
)

Generates a call to nodeInstanceFini and releases the node's instance data.

Assumes the node is stateful.

Parameters
moduleThe destination LLVM module (i.e., generated code).
blockThe LLVM block to which to append the function call.
compositionIdentifierValueThe identifier of the composition containing this node.
Value * VuoCompilerNode::generateGetContext ( Module *  module,
BasicBlock *  block,
Value *  compositionIdentifierValue 
)

Generates code to look up the NodeContext * indexed under this node's full identifier (prefixed with the composition's identifier).

Value * VuoCompilerNode::generateIdentifierValue ( Module *  module,
BasicBlock *  block,
Value *  compositionIdentifierValue 
)

Generates a char * value prefixed with compositionIdentifierValue and suffixed with this node's identifier.

void VuoCompilerNode::generateInitFunctionCall ( Module *  module,
BasicBlock *  block,
Value *  compositionIdentifierValue 
)

Generates a call to nodeInstanceInit, stores the return value into the node's instance data, and retains the node's instance data.

Assumes the node is stateful. Assumes any trigger ports' function declarations have been generated.

Parameters
moduleThe destination LLVM module (i.e., generated code).
blockThe LLVM block to which to append the function call.
compositionIdentifierValueThe identifier of the composition containing this node.
Value * VuoCompilerNode::generateReceivedEventCondition ( Module *  module,
BasicBlock *  block,
Value *  nodeContextValue 
)

Generates a condition that is true if any of this node's input event ports have received an event.

Value * VuoCompilerNode::generateReceivedEventCondition ( Module *  module,
BasicBlock *  block,
Value *  nodeContextValue,
vector< VuoPort * >  selectedInputPorts,
const map< VuoCompilerEventPort *, Value * > &  portContextForEventPort = (map<VuoCompilerEventPort *, Value *>()) 
)

Generates a condition that is true if any of the given input event ports of this node have received an event.

Value * VuoCompilerNode::generateSerializedString ( Module *  module,
BasicBlock *  block,
Value *  compositionIdentifierValue 
)

Generates code that creates a Graphviz-formatted declaration for this node, with the node's fully-qualified identifier (including composition prefix) and the port and instance data values.

If this node is a subcomposition, compositionSerialize() is called to create the declaration of each contained node.

void VuoCompilerNode::generateUnserialization ( Module *  module,
Function *  function,
BasicBlock *&  block,
Value *  compositionIdentifierValue,
Value *  graphValue 
)

Generates code that sets this node's input port values and instance data from the declaration found in the given Graphviz graph (graph_t *).

If this node is a subcomposition, compositionUnserialize() is called to unserialize each contained node.

string VuoCompilerNode::getGraphvizDeclaration ( bool  shouldPrintPosition = false,
double  xPositionOffset = 0,
double  yPositionOffset = 0 
)

Returns a string containing the declaration for this node as it would appear in a .vuo (Graphviz dot format) file.

string VuoCompilerNode::getGraphvizIdentifier ( void  )

Gets the identifier that will appear in .vuo (Graphviz dot format) files.

string VuoCompilerNode::getGraphvizIdentifierPrefix ( void  )

Returns a suggested UpperCamelCase prefix for the node's Graphviz identifier, based on its title.

Removes non-alphanumeric characters, and uppercases the character after each former space. Removes non-alpha leading characters.

Example:
Node title "42 Fire on Start 42!" becomes `FireOnStart42`.
string VuoCompilerNode::getIdentifier ( void  )

Returns the identifier prefix in the generated LLVM bitcode for this node instance.

This identifier is derived from the Graphviz identifier.

Example:
Add2
VuoCompilerInstanceData * VuoCompilerNode::getInstanceData ( void  )

If this node is stateful, returns the instance data.

Otherwise null.

void VuoCompilerNode::setConstantStringCache ( VuoCompilerConstantStringCache constantStrings)

Sets the cache used to generate constant string values.

This must be called before generating bitcode.

void VuoCompilerNode::setGraphvizIdentifier ( string  graphvizIdentifier)

Sets the identifier that will appear in .vuo (Graphviz dot format) files.


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