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

Description

Handy methods for generating code.

Static Public Member Functions

static Value * generateCreateDispatchSemaphore (Module *module, BasicBlock *block, int initialValue=1)
 Generates code that constructs a dispatch_semaphore_t.
 
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.
 
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.
 
static Value * generateWaitForSemaphore (Module *module, BasicBlock *block, Value *semaphoreValue, Value *timeoutValue)
 Generates code that waits for and possibly claims a dispatch_semaphore_t.
 
static Value * generateWaitForSemaphore (Module *module, BasicBlock *block, AllocaInst *semaphoreVariable, Value *timeoutValue)
 Generates code that waits for and possibly claims a dispatch_semaphore_t.
 
static void generateSignalForSemaphore (Module *module, BasicBlock *block, Value *semaphoreValue)
 Generates code that signals a dispatch_semaphore_t.
 
static void generateSignalForSemaphore (Module *module, BasicBlock *block, AllocaInst *semaphoreVariable)
 Generates code that signals a dispatch_semaphore_t.
 
static Value * generateCreateDispatchGroup (Module *module, BasicBlock *block)
 Generates code that constructs a dispatch_group_t.
 
static void generateEnterDispatchGroup (Module *module, BasicBlock *block, Value *dispatchGroupValue)
 Generates code that increments the block count of a dispatch_group_t.
 
static void generateLeaveDispatchGroup (Module *module, BasicBlock *block, Value *dispatchGroupValue)
 Generates code that decrements the block count of a dispatch_group_t.
 
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.
 
static Value * generateGetGlobalDispatchQueue (Module *module, BasicBlock *block)
 Generates code that retrieves the global dispatch queue.
 
static Value * generateCreateDispatchQueue (Module *module, BasicBlock *block, string dispatchQueueName)
 Generates code that constructs a dispatch_queue_t.
 
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.
 
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.
 
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.).
 
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.).
 
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, ...).
 
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.
 
static void generateSetPortContextEvent (Module *module, BasicBlock *block, Value *portContextValue, Value *eventValue)
 Generates code that sets the event field of a PortContext.
 
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.
 
static void generateSetPortContextTriggerFunction (Module *module, BasicBlock *block, Value *portContextValue, Value *triggerFunctionValue)
 Generates code that sets the triggerFunction field of a PortContext.
 
static Value * generateGetPortContextEvent (Module *module, BasicBlock *block, Value *portContextValue)
 Generates code that gets the event field of a PortContext.
 
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).
 
static Value * generateGetPortContextDataVariable (Module *module, BasicBlock *block, Value *portContextValue, Type *dataType)
 Generates code that gets the address of the data field of a PortContext.
 
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.
 
static Value * generateGetPortContextTriggerQueue (Module *module, BasicBlock *block, Value *portContextValue)
 Generates code that gets the triggerQueue field of a PortContext.
 
static Value * generateGetPortContextTriggerSemaphore (Module *module, BasicBlock *block, Value *portContextValue)
 Generates code that gets the triggerSemaphore field of a PortContext.
 
static Value * generateGetPortContextTriggerFunction (Module *module, BasicBlock *block, Value *portContextValue, FunctionType *functionType)
 Generates code that gets the triggerFunction field of a PortContext.
 
static void generateRetainPortContextData (Module *module, BasicBlock *block, Value *portContextValue)
 Generates code that calls vuoRetainPortContextData().
 
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.
 
static void generateSetNodeContextPortContexts (Module *module, BasicBlock *block, Value *nodeContextValue, vector< Value * > portContextValues)
 Generates code that sets the portContexts and portContextCount fields of a NodeContext.
 
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.
 
static void generateSetNodeContextClaimingEventId (Module *module, BasicBlock *block, Value *nodeContextValue, Value *claimingEventIdValue)
 Generates code that sets the claimingEventId field of a NodeContext.
 
static void generateSetNodeContextExecutingEventId (Module *module, BasicBlock *block, Value *nodeContextValue, Value *executingEventIdValue)
 Generates code that sets the executingEventId field of a NodeContext.
 
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.
 
static Value * generateGetNodeContextPortContext (Module *module, BasicBlock *block, Value *nodeContextValue, int index)
 Generates code that gets an element of the portContexts field of a NodeContext.
 
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).
 
static Value * generateGetNodeContextInstanceDataVariable (Module *module, BasicBlock *block, Value *nodeContextValue, Type *instanceDataType)
 Generates code that gets the address of the instanceData field of a NodeContext.
 
static Value * generateGetNodeContextSemaphore (Module *module, BasicBlock *block, Value *nodeContextValue)
 Generates code that gets the semaphore field of a NodeContext.
 
static Value * generateGetNodeContextClaimingEventId (Module *module, BasicBlock *block, Value *nodeContextValue)
 Generates code that gets the claimingEventId field of a NodeContext.
 
static Value * generateGetNodeContextExecutingGroup (Module *module, BasicBlock *block, Value *nodeContextValue)
 Generates code that gets the executingGroup field of a NodeContext.
 
static Value * generateGetNodeContextExecutingEventId (Module *module, BasicBlock *block, Value *nodeContextValue)
 Generates code that gets the executingEventId field of a NodeContext.
 
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.
 
static void generateResetNodeContextEvents (Module *module, BasicBlock *block, Value *nodeContextValue)
 Generates code that sets the event field to false for all PortContexts in a NodeContext.
 
static void generateFreeNodeContext (Module *module, BasicBlock *block, Value *nodeContextValue)
 Generates code that frees a NodeContext * and its fields, including the port contexts within its portContexts field.
 
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.
 
static Value * generateGetCompositionStateRuntimeState (Module *module, BasicBlock *block, Value *compositionStateValue)
 Generates code that gets the runtimeState field of a VuoCompositionState *.
 
static Value * generateGetCompositionStateCompositionIdentifier (Module *module, BasicBlock *block, Value *compositionStateValue)
 Generates code that gets the compositionIdentifier field of a VuoCompositionState *.
 
static void generateFreeCompositionState (Module *module, BasicBlock *block, Value *compositionStateValue)
 Generates code that frees a VuoCompositionState * (but not its fields).
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
static void generateGrantThreadsToChain (Module *module, BasicBlock *block, int minThreadsNeeded, int maxThreadsNeeded, Value *eventIdValue, Value *compositionStateValue, size_t chainIndex)
 Generates a call to vuoGrantThreadsToChain.
 
static void generateGrantThreadsToSubcomposition (Module *module, BasicBlock *block, Value *eventIdValue, Value *compositionStateValue, Value *chainIndexValue, Value *subcompositionIdentifierValue)
 Generates a call to vuoGrantThreadsToSubcomposition.
 
static void generateReturnThreadsForTriggerWorker (Module *module, BasicBlock *block, Value *eventIdValue, Value *compositionStateValue)
 Generates a call to vuoReturnThreadsForTriggerWorker.
 
static void generateReturnThreadsForChainWorker (Module *module, BasicBlock *block, Value *eventIdValue, Value *compositionStateValue, Value *chainIndexValue)
 Generates a call to vuoReturnThreadsForChainWorker.
 
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.
 
static Value * generateGetArrayElement (Module *module, BasicBlock *block, Value *arrayValue, size_t elementIndex)
 Generates code that gets the array element at the given index.
 
