Handy methods for generating code.
Definition at line 22 of file VuoCompilerCodeGenUtilities.hh.
Static Public Member Functions | |
static Value * | generateCreateDispatchSemaphore (Module *module, BasicBlock *block, int initialValue=1) |
Generates code that constructs a dispatch_semaphore_t. More... | |
static Value * | generateWaitForSemaphore (Module *module, BasicBlock *block, Value *semaphoreValue) |
Generates code that waits for and claims a dispatch_semaphore_t, with a timeout of DISPATCH_TIME_FOREVER . More... | |
static Value * | generateWaitForSemaphore (Module *module, BasicBlock *block, AllocaInst *semaphoreVariable) |
Generates code that waits for and claims a dispatch_semaphore_t, with a timeout of DISPATCH_TIME_FOREVER . More... | |
static Value * | generateWaitForSemaphore (Module *module, BasicBlock *block, Value *semaphoreValue, Value *timeoutValue) |
Generates code that waits for and possibly claims a dispatch_semaphore_t. More... | |
static Value * | generateWaitForSemaphore (Module *module, BasicBlock *block, AllocaInst *semaphoreVariable, Value *timeoutValue) |
Generates code that waits for and possibly claims a dispatch_semaphore_t. More... | |
static void | generateSignalForSemaphore (Module *module, BasicBlock *block, Value *semaphoreValue) |
Generates code that signals a dispatch_semaphore_t. More... | |
static void | generateSignalForSemaphore (Module *module, BasicBlock *block, AllocaInst *semaphoreVariable) |
Generates code that signals a dispatch_semaphore_t. More... | |
static Value * | generateCreateDispatchGroup (Module *module, BasicBlock *block) |
Generates code that constructs a dispatch_group_t. More... | |
static void | generateEnterDispatchGroup (Module *module, BasicBlock *block, Value *dispatchGroupValue) |
Generates code that increments the block count of a dispatch_group_t. More... | |
static void | generateLeaveDispatchGroup (Module *module, BasicBlock *block, Value *dispatchGroupValue) |
Generates code that decrements the block count of a dispatch_group_t. More... | |
static void | generateWaitForDispatchGroup (Module *module, BasicBlock *block, Value *dispatchGroupValue, dispatch_time_t timeout=DISPATCH_TIME_FOREVER) |
Generates code that waits on a dispatch_group_t. More... | |
static Value * | generateGetGlobalDispatchQueue (Module *module, BasicBlock *block) |
Generates code that retrieves the global dispatch queue. More... | |
static Value * | generateCreateDispatchQueue (Module *module, BasicBlock *block, string dispatchQueueName) |
Generates code that constructs a dispatch_queue_t. More... | |
static void | generateAsynchronousSubmissionToDispatchQueue (Module *module, BasicBlock *block, Value *dispatchQueueValue, Function *workerFunction, Value *contextValue) |
Generates code that submits a function for asynchronous execution on a dispatch queue. More... | |
static void | generateSynchronousSubmissionToDispatchQueue (Module *module, BasicBlock *block, Value *dispatchQueueValue, Function *workerFunction, Value *contextValue) |
Generates code that submits a function for synchronous execution on a dispatch queue. More... | |
static void | generateRetainForDispatchObject (Module *module, BasicBlock *block, Value *dispatchObjectVariable) |
Generates code that retains a dispatch_object_t (dispatch_queue_t, dispatch_group_t, dispatch_semaphore_t, etc.). More... | |
static void | generateFinalizationForDispatchObject (Module *module, BasicBlock *block, Value *dispatchObjectVariable) |
Generates code that releases a dispatch_object_t (dispatch_queue_t, dispatch_group_t, dispatch_semaphore_t, etc.). More... | |
static Value * | generateCreateDispatchTime (Module *module, BasicBlock *block, Value *deltaValue) |
Generates code that creates a dispatch_time_t by calling dispatch_time_create(DISPATCH_TIME_NOW, ...) . More... | |
static Value * | generateCreatePortContext (Module *module, BasicBlock *block, Type *dataType, bool isTrigger, std::string triggerQueueName) |
Generates code that allocates a PortContext on the heap and initializes it with default values. More... | |
static void | generateSetPortContextEvent (Module *module, BasicBlock *block, Value *portContextValue, Value *eventValue) |
Generates code that sets the event field of a PortContext. More... | |
static void | generateSetPortContextData (Module *module, BasicBlock *block, Value *portContextValue, Value *dataValue) |
Generates code that sets the data field of a PortContext to a heap-allocated copy of dataValue. More... | |
static void | generateSetPortContextTriggerFunction (Module *module, BasicBlock *block, Value *portContextValue, Value *triggerFunctionValue) |
Generates code that sets the triggerFunction field of a PortContext. More... | |
static Value * | generateGetPortContextEvent (Module *module, BasicBlock *block, Value *portContextValue) |
Generates code that gets the event field of a PortContext. More... | |
static Value * | generateGetPortContextData (Module *module, BasicBlock *block, Value *portContextValue, Type *dataType) |
Generates code that gets the data field of a PortContext (and dereferences it to extract the actual data). More... | |
static Value * | generateGetPortContextDataVariable (Module *module, BasicBlock *block, Value *portContextValue, Type *dataType) |
Generates code that gets the address of the data field of a PortContext. More... | |
static Value * | generateGetPortContextDataVariableAsVoidPointer (Module *module, BasicBlock *block, Value *portContextValue) |
Generates code that gets the address of the data field of a PortContext as a void pointer. More... | |
static Value * | generateGetPortContextTriggerQueue (Module *module, BasicBlock *block, Value *portContextValue) |
Generates code that gets the triggerQueue field of a PortContext. More... | |
static Value * | generateGetPortContextTriggerSemaphore (Module *module, BasicBlock *block, Value *portContextValue) |
Generates code that gets the triggerSemaphore field of a PortContext. More... | |
static Value * | generateGetPortContextTriggerFunction (Module *module, BasicBlock *block, Value *portContextValue, FunctionType *functionType) |
Generates code that gets the triggerFunction field of a PortContext. More... | |
static void | generateRetainPortContextData (Module *module, BasicBlock *block, Value *portContextValue) |
Generates code that calls vuoRetainPortContextData() . More... | |
static Value * | generateCreateNodeContext (Module *module, BasicBlock *block, bool hasInstanceData, bool isComposition, size_t outputEventCount) |
Generates code that allocates a NodeContext on the heap and initializes it with default values. More... | |
static void | generateSetNodeContextPortContexts (Module *module, BasicBlock *block, Value *nodeContextValue, vector< Value * > portContextValues) |
Generates code that sets the portContexts and portContextCount fields of a NodeContext. More... | |
static void | generateSetNodeContextInstanceData (Module *module, BasicBlock *block, Value *nodeContextValue, Value *instanceDataValue) |
Generates code that sets the instanceData field of a NodeContext (to a heap-allocated copy of instanceDataValue) and frees the old value. More... | |
static void | generateSetNodeContextClaimingEventId (Module *module, BasicBlock *block, Value *nodeContextValue, Value *claimingEventIdValue) |
Generates code that sets the claimingEventId field of a NodeContext. More... | |
static void | generateSetNodeContextOutputEvent (Module *module, BasicBlock *block, Value *nodeContextValue, size_t index, Value *eventValue) |
Generates code that sets an element of the outputEvents field of a NodeContext. More... | |
static Value * | generateGetNodeContextPortContext (Module *module, BasicBlock *block, Value *nodeContextValue, int index) |
Generates code that gets an element of the portContexts field of a NodeContext. More... | |
static Value * | generateGetNodeContextInstanceData (Module *module, BasicBlock *block, Value *nodeContextValue, Type *instanceDataType) |
Generates code that gets the instanceData field of a NodeContext (and dereference it to get the actual instance data). More... | |
static Value * | generateGetNodeContextInstanceDataVariable (Module *module, BasicBlock *block, Value *nodeContextValue, Type *instanceDataType) |
Generates code that gets the address of the instanceData field of a NodeContext. More... | |
static Value * | generateGetNodeContextSemaphore (Module *module, BasicBlock *block, Value *nodeContextValue) |
Generates code that gets the semaphore field of a NodeContext. More... | |
static Value * | generateGetNodeContextClaimingEventId (Module *module, BasicBlock *block, Value *nodeContextValue) |
Generates code that gets the claimingEventId field of a NodeContext. More... | |
static Value * | generateGetNodeContextExecutingGroup (Module *module, BasicBlock *block, Value *nodeContextValue) |
Generates code that gets the executingGroup field of a NodeContext. More... | |
static Value * | generateGetNodeContextOutputEvent (Module *module, BasicBlock *block, Value *nodeContextValue, size_t index) |
Generates code that gets an element of the outputEvents field of a NodeContext. More... | |
static void | generateResetNodeContextEvents (Module *module, BasicBlock *block, Value *nodeContextValue) |
Generates code that sets the event field to false for all PortContexts in a NodeContext. More... | |
static void | generateStartedExecutingEvent (Module *module, BasicBlock *block, Value *nodeContextValue, Value *eventIdValue) |
Generates a call to vuoStartedExecutingEvent . More... | |
static void | generateSpunOffExecutingEvent (Module *module, BasicBlock *block, Value *nodeContextValue, Value *eventIdValue) |
Generates a call to vuoSpunOffExecutingEvent . More... | |
static Value * | generateFinishedExecutingEvent (Module *module, BasicBlock *block, Value *nodeContextValue, Value *eventIdValue) |
Generates a call to vuoFinishedExecutingEvent . More... | |
static Value * | generateGetOneExecutingEvent (Module *module, BasicBlock *block, Value *nodeContextValue) |
Generates a call to vuoGetOneExecutingEvent . More... | |
static Value * | generateCreateCompositionState (Module *module, BasicBlock *block, Value *runtimeStateValue, Value *compositionIdentifierValue) |
Generates code that creates a VuoCompositionState * from the given void *runtimeState and char *compositionIdentifier . More... | |
static Value * | generateGetCompositionStateRuntimeState (Module *module, BasicBlock *block, Value *compositionStateValue) |
Generates code that gets the runtimeState field of a VuoCompositionState * . More... | |
static Value * | generateGetCompositionStateCompositionIdentifier (Module *module, BasicBlock *block, Value *compositionStateValue) |
Generates code that gets the compositionIdentifier field of a VuoCompositionState * . More... | |
static void | generateFreeCompositionState (Module *module, BasicBlock *block, Value *compositionStateValue) |
Generates code that frees a VuoCompositionState * (but not its fields). More... | |
static Value * | generateGetDataForPort (Module *module, BasicBlock *block, Value *compositionStateValue, Value *portIdentifierValue) |
Generates code that retrives the data field in a port's context, given the port's identifier. More... | |
static Value * | generateGetNodeSemaphoreForPort (Module *module, BasicBlock *block, Value *compositionStateValue, Value *portIdentifierValue) |
Generates code that retrives the semaphore field in a node's context, given the identifier of a port on the node. More... | |
static Value * | generateGetNodeIndexForPort (Module *module, BasicBlock *block, Value *compositionStateValue, Value *portIdentifierValue) |
Generates code that retrieves the index (in VuoCompilerBitcodeGenerator::orderedNodes) of a node, given the identifier of a port on the node. More... | |
static Value * | generateGetTypeIndexForPort (Module *module, BasicBlock *block, Value *compositionStateValue, Value *portIdentifierValue) |
Generates code that retrieves the index (in VuoCompilerBitcodeGenerator::orderedTypes) of a port's type, given the port's identifier. More... | |
static void | generateScheduleTriggerWorker (Module *module, BasicBlock *block, Value *queueValue, Value *contextValue, Value *workerFunctionValue, int minThreadsNeeded, int maxThreadsNeeded, Value *eventIdValue, Value *compositionStateValue, int chainCount) |
Generates a call to vuoScheduleTriggerWorker . More... | |
static void | generateScheduleChainWorker (Module *module, BasicBlock *block, Value *queueValue, Value *contextValue, Value *workerFunctionValue, int minThreadsNeeded, int maxThreadsNeeded, Value *eventIdValue, Value *compositionStateValue, size_t chainIndex, vector< size_t > upstreamChainIndices) |
Generates a call to vuoScheduleChainWorker . More... | |
static void | generateGrantThreadsToChain (Module *module, BasicBlock *block, int minThreadsNeeded, int maxThreadsNeeded, Value *eventIdValue, Value *compositionStateValue, size_t chainIndex) |
Generates a call to vuoGrantThreadsToChain . More... | |
static void | generateGrantThreadsToSubcomposition (Module *module, BasicBlock *block, Value *eventIdValue, Value *compositionStateValue, Value *chainIndexValue, Value *subcompositionIdentifierValue) |
Generates a call to vuoGrantThreadsToSubcomposition . More... | |
static void | generateReturnThreadsForTriggerWorker (Module *module, BasicBlock *block, Value *eventIdValue, Value *compositionStateValue) |
Generates a call to vuoReturnThreadsForTriggerWorker . More... | |
static void | generateReturnThreadsForChainWorker (Module *module, BasicBlock *block, Value *eventIdValue, Value *compositionStateValue, Value *chainIndexValue) |
Generates a call to vuoReturnThreadsForChainWorker . More... | |
static void | generateSetArrayElement (Module *module, BasicBlock *block, Value *arrayValue, size_t elementIndex, Value *value) |
Generates code that sets the array element at the given index. More... | |
static Value * | generateGetArrayElement (Module *module, BasicBlock *block, Value *arrayValue, size_t elementIndex) |
Generates code that gets the array element at the given index. More... | |
static Value * | generateGetArrayElement (Module *module, BasicBlock *block, Value *arrayValue, Value *elementIndexValue) |
Generates code that gets the array element at the given index. More... | |
static void | generateSetStructPointerElement (Module *module, BasicBlock *block, Value *structPointer, size_t elementIndex, Value *value) |
Generates code that sets the struct element at the given index. More... | |
static Value * | generateGetStructPointerElement (Module *module, BasicBlock *block, Value *structPointer, size_t elementIndex) |
Generates code that gets the struct element at the given index. More... | |
static Value * | generatePointerToValue (BasicBlock *block, Value *value) |
Generates code that creates a pointer to value (on the stack), and returns the pointer. More... | |
static Constant * | generatePointerToConstantString (Module *module, string stringValue, string globalVariableName="") |
Generates code that creates a global string variable. More... | |
static Constant * | generatePointerToConstantArrayOfStrings (Module *module, vector< string > stringValues, string globalVariableName="") |
Generates code that creates a global array-of-strings variable. More... | |
static void | generateStringMatchingCode (Module *module, Function *function, BasicBlock *initialBlock, BasicBlock *finalBlock, Value *inputStringValue, map< string, pair< BasicBlock *, BasicBlock * > > blocksForString, VuoCompilerConstantStringCache &constantStrings) |
Generates a series of if-else statements for testing if an input string is equal to any of a set of constant strings, and executing the corresponding block of code if it is. More... | |
static void | generateIndexMatchingCode (Module *module, Function *function, BasicBlock *initialBlock, BasicBlock *finalBlock, Value *inputIndexValue, vector< pair< BasicBlock *, BasicBlock * > > blocksForIndex) |
Generates a series of if-else statements for testing if an input index is equal to any of a set of indices, and executing the corresponding block of code if it is. More... | |
static Value * | generateFormattedString (Module *module, BasicBlock *block, string formatString, vector< Value * > replacementValues, VuoCompilerConstantStringCache &constantStrings) |
Generates code that allocates a buffer to hold the composite string, then calls snprintf to combine the format string and replacement values into the composite string. More... | |
static Value * | generateStringConcatenation (Module *module, BasicBlock *block, vector< Value * > stringsToConcatenate, VuoCompilerConstantStringCache &constantStrings) |
Generates code that allocates a buffer to hold the composite string, then concatenates each member of stringsToConcatenate into the composite string. More... | |
static Value * | generateMemoryAllocation (Module *module, BasicBlock *block, Type *elementType, int elementCount) |
Generates code that dynamically allocates memory for an array. More... | |
static Value * | generateMemoryAllocation (Module *module, BasicBlock *block, Type *elementType, Value *elementCountValue) |
Generates code that dynamically allocates memory for an array. More... | |
static Value * | generateTypeCast (Module *module, BasicBlock *block, Value *valueToCast, Type *typeToCastTo) |
Generates code to cast the value to the desired type (if it doesn't already have that type). More... | |
static void | generateAnnotation (Module *module, BasicBlock *block, Value *value, string annotation, string fileName, unsigned int lineNumber, VuoCompilerConstantStringCache &constantStrings) |
Generates a call to llvm.var.annotation , which annotates a value with a string. More... | |
static void | generateModuleMetadata (Module *module, string metadata, string moduleKey) |
Generates code equivalent to the VuoModuleMetadata macro. More... | |
static void | generateRegisterCall (Module *module, BasicBlock *block, Value *argument, Function *freeFunction) |
Generates code to register argument. More... | |
static void | generateRetainCall (Module *module, BasicBlock *block, Value *argument) |
Generates any code needed to retain argument . More... | |
static void | generateReleaseCall (Module *module, BasicBlock *block, Value *argument) |
Generates any code needed to release argument . More... | |
static bool | isRetainOrReleaseNeeded (Type *type) |
Returns true if VuoCompilerCodeGenUtilities::generateRetainCall and VuoCompilerCodeGenUtilities::generateReleaseCall would generate any code for type. More... | |
static void | generateFreeCall (Module *module, BasicBlock *block, Value *argument) |
Generates a call to free argument (after casting it to a void pointer). More... | |
static void | generateJsonObjectPut (Module *module, BasicBlock *block, Value *jsonObjectValue) |
Generates a call to json_object_put() . More... | |
static void | generateNullCheck (Module *module, Function *function, Value *valueToCheck, BasicBlock *initialBlock, BasicBlock *&nullBlock, BasicBlock *¬NullBlock) |
Generates code that checks if valueToCheck (assumed to have a pointer type) is null. More... | |
static Value * | generateSerialization (Module *module, BasicBlock *block, Value *valueToSerialize, VuoCompilerConstantStringCache &constantStrings) |
Generates code that creates a string representation of the given value. More... | |
static void | generateUnserialization (Module *module, BasicBlock *block, Value *stringToUnserialize, Value *destinationVariable, VuoCompilerConstantStringCache &constantStrings) |
Generates code that creates a value of the given type from the given string representation, and stores it in the destination variable. More... | |
static ICmpInst * | generateIsPausedComparison (Module *module, BasicBlock *block, Value *compositionStateValue) |
Generates code that gets the return value of vuoIsPaused() as a comparison value. More... | |
static void | generateSendNodeExecutionStarted (Module *module, BasicBlock *block, Value *compositionStateValue, Value *nodeIdentifierValue) |
Generates a call to vuoSendNodeExecutionStarted() . More... | |
static void | generateSendNodeExecutionFinished (Module *module, BasicBlock *block, Value *compositionStateValue, Value *nodeIdentifierValue) |
Generates a call to vuoSendNodeExecutionFinished() . More... | |
static void | generateSendInputPortsUpdated (Module *module, BasicBlock *block, Value *compositionStateValue, Value *portIdentifierValue, bool receivedEvent, bool receivedData, Value *portDataSummaryValue) |
Generates a call to vuoSendInputPortsUpdated() . More... | |
static void | generateSendInputPortsUpdated (Module *module, BasicBlock *block, Value *compositionStateValue, Value *portIdentifierValue, Value *receivedEventValue, Value *receivedDataValue, Value *portDataSummaryValue) |
Generates a call to vuoSendInputPortsUpdated() . More... | |
static void | generateSendOutputPortsUpdated (Module *module, BasicBlock *block, Value *compositionStateValue, Value *portIdentifierValue, Value *sentEventValue, Value *sentDataValue, Value *portDataSummaryValue) |
Generates a call to vuoSendOutputPortsUpdated() . More... | |
static void | generateSendPublishedOutputPortsUpdated (Module *module, BasicBlock *block, Value *compositionStateValue, Value *portIdentifierValue, Value *sentDataValue, Value *portDataSummaryValue) |
Generates a call to vuoSendPublishedOutputPortsUpdated() . More... | |
static void | generateSendEventFinished (Module *module, BasicBlock *block, Value *compositionStateValue, Value *eventIdValue) |
Generates a call to vuoSendEventFinished() . More... | |
static void | generateSendEventDropped (Module *module, BasicBlock *block, Value *compositionStateValue, Value *portIdentifierValue) |
Generates a call to vuoSendEventDropped() . More... | |
static ICmpInst * | generateShouldSendDataTelemetryComparison (Module *module, BasicBlock *block, string portIdentifier, Value *compositionStateValue, VuoCompilerConstantStringCache &constantStrings) |
Generates code that gets the return value of the vuoShouldSendPortDataTelemetry() function as a comparison value. More... | |
static void | generateIsNodeBeingRemovedOrReplacedCheck (Module *module, Function *function, string nodeIdentifier, Value *compositionStateValue, BasicBlock *initialBlock, BasicBlock *&trueBlock, BasicBlock *&falseBlock, VuoCompilerConstantStringCache &constantStrings, Value *&replacementJsonValue) |
Generates code that checks if vuoIsNodeBeingRemovedOrReplaced() returns true for nodeIdentifier. More... | |
static ICmpInst * | generateIsNodeBeingAddedOrReplacedCheck (Module *module, Function *function, string nodeIdentifier, Value *compositionStateValue, BasicBlock *initialBlock, BasicBlock *&trueBlock, BasicBlock *&falseBlock, VuoCompilerConstantStringCache &constantStrings, Value *&replacementJsonValue) |
Generates code that checks if vuoIsNodeBeingAddedOrReplaced() returns true for nodeIdentifier. More... | |
static ConstantInt * | generateNoEventIdConstant (Module *module) |
Generates a dummy event ID to represent that no event is claiming a node. More... | |
static Value * | generateGetNodeContext (Module *module, BasicBlock *block, Value *compositionStateValue, size_t nodeIndex) |
Generates a call to vuoGetNodeContext() . More... | |
static Value * | generateGetNodeContext (Module *module, BasicBlock *block, Value *compositionStateValue, Value *nodeIndexValue) |
Generates a call to vuoGetNodeContext() . More... | |
static Value * | generateGetCompositionContext (Module *module, BasicBlock *block, Value *compositionStateValue) |
Generates a call to vuoGetCompositionContext() . More... | |
static void | generateAddNodeMetadata (Module *module, BasicBlock *block, Value *compositionStateValue, Value *nodeIdentifierValue, Function *compositionCreateContextForNodeFunction, Function *compositionSetPortValueFunction, Function *compositionGetPortValueFunction, Function *compositionFireTriggerPortEventFunction, Function *compositionReleasePortDataFunction) |
Generates a call to vuoAddNodeMetadata() . More... | |
static void | generateAddPortMetadata (Module *module, BasicBlock *block, Value *compositionStateValue, Value *portIdentifierValue, Value *portNameValue, size_t typeIndex, Value *initialValueValue) |
Generates a call to vuoAddPortMetadata() . More... | |
static void | generateInitContextForTopLevelComposition (Module *module, BasicBlock *block, Value *compositionStateValue, bool isStatefulComposition, size_t publishedOutputPortCount) |
Generates a call to vuoInitContextForTopLevelComposition() . More... | |
static void | generateFiniContextForTopLevelComposition (Module *module, BasicBlock *block, Value *compositionStateValue) |
Generates a call to vuoFiniContextForTopLevelComposition() . More... | |
static Value * | getTriggerWorkersScheduledValue (Module *module, BasicBlock *block, Value *compositionStateValue) |
Generates a call to vuoGetTriggerWorkersScheduled() . More... | |
static Value * | generateGetInputPortString (Module *module, BasicBlock *block, Value *compositionStateValue, Value *portIdentifierValue, Value *interprocessSerializationValue) |
Generates a call to vuoGetInputPortString() . More... | |
static Value * | generateGetOutputPortString (Module *module, BasicBlock *block, Value *compositionStateValue, Value *portIdentifierValue, Value *interprocessSerializationValue) |
Generates a call to vuoGetOutputPortString() . More... | |
static Value * | generateRuntimeStateValue (Module *module, BasicBlock *block) |
Generates code that gets the value of the vuoRuntimeState global variable. More... | |
static Value * | generateGetNextEventId (Module *module, BasicBlock *block, Value *compositionStateValue) |
Generates a call to vuoGetNextEventId() . More... | |
static Value * | generateCreateTriggerWorkerContext (Module *module, BasicBlock *block, Value *compositionStateValue, Value *dataCopyValue, Value *eventIdCopyValue) |
Generates a call to vuoCreateTriggerWorkerContext() . More... | |
static void | generateFreeTriggerWorkerContext (Module *module, BasicBlock *block, Value *contextValue) |
Generates a call to vuoFreeTriggerWorkerContext() . More... | |
static Value * | generateCreatePublishedInputWorkerContext (Module *module, BasicBlock *block, Value *compositionStateValue, Value *inputPortIdentifierValue, Value *valueAsStringValue, Value *isCompositionRunningValue) |
Generates a call to vuoCreatePublishedInputWorkerContext() . More... | |
static void | generateAddCompositionStateToThreadLocalStorage (Module *module, BasicBlock *block, Value *compositionStateValue) |
Generates a call to vuoAddCompositionStateToThreadLocalStorage() . More... | |
static void | generateRemoveCompositionStateFromThreadLocalStorage (Module *module, BasicBlock *block) |
Generates a call to vuoRemoveCompositionStateFromThreadLocalStorage() . More... | |
static void | generatePrint (Module *module, BasicBlock *block, string formatString, Value *value=NULL) |
Generates code that prints to stderr either a string literal or a formatted string with a value. More... | |
static void | generatePrint (Module *module, BasicBlock *block, string formatString, const vector< Value * > &values) |
Generates code that prints to stderr either a string literal or a formatted string with a value. More... | |
static Type * | getParameterTypeBeforeLowering (Function *function, Module *module, string typeName) |
Guesses the type that the parameter of the function had in the source code, before it was possibly converted ("lowered") to some other type by Clang/LLVM when the module was compiled. More... | |
static Value * | unlowerArgument (VuoCompilerType *unloweredVuoType, Function *function, int parameterIndex, Module *module, BasicBlock *block) |
If needed, generates code to convert a function argument from the "lowered" type of the function parameter to an un-lowered type. More... | |
static Value * | convertArgumentToParameterType (Value *argument, Function *function, int parameterIndex, Value **secondArgument, Module *module, BasicBlock *block) |
If needed, generates code to convert the argument to the (possibly "lowered") type(s) of the function parameter(s). More... | |
static Value * | convertArgumentToParameterType (Value *argument, FunctionType *functionType, int parameterIndex, bool isPassedByValue, Value **secondArgument, Module *module, BasicBlock *block) |
If needed, generates code to convert the argument to the (possibly "lowered") type(s) of the function parameter(s). More... | |
static Value * | callFunctionWithStructReturn (Function *function, vector< Value * > args, BasicBlock *block) |
Generates a call to the function, whose first parameter is assumed to have LLVM's sret attribute. More... | |
static bool | isFunctionReturningStructViaParameter (Function *function) |
Returns true if the function's first parameter has LLVM's sret attribute, or in other words, LLVM has transformed struct MyType foo(...) to void foo(struct MyType *, ...) . More... | |
static FunctionType * | getFunctionType (Module *module, VuoType *paramType) |
Returns a function type that accepts a vuoType (or its lowered form) as its parameter and has a void return type. More... | |
static Value * | getArgumentAtIndex (Function *function, size_t index) |
Returns the argument at index (numbered from 0) in the function's argument list. More... | |
static AttributeSet | copyAttributesToIndex (AttributeSet attributesToCopy, int destinationIndex) |
Creates a new AttributeSet with the attributes from attributesToCopy 's index 1 (the AttributeSet's first function parameter) placed in the output AttributeSet's index destinationIndex (0 for the return value, 1 for the first parameter, …). More... | |
static PointerType * | getDispatchSemaphoreType (Module *module) |
Returns a Type reference, generating code for the declaration if needed. More... | |
static PointerType * | getDispatchGroupType (Module *module) |
Returns a Type reference, generating code for the declaration if needed. More... | |
static StructType * | getDispatchObjectType (Module *module) |
Returns a Type reference, generating code for the declaration if needed. More... | |
static StructType * | getNodeContextType (Module *module) |
Returns a Type reference, generating code for the declaration if needed. More... | |
static StructType * | getPortContextType (Module *module) |
Returns a Type reference, generating code for the declaration if needed. More... | |
static StructType * | getCompositionStateType (Module *module) |
Returns a Type reference, generating code for the declaration if needed. More... | |
static StructType * | getJsonObjectType (Module *module) |
Returns a Type reference, generating code for the declaration if needed. More... | |
static PointerType * | getCompositionInstanceDataType (Module *module) |
Returns a Type reference, generating code for the declaration if needed. More... | |
static Function * | getStrcatFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getStrcmpFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getStrdupFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getStrlenFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getSnprintfFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getSscanfFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getFprintfFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getPutsFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getMallocFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getFreeFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getAnnotateFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getJsonObjectPutFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getJsonObjectToJsonStringExtFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getJsonTokenerParseFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getVuoShaderMakeFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getVuoShaderAddSourceFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getVuoShaderSetTransparentFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getVuoShaderSetUniformFunction (Module *module, VuoCompilerType *type) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getVuoSamplerRectCoordinatesFromNormalizedCoordinatesFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getVuoImageGetColorDepthFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getVuoImageRendererRenderFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getCompositionAddNodeMetadataFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getCompositionCreateContextForNodeFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getCompositionPerformDataOnlyTransmissionsFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getCompositionReleasePortDataFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getSetupFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getCleanupFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getInstanceInitFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getInstanceFiniFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getInstanceTriggerStartFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getInstanceTriggerStopFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getNodeInstanceInitFunction (Module *module, string moduleKey, bool isSubcomposition, Type *instanceDataType, const vector< VuoPort * > &modelInputPorts, map< VuoPort *, size_t > &indexOfParameter, VuoCompilerConstantStringCache &constantStrings) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getNodeInstanceFiniFunction (Module *module, string moduleKey, Type *instanceDataType, VuoCompilerConstantStringCache &constantStrings) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getNodeInstanceTriggerStartFunction (Module *module, string moduleKey, Type *instanceDataType, const vector< VuoPort * > &modelInputPorts, map< VuoPort *, size_t > &indexOfParameter, VuoCompilerConstantStringCache &constantStrings) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getNodeInstanceTriggerStopFunction (Module *module, string moduleKey, Type *instanceDataType, VuoCompilerConstantStringCache &constantStrings) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getNodeInstanceTriggerUpdateFunction (Module *module, string moduleKey, Type *instanceDataType, const vector< VuoPort * > &modelInputPorts, map< VuoPort *, size_t > &indexOfParameter, VuoCompilerConstantStringCache &constantStrings) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getNodeEventFunction (Module *module, string moduleKey, bool isSubcomposition, bool isStateful, Type *instanceDataType, const vector< VuoPort * > &modelInputPorts, const vector< VuoPort * > &modelOutputPorts, const map< VuoPort *, json_object * > &detailsForPorts, const map< VuoPort *, string > &displayNamesForPorts, const map< VuoPort *, string > &defaultValuesForInputPorts, const map< VuoPort *, VuoPortClass::EventBlocking > &eventBlockingForInputPorts, map< VuoPort *, size_t > &indexOfParameter, map< VuoPort *, size_t > &indexOfEventParameter, VuoCompilerConstantStringCache &constantStrings) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getWaitForNodeFunction (Module *module, string moduleKey) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getCompositionGetPortValueFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getSetInputPortValueFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getCompositionSetPortValueFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getCompositionFireTriggerPortEventFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getGetPublishedInputPortValueFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getGetPublishedOutputPortValueFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getCompositionSetPublishedInputPortValueFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
static Function * | getSetPublishedInputPortValueFunction (Module *module) |
Returns a Function reference, generating code for the declaration if needed. More... | |
|
static |
Generates a call to the function, whose first parameter is assumed to have LLVM's sret
attribute.
Definition at line 5200 of file VuoCompilerCodeGenUtilities.cc.
|
static |
If needed, generates code to convert the argument to the (possibly "lowered") type(s) of the function parameter(s).
argument | The argument to be converted. | |
function | The function the argument is being passed to. | |
parameterIndex | The index of the first (and possibly only) function parameter corresponding to argument. | |
[out] | secondArgument | Pointer to the second converted argument, to be passed to the second function parameter corresponding to argument. If none, pass NULL. |
module | The module in which to generate code. | |
block | The block in which to generate code. |
Definition at line 5032 of file VuoCompilerCodeGenUtilities.cc.
|
static |
If needed, generates code to convert the argument to the (possibly "lowered") type(s) of the function parameter(s).
argument | The argument to be converted. | |
functionType | The type of the function that the argument is being passed to. | |
parameterIndex | The index of the first (and possibly only) function parameter corresponding to argument. | |
isPassedByValue | Whether the parameter corresponding to argument has the "byval" attribute. | |
[out] | secondArgument | Pointer to the second converted argument, to be passed to the second function parameter corresponding to argument. If none, pass NULL. |
module | The module in which to generate code. | |
block | The block in which to generate code. |
Definition at line 5051 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Creates a new AttributeSet with the attributes from attributesToCopy
's index 1 (the AttributeSet's first function parameter) placed in the output AttributeSet's index destinationIndex
(0 for the return value, 1 for the first parameter, …).
Definition at line 5260 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoAddCompositionStateToThreadLocalStorage()
.
Definition at line 3404 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoAddNodeMetadata()
.
Definition at line 3063 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoAddPortMetadata()
.
Definition at line 3108 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to llvm.var.annotation
, which annotates a value with a string.
module | The module in which to generate code. |
block | The block in which to generate code. |
value | The value to be annotated. |
annotation | The annotation to be associated with the value. |
fileName | The name of the file for the module (or an empty string if no file). |
lineNumber | The line number in the file for the module (or 0 if no file). |
constantStrings | The cache of LLVM constants used to generate string values. |
Definition at line 2266 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that submits a function for asynchronous execution on a dispatch queue.
Definition at line 339 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that creates a VuoCompositionState *
from the given void *runtimeState
and char *compositionIdentifier
.
Definition at line 1358 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that constructs a dispatch_group_t.
module | The module in which to generate code. |
block | The block in which to generate code. |
dispatch_group_create()
. Definition at line 157 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that constructs a dispatch_queue_t.
module | The module in which to generate code. |
block | The block in which to generate code. |
dispatchQueueName | The argument to pass to dispatch_queue_create() . |
dispatch_queue_create()
. Definition at line 286 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that constructs a dispatch_semaphore_t.
module | The module in which to generate code. |
block | The block in which to generate code. |
initialValue | The argument to pass to dispatch_semaphore_create() . |
dispatch_semaphore_create()
. Definition at line 27 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that creates a dispatch_time_t by calling dispatch_time_create(DISPATCH_TIME_NOW, ...)
.
module | The module in which to generate code. |
block | The block in which to generate code. |
deltaValue | The 2nd argument to dispatch_time_create . |
Definition at line 493 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that allocates a NodeContext on the heap and initializes it with default values.
module | The module in which to generate code. |
block | The block in which to generate code. |
hasInstanceData | Whether this node has instance data. |
isComposition | Whether this node is a subcomposition. |
outputEventCount | The number of output ports, used to create the outputEvents field for subcompositions. |
NodeContext *
. Definition at line 842 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that allocates a PortContext on the heap and initializes it with default values.
module | The module in which to generate code. |
block | The block in which to generate code. |
dataType | The type of the port's data, or null if the port is event-only. |
isTrigger | Whether the port is a trigger. |
triggerQueueName | If the port is a trigger, the name to use when creating its dispatch queue. |
PortContext *
. Definition at line 530 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoCreatePublishedInputWorkerContext()
.
Definition at line 3371 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoCreateTriggerWorkerContext()
.
Definition at line 3319 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that increments the block count of a dispatch_group_t.
Definition at line 177 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that releases a dispatch_object_t (dispatch_queue_t, dispatch_group_t, dispatch_semaphore_t, etc.).
module | The module in which to generate code. |
block | The block in which to generate code. |
dispatchObjectVariable | A pointer to the dispatch_object_t (e.g. a GlobalVariable or AllocaInst ). |
Definition at line 468 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoFiniContextForTopLevelComposition()
.
Definition at line 3177 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoFinishedExecutingEvent
.
module | The module in which to generate code. |
block | The block in which to generate code. |
nodeContextValue | The composition's node context, a value of type NodeContext * . |
eventIdValue | A value of type unsigned long . |
bool
. Definition at line 1302 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that allocates a buffer to hold the composite string, then calls snprintf
to combine the format string and replacement values into the composite string.
module | The module in which to generate code. |
block | The block in which to generate code. |
formatString | The format string to be passed to snprintf . |
replacementValues | The replacement values to be passed to snprintf . |
constantStrings | The cache of LLVM constants used to generate string values. |
Definition at line 2058 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to free argument (after casting it to a void pointer).
Definition at line 2546 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that frees a VuoCompositionState *
(but not its fields).
Definition at line 1433 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoFreeTriggerWorkerContext()
.
Definition at line 3349 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that gets the array element at the given index.
Definition at line 1812 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that gets the array element at the given index.
Definition at line 1821 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoGetCompositionContext()
.
Definition at line 3040 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that gets the compositionIdentifier
field of a VuoCompositionState *
.
Definition at line 1409 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that gets the runtimeState
field of a VuoCompositionState *
.
Definition at line 1385 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that retrives the data
field in a port's context, given the port's identifier.
Definition at line 1456 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that retrieves the global dispatch queue.
Definition at line 251 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoGetInputPortString()
.
Definition at line 3222 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoGetNextEventId()
.
Definition at line 3296 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoGetNodeContext()
.
Definition at line 3003 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoGetNodeContext()
.
Definition at line 3014 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that gets the claimingEventId
field of a NodeContext.
module | The module in which to generate code. |
block | The block in which to generate code. |
nodeContextValue | A value of type NodeContext * . |
Definition at line 1126 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that gets the executingGroup
field of a NodeContext.
module | The module in which to generate code. |
block | The block in which to generate code. |
nodeContextValue | A value of type NodeContext * . |
Definition at line 1151 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that gets the instanceData
field of a NodeContext (and dereference it to get the actual instance data).
module | The module in which to generate code. |
block | The block in which to generate code. |
nodeContextValue | A value of type NodeContext * . |
instanceDataType | The type that the instanceData field should be converted to before returning. |
Definition at line 1060 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that gets the address of the instanceData
field of a NodeContext.
module | The module in which to generate code. |
block | The block in which to generate code. |
nodeContextValue | A value of type NodeContext * . |
instanceDataType | The type that the instanceData field should be converted to before returning. |
Definition at line 1075 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that gets an element of the outputEvents
field of a NodeContext.
module | The module in which to generate code. |
block | The block in which to generate code. |
nodeContextValue | A value of type NodeContext * . |
index | The index of the event in the node context's array of output events. |
Definition at line 1177 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that gets an element of the portContexts
field of a NodeContext.
module | The module in which to generate code. |
block | The block in which to generate code. |
nodeContextValue | A value of type NodeContext * . |
index | The index of the port context in the node context's array of port contexts. |
Definition at line 1024 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that gets the semaphore
field of a NodeContext.
module | The module in which to generate code. |
block | The block in which to generate code. |
nodeContextValue | A value of type NodeContext * . |
Definition at line 1101 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that retrieves the index (in VuoCompilerBitcodeGenerator::orderedNodes) of a node, given the identifier of a port on the node.
Definition at line 1510 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that retrives the semaphore
field in a node's context, given the identifier of a port on the node.
Definition at line 1483 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoGetOneExecutingEvent
.
module | The module in which to generate code. |
block | The block in which to generate code. |
nodeContextValue | The composition's node context, a value of type NodeContext * . |
unsigned long
. Definition at line 1334 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoGetOutputPortString()
.
Definition at line 3251 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that gets the data
field of a PortContext (and dereferences it to extract the actual data).
module | The module in which to generate code. |
block | The block in which to generate code. |
portContextValue | A value of type PortContext * . |
dataType | The type that the data should be converted to before returning. |
Definition at line 681 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that gets the address of the data
field of a PortContext.
module | The module in which to generate code. |
block | The block in which to generate code. |
portContextValue | A value of type PortContext * . |
dataType | The type that the data should be converted to before returning. |
Definition at line 696 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that gets the address of the data
field of a PortContext as a void pointer.
module | The module in which to generate code. |
block | The block in which to generate code. |
portContextValue | A value of type PortContext * . |
Definition at line 710 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that gets the event
field of a PortContext.
module | The module in which to generate code. |
block | The block in which to generate code. |
portContextValue | A value of type PortContext * . |
Definition at line 655 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that gets the triggerFunction
field of a PortContext.
module | The module in which to generate code. |
block | The block in which to generate code. |
portContextValue | A value of type PortContext * . |
functionType | The type that the function value should be converted to before returning. |
Definition at line 786 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that gets the triggerQueue
field of a PortContext.
module | The module in which to generate code. |
block | The block in which to generate code. |
portContextValue | A value of type PortContext * . |
Definition at line 735 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that gets the triggerSemaphore
field of a PortContext.
module | The module in which to generate code. |
block | The block in which to generate code. |
portContextValue | A value of type PortContext * . |
Definition at line 760 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that gets the struct element at the given index.
Definition at line 1856 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that retrieves the index (in VuoCompilerBitcodeGenerator::orderedTypes) of a port's type, given the port's identifier.
Definition at line 1537 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoGrantThreadsToChain
.
Definition at line 1677 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoGrantThreadsToSubcomposition
.
Definition at line 1716 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a series of if-else statements for testing if an input index is equal to any of a set of indices, and executing the corresponding block of code if it is.
Assumes that none of the blocks passed to this function contain branch instructions. (This function appends branch instructions to all but the final block.)
Example:
if (inputIndex == 0) // blockForIndex[0] else if (inputIndex == 1) // blockForIndex[1] ...
module | The module in which to generate code. |
function | The function in which to generate code. |
initialBlock | The block to which the first if-statement will be appended. |
finalBlock | The block following the if-else statements. |
inputIndexValue | The index to compare in each if-statement. |
blocksForIndex | For each index, the first block and last block to execute if the input index matches that index. The caller is responsible for branching (directly or indirectly) from the first to the last block. |
Definition at line 2023 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoInitContextForTopLevelComposition()
.
Definition at line 3144 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that checks if vuoIsNodeBeingAddedOrReplaced()
returns true for nodeIdentifier.
This function initializes trueBlock and falseBlock and sets them up to be the blocks executed depending on the return value.
Definition at line 2946 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that checks if vuoIsNodeBeingRemovedOrReplaced()
returns true for nodeIdentifier.
This function initializes trueBlock and falseBlock and sets them up to be the blocks executed depending on the return value.
Definition at line 2898 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that gets the return value of vuoIsPaused()
as a comparison value.
Definition at line 2625 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to json_object_put()
.
Definition at line 2557 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that decrements the block count of a dispatch_group_t.
Definition at line 198 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that dynamically allocates memory for an array.
module | The module in which to generate code. |
block | The block in which to generate code. |
elementType | The type of each array element. |
elementCount | The number of array elements. |
Definition at line 2192 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that dynamically allocates memory for an array.
module | The module in which to generate code. |
block | The block in which to generate code. |
elementType | The type of each array element. |
elementCountValue | The number of array elements. Assumed to have type integer. |
Definition at line 2207 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code equivalent to the VuoModuleMetadata macro.
Definition at line 2301 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a dummy event ID to represent that no event is claiming a node.
Definition at line 2995 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that checks if valueToCheck (assumed to have a pointer type) is null.
This function initializes nullBlock and notNullBlock and sets them up to be the blocks executed depending on the result.
Definition at line 2567 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that creates a global array-of-strings variable.
module | The module in which to generate code. |
stringValues | The strings to be placed in the array. |
globalVariableName | The name to give to the global variable. |
Definition at line 1919 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that creates a global string variable.
module | The module in which to generate code. |
stringValue | The string initializer for the global variable. |
globalVariableName | The name to give to the global variable. |
Definition at line 1894 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that creates a pointer to value
(on the stack), and returns the pointer.
Definition at line 1879 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that prints to stderr either a string literal or a formatted string with a value.
(Useful for debugging.)
Definition at line 3471 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that prints to stderr either a string literal or a formatted string with a value.
(Useful for debugging.)
Definition at line 3460 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code to register argument.
Definition at line 2458 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates any code needed to release argument
.
Definition at line 2495 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoRemoveCompositionStateFromThreadLocalStorage()
.
Definition at line 3427 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that sets the event
field to false for all PortContexts in a NodeContext.
module | The module in which to generate code. |
block | The block in which to generate code. |
nodeContextValue | A value of type NodeContext * . |
Definition at line 1211 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates any code needed to retain argument
.
Definition at line 2487 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that retains a dispatch_object_t (dispatch_queue_t, dispatch_group_t, dispatch_semaphore_t, etc.).
module | The module in which to generate code. |
block | The block in which to generate code. |
dispatchObjectVariable | A pointer to the dispatch_object_t (e.g. a GlobalVariable or AllocaInst ). |
Definition at line 444 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that calls vuoRetainPortContextData()
.
module | The module in which to generate code. |
block | The block in which to generate code. |
portContextValue | A value of type PortContext * . |
Definition at line 812 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoReturnThreadsForChainWorker
.
Definition at line 1774 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoReturnThreadsForTriggerWorker
.
Definition at line 1748 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that gets the value of the vuoRuntimeState
global variable.
Definition at line 3280 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoScheduleChainWorker
.
Definition at line 1614 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoScheduleTriggerWorker
.
Definition at line 1564 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoSendEventDropped()
.
Definition at line 2839 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoSendEventFinished()
.
Definition at line 2813 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoSendInputPortsUpdated()
.
Definition at line 2697 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoSendInputPortsUpdated()
.
Definition at line 2711 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoSendNodeExecutionFinished()
.
Definition at line 2671 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoSendNodeExecutionStarted()
.
Definition at line 2645 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoSendOutputPortsUpdated()
.
Definition at line 2746 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoSendPublishedOutputPortsUpdated()
.
Definition at line 2781 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that creates a string representation of the given value.
Definition at line 2581 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that sets the array element at the given index.
Definition at line 1803 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that sets the claimingEventId
field of a NodeContext.
module | The module in which to generate code. |
block | The block in which to generate code. |
nodeContextValue | A value of type NodeContext * . |
claimingEventIdValue | The value to set the field to. |
Definition at line 954 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that sets the instanceData
field of a NodeContext (to a heap-allocated copy of instanceDataValue) and frees the old value.
module | The module in which to generate code. |
block | The block in which to generate code. |
nodeContextValue | A value of type NodeContext * . |
instanceDataValue | The value to set the field to. |
Definition at line 918 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that sets an element of the outputEvents
field of a NodeContext.
module | The module in which to generate code. |
block | The block in which to generate code. |
nodeContextValue | A value of type NodeContext * . |
index | The index of the event in the node context's array of output events. |
eventValue | The value to set the field to. |
Definition at line 986 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that sets the portContexts
and portContextCount
fields of a NodeContext.
module | The module in which to generate code. |
block | The block in which to generate code. |
nodeContextValue | A value of type NodeContext * . |
portContextValues | The values to be placed in an array and stored in the field. |
Definition at line 878 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that sets the data
field of a PortContext to a heap-allocated copy of dataValue.
module | The module in which to generate code. |
block | The block in which to generate code. |
portContextValue | A value of type PortContext * . |
dataValue | The value to set the field to. |
Definition at line 607 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that sets the event
field of a PortContext.
module | The module in which to generate code. |
block | The block in which to generate code. |
portContextValue | A value of type PortContext * . |
eventValue | The value to set the field to. |
Definition at line 576 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that sets the triggerFunction
field of a PortContext.
module | The module in which to generate code. |
block | The block in which to generate code. |
portContextValue | A value of type PortContext * . |
triggerFunctionValue | The value to set the field to. |
Definition at line 621 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that sets the struct element at the given index.
Definition at line 1847 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that gets the return value of the vuoShouldSendPortDataTelemetry()
function as a comparison value.
Definition at line 2865 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that signals a dispatch_semaphore_t.
Definition at line 120 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that signals a dispatch_semaphore_t.
Definition at line 129 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoSpunOffExecutingEvent
.
module | The module in which to generate code. |
block | The block in which to generate code. |
nodeContextValue | The composition's node context, a value of type NodeContext * . |
eventIdValue | A value of type unsigned long . |
Definition at line 1270 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoStartedExecutingEvent
.
module | The module in which to generate code. |
block | The block in which to generate code. |
nodeContextValue | The composition's node context, a value of type NodeContext * . |
eventIdValue | A value of type unsigned long . |
Definition at line 1239 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that allocates a buffer to hold the composite string, then concatenates each member of stringsToConcatenate
into the composite string.
module | The module in which to generate code. |
block | The block in which to generate code. |
stringsToConcatenate | The strings to concatenate. Each element should be a value of type pointer-to-char. |
constantStrings | The cache of LLVM constants used to generate string values. |
Definition at line 2103 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a series of if-else statements for testing if an input string is equal to any of a set of constant strings, and executing the corresponding block of code if it is.
Assumes that none of the blocks passed to this function contain branch instructions. (This function appends branch instructions to all but the final block.)
Example:
if (! strcmp(inputString, string0)) // blockForString[string0] else if (! strcmp(inputString, string1)) // blockForString[string1] ...
module | The module in which to generate code. |
function | The function in which to generate code. |
initialBlock | The block to which the first if-statement will be appended. |
finalBlock | The block following the if-else statements. |
inputStringValue | The string to compare in each if-statement. |
blocksForString | For each key string, the first block and last block to execute if the input string matches that string. The caller is responsible for branching (directly or indirectly) from the first to the last block. |
constantStrings | The cache of LLVM constants used to generate string values. |
Definition at line 1966 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that submits a function for synchronous execution on a dispatch queue.
Definition at line 348 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code to cast the value to the desired type (if it doesn't already have that type).
typeToCastTo
(which may be valueToCast
). Definition at line 2232 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that creates a value of the given type from the given string representation, and stores it in the destination variable.
Definition at line 2602 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that waits on a dispatch_group_t.
Definition at line 219 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that waits for and claims a dispatch_semaphore_t, with a timeout of DISPATCH_TIME_FOREVER
.
module | The module in which to generate code. |
block | The block in which to generate code. |
semaphoreVariable | The semaphore. |
Definition at line 57 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that waits for and possibly claims a dispatch_semaphore_t.
module | The module in which to generate code. |
block | The block in which to generate code. |
semaphoreVariable | The semaphore. |
timeoutValue | A value of type dispatch_time_t to pass to dispatch_semaphore_wait(). |
Definition at line 72 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that waits for and claims a dispatch_semaphore_t, with a timeout of DISPATCH_TIME_FOREVER
.
Definition at line 81 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates code that waits for and possibly claims a dispatch_semaphore_t.
Definition at line 91 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 3841 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns the argument at index (numbered from 0) in the function's argument list.
Definition at line 5244 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4141 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4050 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4069 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4733 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4681 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Type reference, generating code for the declaration if needed.
Definition at line 3665 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4089 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4108 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4705 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4807 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Type reference, generating code for the declaration if needed.
Definition at line 3595 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Type reference, generating code for the declaration if needed.
Definition at line 3499 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Type reference, generating code for the declaration if needed.
Definition at line 3530 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Type reference, generating code for the declaration if needed.
Definition at line 3489 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 3776 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 3825 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a function type that accepts a vuoType (or its lowered form) as its parameter and has a void return type.
Definition at line 5225 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4771 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4789 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4165 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4153 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4177 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4189 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 3860 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 3876 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Type reference, generating code for the declaration if needed.
Definition at line 3624 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 3894 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 3809 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Type reference, generating code for the declaration if needed.
Definition at line 3545 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4259 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4213 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4201 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4224 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4236 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4247 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Guesses the type that the parameter of the function had in the source code, before it was possibly converted ("lowered") to some other type by Clang/LLVM when the module was compiled.
(For example, a struct whose members are all floats may be lowered to a vector of floats.)
Definition at line 4854 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Type reference, generating code for the declaration if needed.
Definition at line 3571 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 3793 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4754 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4831 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4129 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 3741 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 3759 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 3676 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 3693 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 3709 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 3725 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Generates a call to vuoGetTriggerWorkersScheduled()
.
Definition at line 3199 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4011 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4028 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 3992 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 3928 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 3911 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 3950 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 3968 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns a Function reference, generating code for the declaration if needed.
Definition at line 4658 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns true if the function's first parameter has LLVM's sret
attribute, or in other words, LLVM has transformed struct MyType foo(...)
to void foo(struct MyType *, ...)
.
Definition at line 5214 of file VuoCompilerCodeGenUtilities.cc.
|
static |
Returns true if VuoCompilerCodeGenUtilities::generateRetainCall and VuoCompilerCodeGenUtilities::generateReleaseCall would generate any code for type.
Definition at line 2538 of file VuoCompilerCodeGenUtilities.cc.
|
static |
If needed, generates code to convert a function argument from the "lowered" type of the function parameter to an un-lowered type.
unloweredVuoType | The type that the argument should be converted to. |
function | The function to which the argument has been passed. |
parameterIndex | The index of the argument in the function's argument list (starting at 0). |
module | The module in which to generate code. |
block | The block in which to generate code. |
Definition at line 4889 of file VuoCompilerCodeGenUtilities.cc.