The compiler detail class for VuoNode
.
Definition at line 25 of file VuoCompilerNode.hh.
Public Member Functions | |
VuoCompilerNode (VuoNode *baseNode) | |
Creates a compiler detail for the specified baseNode . More... | |
void | setIndexInOrderedNodes (size_t indexInOrderedNodes) |
Tells the node its index in VuoCompilerBitcodeGenerator::orderedNodes. More... | |
size_t | getIndexInOrderedNodes (void) |
Returns the node's index in VuoCompilerBitcodeGenerator::orderedNodes. More... | |
void | setConstantStringCache (VuoCompilerConstantStringCache *constantStrings) |
Sets the cache used to generate constant string values. More... | |
Value * | generateIdentifierValue (Module *module) |
Generates a constant char * value consisting of the node's identifier. More... | |
Value * | generateSubcompositionIdentifierValue (Module *module, BasicBlock *block, Value *compositionIdentifierValue) |
Generates a char * value prefixed with compositionIdentifierValue and suffixed with this node's identifier. More... | |
Value * | generateGetContext (Module *module, BasicBlock *block, Value *compositionStateValue) |
Generates code to look up the NodeContext * indexed under this node's full identifier (prefixed with the composition's identifier). More... | |
void | generateAddMetadata (Module *module, BasicBlock *block, Value *compositionStateValue, const vector< VuoCompilerType * > &orderedTypes, Function *compositionCreateContextForNode, Function *compositionSetPortValueFunction, Function *compositionGetPortValueFunction, Function *compositionFireTriggerPortEventFunction, Function *compositionReleasePortDataFunction) |
Generates code to register metadata for this node and each of its ports with the runtime. More... | |
Value * | generateCreateContext (Module *module, BasicBlock *block) |
Generates code to create the node context for this node and the port context for each of its ports. More... | |
void | generateEventFunctionCall (Module *module, Function *function, BasicBlock *¤tBlock, Value *compositionStateValue) |
Generates a call to nodeEvent or nodeInstanceEvent . More... | |
void | generateInitFunctionCall (Module *module, BasicBlock *block, Value *compositionStateValue) |
Generates a call to nodeInstanceInit , stores the return value into the node's instance data, and retains the node's instance data. More... | |
void | generateFiniFunctionCall (Module *module, BasicBlock *block, Value *compositionStateValue) |
Generates a call to nodeInstanceFini and releases the node's instance data. More... | |
void | generateCallbackStartFunctionCall (Module *module, BasicBlock *block, Value *compositionStateValue) |
Generates a call to nodeInstanceTriggerStart , if the function exists. More... | |
void | generateCallbackUpdateFunctionCall (Module *module, BasicBlock *block, Value *compositionStateValue) |
Generates a call to nodeInstanceTriggerUpdate , if the function exists. More... | |
void | generateCallbackStopFunctionCall (Module *module, BasicBlock *block, Value *compositionStateValue) |
Generates a call to nodeInstanceTriggerStop , if the function exists. More... | |
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. More... | |
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. More... | |
VuoCompilerInstanceData * | getInstanceData (void) |
If this node is stateful, returns the instance data. More... | |
string | getIdentifier (void) |
Returns the identifier prefix in the generated LLVM bitcode for this node instance. More... | |
string | getGraphvizIdentifierPrefix (void) |
Returns a suggested UpperCamelCase prefix for the node's Graphviz identifier, based on its title. More... | |
void | setGraphvizIdentifier (string graphvizIdentifier) |
Sets the identifier that will appear in .vuo (Graphviz dot format) files. More... | |
string | getGraphvizIdentifier (void) |
Gets the identifier that will appear in .vuo (Graphviz dot format) files. More... | |
string | getGraphvizDeclaration (bool shouldPrintPosition=false, double xPositionOffset=0, double yPositionOffset=0, VuoPort *manuallyFirableInputPort=nullptr) |
Returns a string containing the declaration for this node as it would appear in a .vuo (Graphviz dot format) file. More... | |
![]() | |
VuoBaseDetail (string description, VuoNode *base) | |
Creates a detail class. More... | |
VuoNode * | getBase (void) const |
Returns the detail class instance's base class instance. More... | |
void | setBase (VuoNode *base) |
Sets the detail class instance's base class instance. More... | |
VuoCompilerNode::VuoCompilerNode | ( | VuoNode * | baseNode | ) |
Creates a compiler detail for the specified baseNode
.
Definition at line 34 of file VuoCompilerNode.cc.
void VuoCompilerNode::generateAddMetadata | ( | Module * | module, |
BasicBlock * | block, | ||
Value * | compositionStateValue, | ||
const vector< VuoCompilerType * > & | orderedTypes, | ||
Function * | compositionCreateContextForNode, | ||
Function * | compositionSetPortValueFunction, | ||
Function * | compositionGetPortValueFunction, | ||
Function * | compositionFireTriggerPortEventFunction, | ||
Function * | compositionReleasePortDataFunction | ||
) |
Generates code to register metadata for this node and each of its ports with the runtime.
If this node is a subcomposition, the generated code calls compositionAddNodeMetadata()
for the subcomposition.
Definition at line 119 of file VuoCompilerNode.cc.
void VuoCompilerNode::generateCallbackStartFunctionCall | ( | Module * | module, |
BasicBlock * | block, | ||
Value * | compositionStateValue | ||
) |
Generates a call to nodeInstanceTriggerStart
, if the function exists.
module | The destination LLVM module (i.e., generated code). |
block | The LLVM block to which to append the function call. |
compositionStateValue | The VuoCompositionState * of the composition containing this node. |
VuoCompilerException | Failed to generate the call, possibly due to a bug in the compiler or node class. |
Definition at line 371 of file VuoCompilerNode.cc.
void VuoCompilerNode::generateCallbackStopFunctionCall | ( | Module * | module, |
BasicBlock * | block, | ||
Value * | compositionStateValue | ||
) |
Generates a call to nodeInstanceTriggerStop
, if the function exists.
module | The destination LLVM module (i.e., generated code). |
block | The LLVM block to which to append the function call. |
compositionStateValue | The VuoCompositionState * of the composition containing this node. |
VuoCompilerException | Failed to generate the call, possibly due to a bug in the compiler or node class. |
Definition at line 407 of file VuoCompilerNode.cc.
void VuoCompilerNode::generateCallbackUpdateFunctionCall | ( | Module * | module, |
BasicBlock * | block, | ||
Value * | compositionStateValue | ||
) |
Generates a call to nodeInstanceTriggerUpdate
, if the function exists.
module | The destination LLVM module (i.e., generated code). |
block | The LLVM block to which to append the function call. |
compositionStateValue | The VuoCompositionState * of the composition containing this node. |
VuoCompilerException | Failed to generate the call, possibly due to a bug in the compiler or node class. |
Definition at line 389 of file VuoCompilerNode.cc.
Value * VuoCompilerNode::generateCreateContext | ( | Module * | module, |
BasicBlock * | block | ||
) |
Generates code to create the node context for this node and the port context for each of its ports.
Definition at line 187 of file VuoCompilerNode.cc.
void VuoCompilerNode::generateEventFunctionCall | ( | Module * | module, |
Function * | function, | ||
BasicBlock *& | currentBlock, | ||
Value * | compositionStateValue | ||
) |
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.
module | The destination LLVM module (i.e., generated code). |
function | The function in which to generate code. |
currentBlock | The block in which to generate code. |
compositionStateValue | The VuoCompositionState * of the composition containing this node. |
VuoCompilerException | Failed to generate the call, possibly due to a bug in the compiler or node class. |
Definition at line 230 of file VuoCompilerNode.cc.
void VuoCompilerNode::generateFiniFunctionCall | ( | Module * | module, |
BasicBlock * | block, | ||
Value * | compositionStateValue | ||
) |
Generates a call to nodeInstanceFini
and releases the node's instance data.
Assumes the node is stateful.
module | The destination LLVM module (i.e., generated code). |
block | The LLVM block to which to append the function call. |
compositionStateValue | The VuoCompositionState * of the composition containing this node. |
VuoCompilerException | Failed to generate the call, possibly due to a bug in the compiler or node class. |
Definition at line 350 of file VuoCompilerNode.cc.
Value * VuoCompilerNode::generateGetContext | ( | Module * | module, |
BasicBlock * | block, | ||
Value * | compositionStateValue | ||
) |
Generates code to look up the NodeContext *
indexed under this node's full identifier (prefixed with the composition's identifier).
Definition at line 110 of file VuoCompilerNode.cc.
Value * VuoCompilerNode::generateIdentifierValue | ( | Module * | module | ) |
Generates a constant char *
value consisting of the node's identifier.
Definition at line 88 of file VuoCompilerNode.cc.
void VuoCompilerNode::generateInitFunctionCall | ( | Module * | module, |
BasicBlock * | block, | ||
Value * | compositionStateValue | ||
) |
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.
module | The destination LLVM module (i.e., generated code). |
block | The LLVM block to which to append the function call. |
compositionStateValue | The VuoCompositionState * of the composition containing this node. |
VuoCompilerException | Failed to generate the call, possibly due to a bug in the compiler or node class. |
Definition at line 324 of file VuoCompilerNode.cc.
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.
Definition at line 732 of file VuoCompilerNode.cc.
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.
Definition at line 740 of file VuoCompilerNode.cc.
Value * VuoCompilerNode::generateSubcompositionIdentifierValue | ( | Module * | module, |
BasicBlock * | block, | ||
Value * | compositionIdentifierValue | ||
) |
Generates a char *
value prefixed with compositionIdentifierValue and suffixed with this node's identifier.
The caller is responsible for generating code to free the value.
This needs to be kept in sync with VuoStringUtilities::buildCompositionIdentifier().
Definition at line 99 of file VuoCompilerNode.cc.
string VuoCompilerNode::getGraphvizDeclaration | ( | bool | shouldPrintPosition = false , |
double | xPositionOffset = 0 , |
||
double | yPositionOffset = 0 , |
||
VuoPort * | manuallyFirableInputPort = nullptr |
||
) |
Returns a string containing the declaration for this node as it would appear in a .vuo (Graphviz dot format) file.
Definition at line 819 of file VuoCompilerNode.cc.
string VuoCompilerNode::getGraphvizIdentifier | ( | void | ) |
Gets the identifier that will appear in .vuo (Graphviz dot format) files.
Definition at line 810 of file VuoCompilerNode.cc.
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.
Definition at line 789 of file VuoCompilerNode.cc.
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.
Definition at line 776 of file VuoCompilerNode.cc.
size_t VuoCompilerNode::getIndexInOrderedNodes | ( | void | ) |
Returns the node's index in VuoCompilerBitcodeGenerator::orderedNodes.
Definition at line 61 of file VuoCompilerNode.cc.
VuoCompilerInstanceData * VuoCompilerNode::getInstanceData | ( | void | ) |
If this node is stateful, returns the instance data.
Otherwise null.
Definition at line 765 of file VuoCompilerNode.cc.
void VuoCompilerNode::setConstantStringCache | ( | VuoCompilerConstantStringCache * | constantStrings | ) |
Sets the cache used to generate constant string values.
This must be called before generating bitcode.
Definition at line 69 of file VuoCompilerNode.cc.
void VuoCompilerNode::setGraphvizIdentifier | ( | string | graphvizIdentifier | ) |
Sets the identifier that will appear in .vuo (Graphviz dot format) files.
Definition at line 802 of file VuoCompilerNode.cc.
void VuoCompilerNode::setIndexInOrderedNodes | ( | size_t | indexInOrderedNodes | ) |
Tells the node its index in VuoCompilerBitcodeGenerator::orderedNodes.
This must be called before generating bitcode.
Definition at line 53 of file VuoCompilerNode.cc.