static Value * generatePointerToValue (BasicBlock *block, Value *value)
 Generates code that creates a pointer to value (on the stack), and returns the pointer.
 
static Constant * generatePointerToConstantString (Module *module, string stringValue, string globalVariableName="")
 Generates code that creates a global string variable.
 
static Constant * generatePointerToConstantArrayOfStrings (Module *module, vector< string > stringValues, string globalVariableName="")
 Generates code that creates a global array-of-strings variable.
 
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.
 
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.
 
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.
 
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.
 
static Value * generateMemoryAllocation (Module *module, BasicBlock *block, Type *elementType, int elementCount)
 Generates code that dynamically allocates memory for an array.
 
static Value * generateMemoryAllocation (Module *module, BasicBlock *block, Type *elementType, Value *elementCountValue)
 Generates code that dynamically allocates memory for an array.
 
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).
 
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.
 
static void generateModuleMetadata (Module *module, string metadata, string moduleKey)
 Generates code equivalent to the VuoModuleMetadata macro.
 
static void generateRegisterCall (Module *module, BasicBlock *block, Value *argument, Function *freeFunction)
 Generates code to register argument.
 
static void generateRetainCall (Module *module, BasicBlock *block, Value *argument)
 Generates any code needed to retain argument.
 
static void generateReleaseCall (Module *module, BasicBlock *block, Value *argument)
 Generates any code needed to release argument.
 
static bool isRetainOrReleaseNeeded (Type *type)
 Returns true if VuoCompilerCodeGenUtilities::generateRetainCall and VuoCompilerCodeGenUtilities::generateReleaseCall would generate any code for type.
 
static void generateFreeCall (Module *module, BasicBlock *block, Value *argument)
 Generates a call to free argument (after casting it to a void pointer).
 
static void generateJsonObjectPut (Module *module, BasicBlock *block, Value *jsonObjectValue)
 Generates a call to json_object_put().
 
static void generateNullCheck (Module *module, Function *function, Value *valueToCheck, BasicBlock *initialBlock, BasicBlock *&nullBlock, BasicBlock *&notNullBlock)
 Generates code that checks if valueToCheck (assumed to have a pointer type) is null.
 
static Value * generateSerialization (Module *module, BasicBlock *block, Value *valueToSerialize, VuoCompilerConstantStringCache &constantStrings)
 Generates code that creates a string representation of the given value.
 
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.
 
static ICmpInst * generateIsPausedComparison (Module *module, BasicBlock *block, Value *compositionStateValue)
 Generates code that gets the return value of vuoIsPaused() as a comparison value.
 
static void generateSendNodeExecutionStarted (Module *module, BasicBlock *block, Value *compositionStateValue, Value *nodeIdentifierValue)
 Generates a call to vuoSendNodeExecutionStarted().
 
static void generateSendNodeExecutionFinished (Module *module, BasicBlock *block, Value *compositionStateValue, Value *nodeIdentifierValue)
 Generates a call to vuoSendNodeExecutionFinished().
 
static void generateSendInputPortsUpdated (Module *module, BasicBlock *block, Value *compositionStateValue, Value *portIdentifierValue, Value *receivedEventValue, Value *receivedDataValue, Value *portDataSummaryValue)
 Generates a call to vuoSendInputPortsUpdated().
 
static void generateSendOutputPortsUpdated (Module *module, BasicBlock *block, Value *compositionStateValue, Value *portIdentifierValue, Value *sentDataValue, Value *portDataSummaryValue)
 Generates a call to vuoSendOutputPortsUpdated().
 
static void generateSendPublishedOutputPortsUpdated (Module *module, BasicBlock *block, Value *compositionStateValue, Value *portIdentifierValue, Value *sentDataValue, Value *portDataSummaryValue)
 Generates a call to vuoSendPublishedOutputPortsUpdated().
 
static void generateSendEventDropped (Module *module, BasicBlock *block, Value *compositionStateValue, Value *portIdentifierValue)
 Generates a call to vuoSendEventDropped().
 
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.
 
static void generateIsNodeBeingRemovedOrReplacedCheck (Module *module, Function *function, std::string nodeIdentifier, Value *compositionStateValue, BasicBlock *initialBlock, BasicBlock *&trueBlock, BasicBlock *&falseBlock, VuoCompilerConstantStringCache &constantStrings, Value *&replacementJsonValue)
 Generates code that checks if vuoIsNodeBeingRemovedOrReplaced() returns true for nodeIdentifier.
 
static ICmpInst * generateIsNodeBeingAddedOrReplacedCheck (Module *module, Function *function, std::string nodeIdentifier, Value *compositionStateValue, BasicBlock *initialBlock, BasicBlock *&trueBlock, BasicBlock *&falseBlock, VuoCompilerConstantStringCache &constantStrings, Value *&replacementJsonValue)
 Generates code that checks if vuoIsNodeBeingAddedOrReplaced() returns true for nodeIdentifier.
 
static ConstantInt * generateNoEventIdConstant (Module *module)
 Generates a dummy event ID to represent that no event is claiming a node.
 
static Value * generateGetNodeContext (Module *module, BasicBlock *block, Value *compositionStateValue, size_t nodeIndex)
 Generates a call to vuoGetNodeContext().
 
static Value * generateGetNodeContext (Module *module, BasicBlock *block, Value *compositionStateValue, Value *nodeIndexValue)
 Generates a call to vuoGetNodeContext().
 
static Value * generateGetCompositionContext (Module *module, BasicBlock *block, Value *compositionStateValue)
 Generates a call to vuoGetCompositionContext().
 
static void generateAddNodeMetadata (Module *module, BasicBlock *block, Value *compositionStateValue, Value *nodeIdentifierValue)
 Generates a call to vuoAddNodeMetadata().
 
static void generateAddPortMetadata (Module *module, BasicBlock *block, Value *compositionStateValue, Value *portIdentifierValue, Value *portNameValue, size_t typeIndex, Value *initialValueValue)
 Generates a call to vuoAddPortMetadata().
 
static Value * generateCompositionContextInitHelper (Module *module, BasicBlock *block, Value *compositionStateValue, bool isStatefulComposition, size_t publishedOutputPortCount, Function *createNodeContextsFunction, Function *destroyNodeContextFunction, Function *setPortValueFunction)
 Generates a call to vuoCompositionContextInitHelper().
 
static void generateCompositionContextFiniHelper (Module *module, BasicBlock *block, Value *compositionStateValue, Function *destroyNodeContextFunction, Function *releasePortDataFunction)
 Generates a call to vuoCompositionContextFiniHelper().
 
static Value * getTriggerWorkersScheduledValue (Module *module, BasicBlock *block, Value *compositionStateValue)
 Generates a call to vuoGetTriggerWorkersScheduled().
 
static Value * generateGetInputPortString (Module *module, BasicBlock *block, Value *compositionStateValue, Value *portIdentifierValue, Value *interprocessSerializationValue)
 Generates a call to vuoGetInputPortString().
 
static Value * generateGetOutputPortString (Module *module, BasicBlock *block, Value *compositionStateValue, Value *portIdentifierValue, Value *interprocessSerializationValue)
 Generates a call to vuoGetOutputPortString().
 
static Value * generateRuntimeStateValue (Module *module, BasicBlock *block)
 Generates code that gets the value of the vuoRuntimeState global variable.
 
