47 Value *compositionStateValue, Value *eventIdValue,
48 Value *portContextValue,
VuoType *dataType,
49 int minThreadsNeeded,
int maxThreadsNeeded,
int chainCount,
50 Function *workerFunction)
52 PointerType *voidPointer = PointerType::get(IntegerType::get(module->getContext(), 8), 0);
54 Value *dataCopyAsVoidPointer;
65 dataCopyAsVoidPointer = ConstantPointerNull::get(voidPointer);
70 new StoreInst(eventIdValue, eventIdCopyAddress,
false, block);
73 dataCopyAsVoidPointer, eventIdCopyAddress);
78 minThreadsNeeded, maxThreadsNeeded,
79 eventIdValue, compositionStateValue, chainCount);
87 string workerFunctionName, Value *workerFunctionArg)
91 PointerType *voidPointer = PointerType::get(IntegerType::get(module->getContext(), 8), 0);
92 Value *argAsVoidPointer;
93 if (workerFunctionArg)
94 argAsVoidPointer =
new BitCastInst(workerFunctionArg, voidPointer,
"", block);
96 argAsVoidPointer = ConstantPointerNull::get(voidPointer);
102 return workerFunction;
110 PointerType *voidPointer = PointerType::get(IntegerType::get(module->getContext(), 8), 0);
112 vector<Type *> workerFunctionParams;
113 workerFunctionParams.push_back(voidPointer);
114 FunctionType *workerFunctionType = FunctionType::get(Type::getVoidTy(module->getContext()),
115 workerFunctionParams,
118 Function *workerFunction =
module->getFunction(functionName);
119 if (! workerFunction) {
120 workerFunction = Function::Create(workerFunctionType,
121 isExternal ? GlobalValue::ExternalLinkage : GlobalValue::InternalLinkage,
126 return workerFunction;
135 ConstantInt *timeoutDeltaValue = ConstantInt::get(module->getContext(), APInt(64, 0));
196 Value *contextValue = workerFunction->arg_begin();
197 Type *voidPointerType = contextValue->getType();
198 Type *voidPointerPointerType = PointerType::get(voidPointerType, 0);
201 Value *contextValueAsVoidPointerArray =
new BitCastInst(contextValue, voidPointerPointerType,
"", block);
203 return new BitCastInst(compositionStateAsVoidPointer, compositionStatePointerType,
"", block);
215 Value *contextValue = workerFunction->arg_begin();
216 Type *voidPointerType = contextValue->getType();
217 Type *voidPointerPointerType = PointerType::get(voidPointerType, 0);
219 Value *contextValueAsVoidPointerArray =
new BitCastInst(contextValue, voidPointerPointerType,
"", block);
232 Value *contextValue = workerFunction->arg_begin();
233 Type *voidPointerType = contextValue->getType();
234 Type *voidPointerPointerType = PointerType::get(voidPointerType, 0);
237 Value *contextValueAsVoidPointerArray =
new BitCastInst(contextValue, voidPointerPointerType,
"", block);
239 PointerType *pointerToEventIdType = PointerType::get(eventIdType, 0);
240 Value *eventIdCopyValue =
new BitCastInst(eventIdCopyAsVoidPointer, pointerToEventIdType,
"", block);
241 return new LoadInst(eventIdCopyValue,
"", block);
251 Value *currentDataValue = NULL;
260 Value *currentDataVoidPointer =
generateDataValue(module, block, workerFunction);
262 currentDataValue =
new LoadInst(currentDataPointer,
"", block);
270 return currentDataValue;