A trigger output port.
Definition at line 21 of file VuoCompilerTriggerPort.hh.
Public Member Functions | |
VuoCompilerTriggerPort (VuoPort *basePort) | |
Creates a trigger port based on portClass . More... | |
Value * | generateCreatePortContext (Module *module, BasicBlock *block) |
Generates code to create a heap-allocated PortContext, with the triggerQueue and triggerSemaphore initialized. More... | |
Function * | generateSynchronousSubmissionToDispatchQueue (Module *module, BasicBlock *block, Value *nodeContextValue, string workerFunctionName, Value *workerFunctionArg=NULL) |
Generates code to submit a task to this trigger's dispatch queue. More... | |
Function * | getWorkerFunction (Module *module, string functionName, bool isExternal=false) |
Returns a function of type dispatch_function_t . More... | |
void | generateSignalForSemaphore (Module *module, BasicBlock *block, Value *nodeContextValue) |
Generates code to signal the trigger's semaphore. More... | |
Value * | generateLoadFunction (Module *module, BasicBlock *block, Value *nodeContextValue) |
Generates code to get the function pointer for the trigger scheduler function. More... | |
void | generateStoreFunction (Module *module, BasicBlock *block, Value *nodeContextValue, Value *functionValue) |
Generates code to set the function pointer for the trigger scheduler function. More... | |
Value * | generateLoadPreviousData (Module *module, BasicBlock *block, Value *nodeContextValue) |
Generates code to get the data most recently fired from the trigger. More... | |
void | generateFreeContext (Module *module, BasicBlock *block, Function *workerFunction) |
Generates code to deallocate the context and its contents created by generateAsynchronousSubmissionToDispatchQueue() and passed to workerFunction. More... | |
Value * | generateCompositionStateValue (Module *module, BasicBlock *block, Function *workerFunction) |
Generates code to get the composition state from the context created by generateAsynchronousSubmissionToDispatchQueue() and passed to workerFunction. More... | |
Value * | generateDataValue (Module *module, BasicBlock *block, Function *workerFunction) |
Generates code to get the trigger data value from the context created by generateAsynchronousSubmissionToDispatchQueue() and passed to workerFunction. More... | |
Value * | generateEventIdValue (Module *module, BasicBlock *block, Function *workerFunction) |
Generates code to get the event ID from the context created by generateAsynchronousSubmissionToDispatchQueue() and passed to workerFunction. More... | |
Value * | generateDataValueUpdate (Module *module, BasicBlock *block, Function *workerFunction, Value *nodeContextValue) |
Generates code to update the trigger's data value (if any) with the worker function argument. More... | |
void | generateDataValueDiscardFromWorker (Module *module, BasicBlock *block, Function *workerFunction) |
Generates code to discard the data value in the worker function argument without updating the trigger's data value. More... | |
Type * | getDataType (void) |
Returns the type of data associated with the trigger, or NULL if the trigger is event-only. More... | |
VuoCompilerTriggerPortClass * | getClass (void) |
Returns the trigger port class of this trigger port. More... | |
Public Member Functions inherited from VuoCompilerPort | |
bool | hasConnectedCable (void) const |
Returns a boolean indicating whether this port has any attached cables. More... | |
bool | hasConnectedDataCable (void) const |
Returns a boolean indicating whether this port has any attached data+event cables. More... | |
VuoType * | getDataVuoType (void) |
Returns this port's data type, or null if this port is event-only. More... | |
void | setDataVuoType (VuoType *dataType) |
Sets the data type for this port, overriding the type from the port class. More... | |
void | setNodeIdentifier (string nodeIdentifier) |
Sets an identifier that will be part of the string returned by getIdentifier(). More... | |
virtual string | getIdentifier (void) |
Returns a unique, consistent identifier for this port. More... | |
void | setIndexInPortContexts (int indexInPortContexts) |
Sets the index of this node within the array of port contexts within the node context. More... | |
int | getIndexInPortContexts (void) |
Returns the index of this node within the array of port contexts within the node context. More... | |
void | setConstantStringCache (VuoCompilerConstantStringCache *constantStrings) |
Sets the cache used to generate constant string values. More... | |
Value * | getDataVariable (Module *module, BasicBlock *block, Value *nodeContextValue) |
Returns the address of the data field within this port's context. More... | |
Value * | generateGetPortContext (Module *module, BasicBlock *block, Value *nodeContextValue) |
Returns this port's context. More... | |
Public Member Functions inherited from VuoCompilerNodeArgument | |
virtual | ~VuoCompilerNodeArgument (void) |
Destructor. More... | |
Public Member Functions inherited from VuoBaseDetail< VuoPort > | |
VuoBaseDetail (string description, VuoPort *base) | |
Creates a detail class. More... | |
VuoPort * | getBase (void) const |
Returns the detail class instance's base class instance. More... | |
void | setBase (VuoPort *base) |
Sets the detail class instance's base class instance. More... | |
Static Public Member Functions | |
static void | generateScheduleWorker (Module *module, Function *function, BasicBlock *block, Value *compositionStateValue, Value *eventIdValue, Value *portContextValue, VuoType *dataType, int minThreadsNeeded, int maxThreadsNeeded, int chainCount, Function *workerFunction) |
Generates code that schedules the worker function for this trigger to execute on the trigger's dispatch queue. More... | |
static Value * | generateNonBlockingWaitForSemaphore (Module *module, BasicBlock *block, Value *portContextValue) |
Generates code to try to claim the trigger's semaphore. More... | |
static void | generateDataValueDiscardFromScheduler (Module *module, Function *function, BasicBlock *block, VuoType *dataType) |
Generates code to discard the scheduler function argument without updating the trigger's data value. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from VuoCompilerPort | |
VuoCompilerPort (VuoPort *basePort) | |
Creates a compiler detail from a given basePort . More... | |
Protected Member Functions inherited from VuoCompilerNodeArgument | |
VuoCompilerNodeArgument (VuoPort *basePort) | |
Creates an argument instance based on the specified argumentClass . More... | |
Protected Attributes inherited from VuoCompilerPort | |
VuoCompilerConstantStringCache * | constantStrings |
Cache used to generate constant string values. More... | |
VuoCompilerTriggerPort::VuoCompilerTriggerPort | ( | VuoPort * | basePort | ) |
Creates a trigger port based on portClass
.
Definition at line 20 of file VuoCompilerTriggerPort.cc.
Value * VuoCompilerTriggerPort::generateCompositionStateValue | ( | Module * | module, |
BasicBlock * | block, | ||
Function * | workerFunction | ||
) |
Generates code to get the composition state from the context created by generateAsynchronousSubmissionToDispatchQueue() and passed to workerFunction.
Definition at line 198 of file VuoCompilerTriggerPort.cc.
|
virtual |
Generates code to create a heap-allocated PortContext, with the triggerQueue
and triggerSemaphore
initialized.
PortContext *
. Implements VuoCompilerPort.
Definition at line 30 of file VuoCompilerTriggerPort.cc.
Value * VuoCompilerTriggerPort::generateDataValue | ( | Module * | module, |
BasicBlock * | block, | ||
Function * | workerFunction | ||
) |
Generates code to get the trigger data value from the context created by generateAsynchronousSubmissionToDispatchQueue() and passed to workerFunction.
Definition at line 216 of file VuoCompilerTriggerPort.cc.
|
static |
Generates code to discard the scheduler function argument without updating the trigger's data value.
Definition at line 290 of file VuoCompilerTriggerPort.cc.
void VuoCompilerTriggerPort::generateDataValueDiscardFromWorker | ( | Module * | module, |
BasicBlock * | block, | ||
Function * | workerFunction | ||
) |
Generates code to discard the data value in the worker function argument without updating the trigger's data value.
Definition at line 301 of file VuoCompilerTriggerPort.cc.
Value * VuoCompilerTriggerPort::generateDataValueUpdate | ( | Module * | module, |
BasicBlock * | block, | ||
Function * | workerFunction, | ||
Value * | nodeContextValue | ||
) |
Generates code to update the trigger's data value (if any) with the worker function argument.
Definition at line 258 of file VuoCompilerTriggerPort.cc.
Value * VuoCompilerTriggerPort::generateEventIdValue | ( | Module * | module, |
BasicBlock * | block, | ||
Function * | workerFunction | ||
) |
Generates code to get the event ID from the context created by generateAsynchronousSubmissionToDispatchQueue() and passed to workerFunction.
Definition at line 236 of file VuoCompilerTriggerPort.cc.
void VuoCompilerTriggerPort::generateFreeContext | ( | Module * | module, |
BasicBlock * | block, | ||
Function * | workerFunction | ||
) |
Generates code to deallocate the context and its contents created by generateAsynchronousSubmissionToDispatchQueue() and passed to workerFunction.
Definition at line 188 of file VuoCompilerTriggerPort.cc.
Value * VuoCompilerTriggerPort::generateLoadFunction | ( | Module * | module, |
BasicBlock * | block, | ||
Value * | nodeContextValue | ||
) |
Generates code to get the function pointer for the trigger scheduler function.
Definition at line 160 of file VuoCompilerTriggerPort.cc.
Value * VuoCompilerTriggerPort::generateLoadPreviousData | ( | Module * | module, |
BasicBlock * | block, | ||
Value * | nodeContextValue | ||
) |
Generates code to get the data most recently fired from the trigger.
Definition at line 178 of file VuoCompilerTriggerPort.cc.
|
static |
Generates code to try to claim the trigger's semaphore.
Returns the value returned by dispatch_semaphore_wait
, which can be checked to determine if the semaphore was claimed.
Definition at line 139 of file VuoCompilerTriggerPort.cc.
|
static |
Generates code that schedules the worker function for this trigger to execute on the trigger's dispatch queue.
The caller is responsible for filling in the body of workerFunction.
If this trigger carries data, the argument to function is stored in a context value that is passed to workerFunction.
Definition at line 46 of file VuoCompilerTriggerPort.cc.
void VuoCompilerTriggerPort::generateSignalForSemaphore | ( | Module * | module, |
BasicBlock * | block, | ||
Value * | nodeContextValue | ||
) |
Generates code to signal the trigger's semaphore.
Definition at line 150 of file VuoCompilerTriggerPort.cc.
void VuoCompilerTriggerPort::generateStoreFunction | ( | Module * | module, |
BasicBlock * | block, | ||
Value * | nodeContextValue, | ||
Value * | functionValue | ||
) |
Generates code to set the function pointer for the trigger scheduler function.
Definition at line 169 of file VuoCompilerTriggerPort.cc.
Function * VuoCompilerTriggerPort::generateSynchronousSubmissionToDispatchQueue | ( | Module * | module, |
BasicBlock * | block, | ||
Value * | nodeContextValue, | ||
string | workerFunctionName, | ||
Value * | workerFunctionArg = NULL |
||
) |
Generates code to submit a task to this trigger's dispatch queue.
Returns the worker function, which will be called by the dispatch queue to execute the task. The caller is responsible for filling in the body of the worker function.
Definition at line 92 of file VuoCompilerTriggerPort.cc.
VuoCompilerTriggerPortClass * VuoCompilerTriggerPort::getClass | ( | void | ) |
Returns the trigger port class of this trigger port.
Definition at line 324 of file VuoCompilerTriggerPort.cc.
Type * VuoCompilerTriggerPort::getDataType | ( | void | ) |
Returns the type of data associated with the trigger, or NULL if the trigger is event-only.
Definition at line 315 of file VuoCompilerTriggerPort.cc.
Function * VuoCompilerTriggerPort::getWorkerFunction | ( | Module * | module, |
string | functionName, | ||
bool | isExternal = false |
||
) |
Returns a function of type dispatch_function_t
.
Definition at line 114 of file VuoCompilerTriggerPort.cc.