static Value * generateGetNextEventId (Module *module, BasicBlock *block, Value *compositionStateValue)
 Generates a call to vuoGetNextEventId().
 
static void generateAddCompositionStateToThreadLocalStorage (Module *module, BasicBlock *block, Value *compositionStateValue)
 Generates a call to vuoAddCompositionStateToThreadLocalStorage().
 
static void generateRemoveCompositionStateFromThreadLocalStorage (Module *module, BasicBlock *block)
 Generates a call to vuoRemoveCompositionStateFromThreadLocalStorage().
 
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.
 
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.
 
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.
 
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.
 
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).
 
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).
 
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.
 
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 *, ...).
 
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.
 
static PointerType * getDispatchSemaphoreType (Module *module)
 Returns a Type reference, generating code for the declaration if needed.
 
static PointerType * getDispatchGroupType (Module *module)
 Returns a Type reference, generating code for the declaration if needed.
 
static StructType * getDispatchObjectType (Module *module)
 Returns a Type reference, generating code for the declaration if needed.
 
static StructType * getNodeContextType (Module *module)
 Returns a Type reference, generating code for the declaration if needed.
 
static StructType * getPortContextType (Module *module)
 Returns a Type reference, generating code for the declaration if needed.
 
static StructType * getCompositionStateType (Module *module)
 Returns a Type reference, generating code for the declaration if needed.
 
static StructType * getJsonObjectType (Module *module)
 Returns a Type reference, generating code for the declaration if needed.
 
static Function * getStrcatFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getStrcmpFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getStrdupFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getStrlenFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getSnprintfFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getSscanfFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getFprintfFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getPutsFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getMallocFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getFreeFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getAnnotateFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getJsonObjectPutFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getJsonObjectToJsonStringExtFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getJsonTokenerParseFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getCompositionContextInitFunction (Module *module, string moduleKey)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getCompositionContextFiniFunction (Module *module, string moduleKey)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getCompositionCreateNodeContextsFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getCompositionReleasePortDataFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getCompositionDestroyNodeContextFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getSetupFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getCleanupFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getInstanceInitFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getInstanceFiniFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getInstanceTriggerStartFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getInstanceTriggerStopFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getNodeInstanceInitFunction (Module *module, string moduleKey, const vector< VuoPort * > &modelInputPorts, map< VuoPort *, size_t > &indexOfParameter, VuoCompilerConstantStringCache &constantStrings)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getNodeInstanceFiniFunction (Module *module, string moduleKey, VuoCompilerConstantStringCache &constantStrings)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getNodeInstanceTriggerStartFunction (Module *module, string moduleKey, const vector< VuoPort * > &modelInputPorts, map< VuoPort *, size_t > &indexOfParameter, VuoCompilerConstantStringCache &constantStrings)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getNodeInstanceTriggerStopFunction (Module *module, string moduleKey, VuoCompilerConstantStringCache &constantStrings)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getNodeInstanceTriggerUpdateFunction (Module *module, string moduleKey, const vector< VuoPort * > &modelInputPorts, map< VuoPort *, size_t > &indexOfParameter, VuoCompilerConstantStringCache &constantStrings)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getNodeEventFunction (Module *module, string moduleKey, bool isSubcomposition, bool isStateful, 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.
 
static Function * getWaitForNodeFunction (Module *module, string moduleKey)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getCompositionGetPortValueFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getGetPortValueFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getSetInputPortValueFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getCompositionSetPortValueFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getGetPublishedInputPortValueFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getGetPublishedOutputPortValueFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 
static Function * getSetPublishedInputPortValueFunction (Module *module)
 Returns a Function reference, generating code for the declaration if needed.
 

Member Function Documentation

Value * VuoCompilerCodeGenUtilities::callFunctionWithStructReturn ( Function *  function,
vector< Value * >  args,
BasicBlock *  block 
)
static

Generates a call to the function, whose first parameter is assumed to have LLVM's sret attribute.

Value * VuoCompilerCodeGenUtilities::convertArgumentToParameterType ( Value *  argument,
Function *  function,
int  parameterIndex,
Value **  secondArgument,
Module *  module,
BasicBlock *  block 
)
static

If needed, generates code to convert the argument to the (possibly "lowered") type(s) of the function parameter(s).

Parameters
argumentThe argument to be converted.
functionThe function the argument is being passed to.
parameterIndexThe index of the first (and possibly only) function parameter corresponding to argument.
[out]secondArgumentPointer to the second converted argument, to be passed to the second function parameter corresponding to argument. If none, pass NULL.
moduleThe module in which to generate code.
blockThe block in which to generate code.
Returns
The first converted argument, to be passed to the first (and possibly only) function parameter corresponding to argument. May be the same as argument.
Value * VuoCompilerCodeGenUtilities::convertArgumentToParameterType ( Value *  argument,
FunctionType *  functionType,
int  parameterIndex,
bool  isPassedByValue,
Value **  secondArgument,
Module *  module,
BasicBlock *  block 
)
static

If needed, generates code to convert the argument to the (possibly "lowered") type(s) of the function parameter(s).

Parameters
argumentThe argument to be converted.
functionTypeThe type of the function that the argument is being passed to.
parameterIndexThe index of the first (and possibly only) function parameter corresponding to argument.
isPassedByValueWhether the parameter corresponding to argument has the "byval" attribute.
[out]secondArgumentPointer to the second converted argument, to be passed to the second function parameter corresponding to argument. If none, pass NULL.
moduleThe module in which to generate code.
blockThe block in which to generate code.
Returns
The first converted argument, to be passed to the first (and possibly only) function parameter corresponding to argument. May be the same as argument.
void VuoCompilerCodeGenUtilities::generateAddCompositionStateToThreadLocalStorage ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue 
)
static
void VuoCompilerCodeGenUtilities::generateAddNodeMetadata ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue,
Value *  nodeIdentifierValue 
)
static

Generates a call to vuoAddNodeMetadata().

void VuoCompilerCodeGenUtilities::generateAddPortMetadata ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue,
Value *  portIdentifierValue,
Value *  portNameValue,
size_t  typeIndex,
Value *  initialValueValue 
)
static

Generates a call to vuoAddPortMetadata().

void VuoCompilerCodeGenUtilities::generateAnnotation ( Module *  module,
BasicBlock *  block,
Value *  value,
string  annotation,
string  fileName,
unsigned int  lineNumber,
VuoCompilerConstantStringCache constantStrings 
)
static

Generates a call to llvm.var.annotation, which annotates a value with a string.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
valueThe value to be annotated.
annotationThe annotation to be associated with the value.
fileNameThe name of the file for the module (or an empty string if no file).
lineNumberThe line number in the file for the module (or 0 if no file).
constantStringsThe cache of LLVM constants used to generate string values.
void VuoCompilerCodeGenUtilities::generateAsynchronousSubmissionToDispatchQueue ( Module *  module,
BasicBlock *  block,
Value *  dispatchQueueValue,
Function *  workerFunction,
Value *  contextValue 
)
static

Generates code that submits a function for asynchronous execution on a dispatch queue.

void VuoCompilerCodeGenUtilities::generateCompositionContextFiniHelper ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue,
Function *  destroyNodeContextFunction,
Function *  releasePortDataFunction 
)
static

Generates a call to vuoCompositionContextFiniHelper().

Value * VuoCompilerCodeGenUtilities::generateCompositionContextInitHelper ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue,
bool  isStatefulComposition,
size_t  publishedOutputPortCount,
Function *  createNodeContextsFunction,
Function *  destroyNodeContextFunction,
Function *  setPortValueFunction 
)
static

Generates a call to vuoCompositionContextInitHelper().

Value * VuoCompilerCodeGenUtilities::generateCreateCompositionState ( Module *  module,
BasicBlock *  block,
Value *  runtimeStateValue,
Value *  compositionIdentifierValue 
)
static

Generates code that creates a VuoCompositionState * from the given void *runtimeState and char *compositionIdentifier.

Value * VuoCompilerCodeGenUtilities::generateCreateDispatchGroup ( Module *  module,
BasicBlock *  block 
)
static

Generates code that constructs a dispatch_group_t.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
Returns
The return value of dispatch_group_create().
Value * VuoCompilerCodeGenUtilities::generateCreateDispatchQueue ( Module *  module,
BasicBlock *  block,
string  dispatchQueueName 
)
static

Generates code that constructs a dispatch_queue_t.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
dispatchQueueNameThe argument to pass to dispatch_queue_create().
Returns
The return value of dispatch_queue_create().
Value * VuoCompilerCodeGenUtilities::generateCreateDispatchSemaphore ( Module *  module,
BasicBlock *  block,
int  initialValue = 1 
)
static

Generates code that constructs a dispatch_semaphore_t.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
initialValueThe argument to pass to dispatch_semaphore_create().
Returns
The return value of dispatch_semaphore_create().
Value * VuoCompilerCodeGenUtilities::generateCreateDispatchTime ( Module *  module,
BasicBlock *  block,
Value *  deltaValue 
)
static

Generates code that creates a dispatch_time_t by calling dispatch_time_create(DISPATCH_TIME_NOW, ...).

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
deltaValueThe 2nd argument to dispatch_time_create.
Returns
The created dispatch_time_t.
Value * VuoCompilerCodeGenUtilities::generateCreateNodeContext ( Module *  module,
BasicBlock *  block,
bool  hasInstanceData,
bool  isComposition,
size_t  outputEventCount 
)
static

Generates code that allocates a NodeContext on the heap and initializes it with default values.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
hasInstanceDataWhether this node has instance data.
isCompositionWhether this node is a subcomposition.
outputEventCountThe number of output ports, used to create the outputEvents field for subcompositions.
Returns
A value of type NodeContext *.
Value * VuoCompilerCodeGenUtilities::generateCreatePortContext ( Module *  module,
BasicBlock *  block,
Type *  dataType,
bool  isTrigger,
std::string  triggerQueueName 
)
static

Generates code that allocates a PortContext on the heap and initializes it with default values.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
dataTypeThe type of the port's data, or null if the port is event-only.
isTriggerWhether the port is a trigger.
triggerQueueNameIf the port is a trigger, the name to use when creating its dispatch queue.
Returns
A value of type PortContext *.
void VuoCompilerCodeGenUtilities::generateEnterDispatchGroup ( Module *  module,
BasicBlock *  block,
Value *  dispatchGroupValue 
)
static

Generates code that increments the block count of a dispatch_group_t.

void VuoCompilerCodeGenUtilities::generateFinalizationForDispatchObject ( Module *  module,
BasicBlock *  block,
Value *  dispatchObjectVariable 
)
static

Generates code that releases a dispatch_object_t (dispatch_queue_t, dispatch_group_t, dispatch_semaphore_t, etc.).

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
dispatchObjectVariableA pointer to the dispatch_object_t (e.g. a GlobalVariable or AllocaInst).
Value * VuoCompilerCodeGenUtilities::generateFormattedString ( Module *  module,
BasicBlock *  block,
string  formatString,
vector< Value * >  replacementValues,
VuoCompilerConstantStringCache constantStrings 
)
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.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
formatStringThe format string to be passed to snprintf.
replacementValuesThe replacement values to be passed to snprintf.
constantStringsThe cache of LLVM constants used to generate string values.
Returns
A value containing the address of the composite string.
void VuoCompilerCodeGenUtilities::generateFreeCall ( Module *  module,
BasicBlock *  block,
Value *  argument 
)
static

Generates a call to free argument (after casting it to a void pointer).

void VuoCompilerCodeGenUtilities::generateFreeCompositionState ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue 
)
static

Generates code that frees a VuoCompositionState * (but not its fields).

void VuoCompilerCodeGenUtilities::generateFreeNodeContext ( Module *  module,
BasicBlock *  block,
Value *  nodeContextValue 
)
static

Generates code that frees a NodeContext * and its fields, including the port contexts within its portContexts field.

The generated code does not release the data pointed to by the instanceData field, if any.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
nodeContextValueA value of type NodeContext *.
Value * VuoCompilerCodeGenUtilities::generateGetArrayElement ( Module *  module,
BasicBlock *  block,
Value *  arrayValue,
size_t  elementIndex 
)
static

Generates code that gets the array element at the given index.

Value * VuoCompilerCodeGenUtilities::generateGetCompositionContext ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue 
)
static

Generates a call to vuoGetCompositionContext().

Value * VuoCompilerCodeGenUtilities::generateGetCompositionStateCompositionIdentifier ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue 
)
static

Generates code that gets the compositionIdentifier field of a VuoCompositionState *.

Value * VuoCompilerCodeGenUtilities::generateGetCompositionStateRuntimeState ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue 
)
static

Generates code that gets the runtimeState field of a VuoCompositionState *.

Value * VuoCompilerCodeGenUtilities::generateGetDataForPort ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue,
Value *  portIdentifierValue 
)
static

Generates code that retrives the data field in a port's context, given the port's identifier.

Value * VuoCompilerCodeGenUtilities::generateGetGlobalDispatchQueue ( Module *  module,
BasicBlock *  block 
)
static

Generates code that retrieves the global dispatch queue.

Value * VuoCompilerCodeGenUtilities::generateGetInputPortString ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue,
Value *  portIdentifierValue,
Value *  interprocessSerializationValue 
)
static

Generates a call to vuoGetInputPortString().

Value * VuoCompilerCodeGenUtilities::generateGetNextEventId ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue 
)
static

Generates a call to vuoGetNextEventId().

Value * VuoCompilerCodeGenUtilities::generateGetNodeContext ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue,
size_t  nodeIndex 
)
static

Generates a call to vuoGetNodeContext().

Value * VuoCompilerCodeGenUtilities::generateGetNodeContext ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue,
Value *  nodeIndexValue 
)
static

Generates a call to vuoGetNodeContext().

Value * VuoCompilerCodeGenUtilities::generateGetNodeContextClaimingEventId ( Module *  module,
BasicBlock *  block,
Value *  nodeContextValue 
)
static

Generates code that gets the claimingEventId field of a NodeContext.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
nodeContextValueA value of type NodeContext *.
Returns
The value of the field.
Value * VuoCompilerCodeGenUtilities::generateGetNodeContextExecutingEventId ( Module *  module,
BasicBlock *  block,
Value *  nodeContextValue 
)
static

Generates code that gets the executingEventId field of a NodeContext.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
nodeContextValueA value of type NodeContext *.
Returns
The value of the field.
Value * VuoCompilerCodeGenUtilities::generateGetNodeContextExecutingGroup ( Module *  module,
BasicBlock *  block,
Value *  nodeContextValue 
)
static

Generates code that gets the executingGroup field of a NodeContext.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
nodeContextValueA value of type NodeContext *.
Returns
The value of the field.
Value * VuoCompilerCodeGenUtilities::generateGetNodeContextInstanceData ( Module *  module,
BasicBlock *  block,
Value *  nodeContextValue,
Type *  instanceDataType 
)
static

Generates code that gets the instanceData field of a NodeContext (and dereference it to get the actual instance data).

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
nodeContextValueA value of type NodeContext *.
instanceDataTypeThe type that the instanceData field should be converted to before returning.
Returns
The value of the field.
Value * VuoCompilerCodeGenUtilities::generateGetNodeContextInstanceDataVariable ( Module *  module,
BasicBlock *  block,
Value *  nodeContextValue,
Type *  instanceDataType 
)
static

Generates code that gets the address of the instanceData field of a NodeContext.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
nodeContextValueA value of type NodeContext *.
instanceDataTypeThe type that the instanceData field should be converted to before returning.
Returns
The value of the field.
Value * VuoCompilerCodeGenUtilities::generateGetNodeContextOutputEvent ( Module *  module,
BasicBlock *  block,
Value *  nodeContextValue,
size_t  index 
)
static

Generates code that gets an element of the outputEvents field of a NodeContext.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
nodeContextValueA value of type NodeContext *.
indexThe index of the event in the node context's array of output events.
Returns
The value of the field.
Value * VuoCompilerCodeGenUtilities::generateGetNodeContextPortContext ( Module *  module,
BasicBlock *  block,
Value *  nodeContextValue,
int  index 
)
static

Generates code that gets an element of the portContexts field of a NodeContext.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
nodeContextValueA value of type NodeContext *.
indexThe index of the port context in the node context's array of port contexts.
Returns
The value of the field.
Value * VuoCompilerCodeGenUtilities::generateGetNodeContextSemaphore ( Module *  module,
BasicBlock *  block,
Value *  nodeContextValue 
)
static

Generates code that gets the semaphore field of a NodeContext.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
nodeContextValueA value of type NodeContext *.
Returns
The value of the field.
Value * VuoCompilerCodeGenUtilities::generateGetNodeIndexForPort ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue,
Value *  portIdentifierValue 
)
static

Generates code that retrieves the index (in VuoCompilerBitcodeGenerator::orderedNodes) of a node, given the identifier of a port on the node.

Value * VuoCompilerCodeGenUtilities::generateGetNodeSemaphoreForPort ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue,
Value *  portIdentifierValue 
)
static

Generates code that retrives the semaphore field in a node's context, given the identifier of a port on the node.

Value * VuoCompilerCodeGenUtilities::generateGetOutputPortString ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue,
Value *  portIdentifierValue,
Value *  interprocessSerializationValue 
)
static

Generates a call to vuoGetOutputPortString().

Value * VuoCompilerCodeGenUtilities::generateGetPortContextData ( Module *  module,
BasicBlock *  block,
Value *  portContextValue,
Type *  dataType 
)
static

Generates code that gets the data field of a PortContext (and dereferences it to extract the actual data).

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
portContextValueA value of type PortContext *.
dataTypeThe type that the data should be converted to before returning.
Returns
The value of the field.
Value * VuoCompilerCodeGenUtilities::generateGetPortContextDataVariable ( Module *  module,
BasicBlock *  block,
Value *  portContextValue,
Type *  dataType 
)
static

Generates code that gets the address of the data field of a PortContext.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
portContextValueA value of type PortContext *.
dataTypeThe type that the data should be converted to before returning.
Returns
The value of the field.
Value * VuoCompilerCodeGenUtilities::generateGetPortContextDataVariableAsVoidPointer ( Module *  module,
BasicBlock *  block,
Value *  portContextValue 
)
static

Generates code that gets the address of the data field of a PortContext as a void pointer.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
portContextValueA value of type PortContext *.
Returns
The value of the field.
Value * VuoCompilerCodeGenUtilities::generateGetPortContextEvent ( Module *  module,
BasicBlock *  block,
Value *  portContextValue 
)
static

Generates code that gets the event field of a PortContext.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
portContextValueA value of type PortContext *.
Returns
The value of the field.
Value * VuoCompilerCodeGenUtilities::generateGetPortContextTriggerFunction ( Module *  module,
BasicBlock *  block,
Value *  portContextValue,
FunctionType *  functionType 
)
static

Generates code that gets the triggerFunction field of a PortContext.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
portContextValueA value of type PortContext *.
functionTypeThe type that the function value should be converted to before returning.
Returns
The value of the field.
Value * VuoCompilerCodeGenUtilities::generateGetPortContextTriggerQueue ( Module *  module,
BasicBlock *  block,
Value *  portContextValue 
)
static

Generates code that gets the triggerQueue field of a PortContext.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
portContextValueA value of type PortContext *.
Returns
The value of the field.
Value * VuoCompilerCodeGenUtilities::generateGetPortContextTriggerSemaphore ( Module *  module,
BasicBlock *  block,
Value *  portContextValue 
)
static

Generates code that gets the triggerSemaphore field of a PortContext.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
portContextValueA value of type PortContext *.
Returns
The value of the field.
Value * VuoCompilerCodeGenUtilities::generateGetTypeIndexForPort ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue,
Value *  portIdentifierValue 
)
static

Generates code that retrieves the index (in VuoCompilerBitcodeGenerator::orderedTypes) of a port's type, given the port's identifier.

void VuoCompilerCodeGenUtilities::generateGrantThreadsToChain ( Module *  module,
BasicBlock *  block,
int  minThreadsNeeded,
int  maxThreadsNeeded,
Value *  eventIdValue,
Value *  compositionStateValue,
size_t  chainIndex 
)
static

Generates a call to vuoGrantThreadsToChain.

void VuoCompilerCodeGenUtilities::generateGrantThreadsToSubcomposition ( Module *  module,
BasicBlock *  block,
Value *  eventIdValue,
Value *  compositionStateValue,
Value *  chainIndexValue,
Value *  subcompositionIdentifierValue 
)
static

Generates a call to vuoGrantThreadsToSubcomposition.

void VuoCompilerCodeGenUtilities::generateIndexMatchingCode ( Module *  module,
Function *  function,
BasicBlock *  initialBlock,
BasicBlock *  finalBlock,
Value *  inputIndexValue,
vector< pair< BasicBlock *, BasicBlock * > >  blocksForIndex 
)
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] ...

Parameters
moduleThe module in which to generate code.
functionThe function in which to generate code.
initialBlockThe block to which the first if-statement will be appended.
finalBlockThe block following the if-else statements.
inputIndexValueThe index to compare in each if-statement.
blocksForIndexFor 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.
ICmpInst * VuoCompilerCodeGenUtilities::generateIsNodeBeingAddedOrReplacedCheck ( Module *  module,
Function *  function,
std::string  nodeIdentifier,
Value *  compositionStateValue,
BasicBlock *  initialBlock,
BasicBlock *&  trueBlock,
BasicBlock *&  falseBlock,
VuoCompilerConstantStringCache constantStrings,
Value *&  replacementJsonValue 
)
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.

void VuoCompilerCodeGenUtilities::generateIsNodeBeingRemovedOrReplacedCheck ( Module *  module,
Function *  function,
std::string  nodeIdentifier,
Value *  compositionStateValue,
BasicBlock *  initialBlock,
BasicBlock *&  trueBlock,
BasicBlock *&  falseBlock,
VuoCompilerConstantStringCache constantStrings,
Value *&  replacementJsonValue 
)
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.

ICmpInst * VuoCompilerCodeGenUtilities::generateIsPausedComparison ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue 
)
static

Generates code that gets the return value of vuoIsPaused() as a comparison value.

void VuoCompilerCodeGenUtilities::generateJsonObjectPut ( Module *  module,
BasicBlock *  block,
Value *  jsonObjectValue 
)
static

Generates a call to json_object_put().

void VuoCompilerCodeGenUtilities::generateLeaveDispatchGroup ( Module *  module,
BasicBlock *  block,
Value *  dispatchGroupValue 
)
static

Generates code that decrements the block count of a dispatch_group_t.

Value * VuoCompilerCodeGenUtilities::generateMemoryAllocation ( Module *  module,
BasicBlock *  block,
Type *  elementType,
int  elementCount 
)
static

Generates code that dynamically allocates memory for an array.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
elementTypeThe type of each array element.
elementCountThe number of array elements.
Returns
A value pointing to the address of the memory.
Value * VuoCompilerCodeGenUtilities::generateMemoryAllocation ( Module *  module,
BasicBlock *  block,
Type *  elementType,
Value *  elementCountValue 
)
static

Generates code that dynamically allocates memory for an array.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
elementTypeThe type of each array element.
elementCountValueThe number of array elements. Assumed to have type integer.
Returns
A value pointing to the address of the memory.
void VuoCompilerCodeGenUtilities::generateModuleMetadata ( Module *  module,
string  metadata,
string  moduleKey 
)
static

Generates code equivalent to the VuoModuleMetadata macro.

ConstantInt * VuoCompilerCodeGenUtilities::generateNoEventIdConstant ( Module *  module)
static

Generates a dummy event ID to represent that no event is claiming a node.

void VuoCompilerCodeGenUtilities::generateNullCheck ( Module *  module,
Function *  function,
Value *  valueToCheck,
BasicBlock *  initialBlock,
BasicBlock *&  nullBlock,
BasicBlock *&  notNullBlock 
)
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.

Constant * VuoCompilerCodeGenUtilities::generatePointerToConstantArrayOfStrings ( Module *  module,
vector< string >  stringValues,
string  globalVariableName = "" 
)
static

Generates code that creates a global array-of-strings variable.

Parameters
moduleThe module in which to generate code.
stringValuesThe strings to be placed in the array.
globalVariableNameThe name to give to the global variable.
Returns
The address of the array.
Constant * VuoCompilerCodeGenUtilities::generatePointerToConstantString ( Module *  module,
string  stringValue,
string  globalVariableName = "" 
)
static

Generates code that creates a global string variable.

Parameters
moduleThe module in which to generate code.
stringValueThe string initializer for the global variable.
globalVariableNameThe name to give to the global variable.
Returns
The address of the string.
Value * VuoCompilerCodeGenUtilities::generatePointerToValue ( BasicBlock *  block,
Value *  value 
)
static

Generates code that creates a pointer to value (on the stack), and returns the pointer.

void VuoCompilerCodeGenUtilities::generatePrint ( Module *  module,
BasicBlock *  block,
string  formatString,
Value *  value = NULL 
)
static

Generates code that prints to stderr either a string literal or a formatted string with a value.

(Useful for debugging.)

void VuoCompilerCodeGenUtilities::generatePrint ( Module *  module,
BasicBlock *  block,
string  formatString,
const vector< Value * > &  values 
)
static

Generates code that prints to stderr either a string literal or a formatted string with a value.

(Useful for debugging.)

void VuoCompilerCodeGenUtilities::generateRegisterCall ( Module *  module,
BasicBlock *  block,
Value *  argument,
Function *  freeFunction 
)
static

Generates code to register argument.

void VuoCompilerCodeGenUtilities::generateReleaseCall ( Module *  module,
BasicBlock *  block,
Value *  argument 
)
static

Generates any code needed to release argument.

void VuoCompilerCodeGenUtilities::generateRemoveCompositionStateFromThreadLocalStorage ( Module *  module,
BasicBlock *  block 
)
static
void VuoCompilerCodeGenUtilities::generateResetNodeContextEvents ( Module *  module,
BasicBlock *  block,
Value *  nodeContextValue 
)
static

Generates code that sets the event field to false for all PortContexts in a NodeContext.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
nodeContextValueA value of type NodeContext *.
void VuoCompilerCodeGenUtilities::generateRetainCall ( Module *  module,
BasicBlock *  block,
Value *  argument 
)
static

Generates any code needed to retain argument.

void VuoCompilerCodeGenUtilities::generateRetainForDispatchObject ( Module *  module,
BasicBlock *  block,
Value *  dispatchObjectVariable 
)
static

Generates code that retains a dispatch_object_t (dispatch_queue_t, dispatch_group_t, dispatch_semaphore_t, etc.).

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
dispatchObjectVariableA pointer to the dispatch_object_t (e.g. a GlobalVariable or AllocaInst).
void VuoCompilerCodeGenUtilities::generateRetainPortContextData ( Module *  module,
BasicBlock *  block,
Value *  portContextValue 
)
static

Generates code that calls vuoRetainPortContextData().

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
portContextValueA value of type PortContext *.
void VuoCompilerCodeGenUtilities::generateReturnThreadsForChainWorker ( Module *  module,
BasicBlock *  block,
Value *  eventIdValue,
Value *  compositionStateValue,
Value *  chainIndexValue 
)
static

Generates a call to vuoReturnThreadsForChainWorker.

void VuoCompilerCodeGenUtilities::generateReturnThreadsForTriggerWorker ( Module *  module,
BasicBlock *  block,
Value *  eventIdValue,
Value *  compositionStateValue 
)
static

Generates a call to vuoReturnThreadsForTriggerWorker.

Value * VuoCompilerCodeGenUtilities::generateRuntimeStateValue ( Module *  module,
BasicBlock *  block 
)
static

Generates code that gets the value of the vuoRuntimeState global variable.

void VuoCompilerCodeGenUtilities::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 
)
static

Generates a call to vuoScheduleChainWorker.

void VuoCompilerCodeGenUtilities::generateScheduleTriggerWorker ( Module *  module,
BasicBlock *  block,
Value *  queueValue,
Value *  contextValue,
Value *  workerFunctionValue,
int  minThreadsNeeded,
int  maxThreadsNeeded,
Value *  eventIdValue,
Value *  compositionStateValue,
int  chainCount 
)
static

Generates a call to vuoScheduleTriggerWorker.

void VuoCompilerCodeGenUtilities::generateSendEventDropped ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue,
Value *  portIdentifierValue 
)
static

Generates a call to vuoSendEventDropped().

void VuoCompilerCodeGenUtilities::generateSendInputPortsUpdated ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue,
Value *  portIdentifierValue,
Value *  receivedEventValue,
Value *  receivedDataValue,
Value *  portDataSummaryValue 
)
static

Generates a call to vuoSendInputPortsUpdated().

void VuoCompilerCodeGenUtilities::generateSendNodeExecutionFinished ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue,
Value *  nodeIdentifierValue 
)
static

Generates a call to vuoSendNodeExecutionFinished().

void VuoCompilerCodeGenUtilities::generateSendNodeExecutionStarted ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue,
Value *  nodeIdentifierValue 
)
static

Generates a call to vuoSendNodeExecutionStarted().

void VuoCompilerCodeGenUtilities::generateSendOutputPortsUpdated ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue,
Value *  portIdentifierValue,
Value *  sentDataValue,
Value *  portDataSummaryValue 
)
static

Generates a call to vuoSendOutputPortsUpdated().

void VuoCompilerCodeGenUtilities::generateSendPublishedOutputPortsUpdated ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue,
Value *  portIdentifierValue,
Value *  sentDataValue,
Value *  portDataSummaryValue 
)
static
Value * VuoCompilerCodeGenUtilities::generateSerialization ( Module *  module,
BasicBlock *  block,
Value *  valueToSerialize,
VuoCompilerConstantStringCache constantStrings 
)
static

Generates code that creates a string representation of the given value.

Todo:
Handle other primitive types and structs (https://b33p.net/kosada/node/3942)
void VuoCompilerCodeGenUtilities::generateSetArrayElement ( Module *  module,
BasicBlock *  block,
Value *  arrayValue,
size_t  elementIndex,
Value *  value 
)
static

Generates code that sets the array element at the given index.

void VuoCompilerCodeGenUtilities::generateSetNodeContextClaimingEventId ( Module *  module,
BasicBlock *  block,
Value *  nodeContextValue,
Value *  claimingEventIdValue 
)
static

Generates code that sets the claimingEventId field of a NodeContext.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
nodeContextValueA value of type NodeContext *.
claimingEventIdValueThe value to set the field to.
void VuoCompilerCodeGenUtilities::generateSetNodeContextExecutingEventId ( Module *  module,
BasicBlock *  block,
Value *  nodeContextValue,
Value *  executingEventIdValue 
)
static

Generates code that sets the executingEventId field of a NodeContext.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
nodeContextValueA value of type NodeContext *.
executingEventIdValueThe value to set the field to.
void VuoCompilerCodeGenUtilities::generateSetNodeContextInstanceData ( Module *  module,
BasicBlock *  block,
Value *  nodeContextValue,
Value *  instanceDataValue 
)
static

Generates code that sets the instanceData field of a NodeContext (to a heap-allocated copy of instanceDataValue) and frees the old value.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
nodeContextValueA value of type NodeContext *.
instanceDataValueThe value to set the field to.
void VuoCompilerCodeGenUtilities::generateSetNodeContextOutputEvent ( Module *  module,
BasicBlock *  block,
Value *  nodeContextValue,
size_t  index,
Value *  eventValue 
)
static

Generates code that sets an element of the outputEvents field of a NodeContext.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
nodeContextValueA value of type NodeContext *.
indexThe index of the event in the node context's array of output events.
eventValueThe value to set the field to.
void VuoCompilerCodeGenUtilities::generateSetNodeContextPortContexts ( Module *  module,
BasicBlock *  block,
Value *  nodeContextValue,
vector< Value * >  portContextValues 
)
static

Generates code that sets the portContexts and portContextCount fields of a NodeContext.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
nodeContextValueA value of type NodeContext *.
portContextValuesThe values to be placed in an array and stored in the field.
void VuoCompilerCodeGenUtilities::generateSetPortContextData ( Module *  module,
BasicBlock *  block,
Value *  portContextValue,
Value *  dataValue 
)
static

Generates code that sets the data field of a PortContext to a heap-allocated copy of dataValue.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
portContextValueA value of type PortContext *.
dataValueThe value to set the field to.
void VuoCompilerCodeGenUtilities::generateSetPortContextEvent ( Module *  module,
BasicBlock *  block,
Value *  portContextValue,
Value *  eventValue 
)
static

Generates code that sets the event field of a PortContext.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
portContextValueA value of type PortContext *.
eventValueThe value to set the field to.
void VuoCompilerCodeGenUtilities::generateSetPortContextTriggerFunction ( Module *  module,
BasicBlock *  block,
Value *  portContextValue,
Value *  triggerFunctionValue 
)
static

Generates code that sets the triggerFunction field of a PortContext.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
portContextValueA value of type PortContext *.
triggerFunctionValueThe value to set the field to.
ICmpInst * VuoCompilerCodeGenUtilities::generateShouldSendDataTelemetryComparison ( Module *  module,
BasicBlock *  block,
string  portIdentifier,
Value *  compositionStateValue,
VuoCompilerConstantStringCache constantStrings 
)
static

Generates code that gets the return value of the vuoShouldSendPortDataTelemetry() function as a comparison value.

void VuoCompilerCodeGenUtilities::generateSignalForSemaphore ( Module *  module,
BasicBlock *  block,
Value *  semaphoreValue 
)
static

Generates code that signals a dispatch_semaphore_t.

void VuoCompilerCodeGenUtilities::generateSignalForSemaphore ( Module *  module,
BasicBlock *  block,
AllocaInst *  semaphoreVariable 
)
static

Generates code that signals a dispatch_semaphore_t.

Value * VuoCompilerCodeGenUtilities::generateStringConcatenation ( Module *  module,
BasicBlock *  block,
vector< Value * >  stringsToConcatenate,
VuoCompilerConstantStringCache constantStrings 
)
static

Generates code that allocates a buffer to hold the composite string, then concatenates each member of stringsToConcatenate into the composite string.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
stringsToConcatenateThe strings to concatenate. Each element should be a value of type pointer-to-char.
constantStringsThe cache of LLVM constants used to generate string values.
Returns
A value containing the address of the composite string.
void VuoCompilerCodeGenUtilities::generateStringMatchingCode ( Module *  module,
Function *  function,
BasicBlock *  initialBlock,
BasicBlock *  finalBlock,
Value *  inputStringValue,
map< string, pair< BasicBlock *, BasicBlock * > >  blocksForString,
VuoCompilerConstantStringCache constantStrings 
)
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] ...

Parameters
moduleThe module in which to generate code.
functionThe function in which to generate code.
initialBlockThe block to which the first if-statement will be appended.
finalBlockThe block following the if-else statements.
inputStringValueThe string to compare in each if-statement.
blocksForStringFor 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.
constantStringsThe cache of LLVM constants used to generate string values.
void VuoCompilerCodeGenUtilities::generateSynchronousSubmissionToDispatchQueue ( Module *  module,
BasicBlock *  block,
Value *  dispatchQueueValue,
Function *  workerFunction,
Value *  contextValue 
)
static

Generates code that submits a function for synchronous execution on a dispatch queue.

Value * VuoCompilerCodeGenUtilities::generateTypeCast ( Module *  module,
BasicBlock *  block,
Value *  valueToCast,
Type *  typeToCastTo 
)
static

Generates code to cast the value to the desired type (if it doesn't already have that type).

Returns
A value of type typeToCastTo (which may be valueToCast).
void VuoCompilerCodeGenUtilities::generateUnserialization ( Module *  module,
BasicBlock *  block,
Value *  stringToUnserialize,
Value *  destinationVariable,
VuoCompilerConstantStringCache constantStrings 
)
static

Generates code that creates a value of the given type from the given string representation, and stores it in the destination variable.

Todo:
Handle other primitive types and structs (https://b33p.net/kosada/node/3942)
void VuoCompilerCodeGenUtilities::generateWaitForDispatchGroup ( Module *  module,
BasicBlock *  block,
Value *  dispatchGroupValue,
dispatch_time_t  timeout = DISPATCH_TIME_FOREVER 
)
static

Generates code that waits on a dispatch_group_t.

Value * VuoCompilerCodeGenUtilities::generateWaitForSemaphore ( Module *  module,
BasicBlock *  block,
Value *  semaphoreValue 
)
static

Generates code that waits for and claims a dispatch_semaphore_t, with a timeout of DISPATCH_TIME_FOREVER.

Value * VuoCompilerCodeGenUtilities::generateWaitForSemaphore ( Module *  module,
BasicBlock *  block,
AllocaInst *  semaphoreVariable 
)
static

Generates code that waits for and claims a dispatch_semaphore_t, with a timeout of DISPATCH_TIME_FOREVER.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
semaphoreVariableThe semaphore.
Returns
The return value of dispatch_semaphore_wait().
Value * VuoCompilerCodeGenUtilities::generateWaitForSemaphore ( Module *  module,
BasicBlock *  block,
Value *  semaphoreValue,
Value *  timeoutValue 
)
static

Generates code that waits for and possibly claims a dispatch_semaphore_t.

Value * VuoCompilerCodeGenUtilities::generateWaitForSemaphore ( Module *  module,
BasicBlock *  block,
AllocaInst *  semaphoreVariable,
Value *  timeoutValue 
)
static

Generates code that waits for and possibly claims a dispatch_semaphore_t.

Parameters
moduleThe module in which to generate code.
blockThe block in which to generate code.
semaphoreVariableThe semaphore.
timeoutValueA value of type dispatch_time_t to pass to dispatch_semaphore_wait().
Returns
The return value of dispatch_semaphore_wait().
Function * VuoCompilerCodeGenUtilities::getAnnotateFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getCleanupFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getCompositionContextFiniFunction ( Module *  module,
string  moduleKey 
)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getCompositionContextInitFunction ( Module *  module,
string  moduleKey 
)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getCompositionCreateNodeContextsFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getCompositionDestroyNodeContextFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getCompositionGetPortValueFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getCompositionReleasePortDataFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getCompositionSetPortValueFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

StructType * VuoCompilerCodeGenUtilities::getCompositionStateType ( Module *  module)
static

Returns a Type reference, generating code for the declaration if needed.

PointerType * VuoCompilerCodeGenUtilities::getDispatchGroupType ( Module *  module)
static

Returns a Type reference, generating code for the declaration if needed.

StructType * VuoCompilerCodeGenUtilities::getDispatchObjectType ( Module *  module)
static

Returns a Type reference, generating code for the declaration if needed.

PointerType * VuoCompilerCodeGenUtilities::getDispatchSemaphoreType ( Module *  module)
static

Returns a Type reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getFprintfFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getFreeFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

FunctionType * VuoCompilerCodeGenUtilities::getFunctionType ( Module *  module,
VuoType paramType 
)
static

Returns a function type that accepts a vuoType (or its lowered form) as its parameter and has a void return type.

Function * VuoCompilerCodeGenUtilities::getGetPortValueFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getGetPublishedInputPortValueFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getGetPublishedOutputPortValueFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getInstanceFiniFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getInstanceInitFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getInstanceTriggerStartFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getInstanceTriggerStopFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getJsonObjectPutFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getJsonObjectToJsonStringExtFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

StructType * VuoCompilerCodeGenUtilities::getJsonObjectType ( Module *  module)
static

Returns a Type reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getJsonTokenerParseFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getMallocFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

StructType * VuoCompilerCodeGenUtilities::getNodeContextType ( Module *  module)
static

Returns a Type reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getNodeEventFunction ( Module *  module,
string  moduleKey,
bool  isSubcomposition,
bool  isStateful,
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 
)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getNodeInstanceFiniFunction ( Module *  module,
string  moduleKey,
VuoCompilerConstantStringCache constantStrings 
)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getNodeInstanceInitFunction ( Module *  module,
string  moduleKey,
const vector< VuoPort * > &  modelInputPorts,
map< VuoPort *, size_t > &  indexOfParameter,
VuoCompilerConstantStringCache constantStrings 
)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getNodeInstanceTriggerStartFunction ( Module *  module,
string  moduleKey,
const vector< VuoPort * > &  modelInputPorts,
map< VuoPort *, size_t > &  indexOfParameter,
VuoCompilerConstantStringCache constantStrings 
)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getNodeInstanceTriggerStopFunction ( Module *  module,
string  moduleKey,
VuoCompilerConstantStringCache constantStrings 
)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getNodeInstanceTriggerUpdateFunction ( Module *  module,
string  moduleKey,
const vector< VuoPort * > &  modelInputPorts,
map< VuoPort *, size_t > &  indexOfParameter,
VuoCompilerConstantStringCache constantStrings 
)
static

Returns a Function reference, generating code for the declaration if needed.

Type * VuoCompilerCodeGenUtilities::getParameterTypeBeforeLowering ( Function *  function,
Module *  module,
string  typeName 
)
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.)

StructType * VuoCompilerCodeGenUtilities::getPortContextType ( Module *  module)
static

Returns a Type reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getPutsFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getSetInputPortValueFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getSetPublishedInputPortValueFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getSetupFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getSnprintfFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getSscanfFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getStrcatFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getStrcmpFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getStrdupFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Function * VuoCompilerCodeGenUtilities::getStrlenFunction ( Module *  module)
static

Returns a Function reference, generating code for the declaration if needed.

Value * VuoCompilerCodeGenUtilities::getTriggerWorkersScheduledValue ( Module *  module,
BasicBlock *  block,
Value *  compositionStateValue 
)
static

Generates a call to vuoGetTriggerWorkersScheduled().

Function * VuoCompilerCodeGenUtilities::getWaitForNodeFunction ( Module *  module,
string  moduleKey 
)
static

Returns a Function reference, generating code for the declaration if needed.

bool VuoCompilerCodeGenUtilities::isFunctionReturningStructViaParameter ( Function *  function)
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 *, ...).

bool VuoCompilerCodeGenUtilities::isRetainOrReleaseNeeded ( Type *  type)
static
Value * VuoCompilerCodeGenUtilities::unlowerArgument ( VuoCompilerType unloweredVuoType,
Function *  function,
int  parameterIndex,
Module *  module,
BasicBlock *  block 
)
static

If needed, generates code to convert a function argument from the "lowered" type of the function parameter to an un-lowered type.

Parameters
unloweredVuoTypeThe type that the argument should be converted to.
functionThe function to which the argument has been passed.
parameterIndexThe index of the argument in the function's argument list (starting at 0).
moduleThe module in which to generate code.
blockThe block in which to generate code.
Returns
The argument converted to its un-lowered type. May be the same as the original argument.

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