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;
66 dataCopyAsVoidPointer = ConstantPointerNull::get(voidPointer);
71 new StoreInst(eventIdValue, eventIdCopyAddress,
false, block);
74 dataCopyAsVoidPointer, eventIdCopyAddress);
79 minThreadsNeeded, maxThreadsNeeded,
80 eventIdValue, compositionStateValue, chainCount);
88 string workerFunctionName, Value *workerFunctionArg)
92 PointerType *voidPointer = PointerType::get(IntegerType::get(module->getContext(), 8), 0);
93 Value *argAsVoidPointer;
94 if (workerFunctionArg)
95 argAsVoidPointer =
new BitCastInst(workerFunctionArg, voidPointer,
"", block);
97 argAsVoidPointer = ConstantPointerNull::get(voidPointer);
103 return workerFunction;
111 PointerType *voidPointer = PointerType::get(IntegerType::get(module->getContext(), 8), 0);
113 vector<Type *> workerFunctionParams;
114 workerFunctionParams.push_back(voidPointer);
115 FunctionType *workerFunctionType = FunctionType::get(Type::getVoidTy(module->getContext()),
116 workerFunctionParams,
119 Function *workerFunction = module->getFunction(functionName);
120 if (! workerFunction) {
121 workerFunction = Function::Create(workerFunctionType,
122 isExternal ? GlobalValue::ExternalLinkage : GlobalValue::InternalLinkage,
127 return workerFunction;
136 ConstantInt *timeoutDeltaValue = ConstantInt::get(module->getContext(), APInt(64, 0));
185 Value *contextValue = workerFunction->arg_begin();
197 Value *contextValue = workerFunction->arg_begin();
198 Type *voidPointerType = contextValue->getType();
199 Type *voidPointerPointerType = PointerType::get(voidPointerType, 0);
202 Value *contextValueAsVoidPointerArray =
new BitCastInst(contextValue, voidPointerPointerType,
"", block);
204 return new BitCastInst(compositionStateAsVoidPointer, compositionStatePointerType,
"", block);
216 Value *contextValue = workerFunction->arg_begin();
217 Type *voidPointerType = contextValue->getType();
218 Type *voidPointerPointerType = PointerType::get(voidPointerType, 0);
220 Value *contextValueAsVoidPointerArray =
new BitCastInst(contextValue, voidPointerPointerType,
"", block);
233 Value *contextValue = workerFunction->arg_begin();
234 Type *voidPointerType = contextValue->getType();
235 Type *voidPointerPointerType = PointerType::get(voidPointerType, 0);
238 Value *contextValueAsVoidPointerArray =
new BitCastInst(contextValue, voidPointerPointerType,
"", block);
240 PointerType *pointerToEventIdType = PointerType::get(eventIdType, 0);
241 Value *eventIdCopyValue =
new BitCastInst(eventIdCopyAsVoidPointer, pointerToEventIdType,
"", block);
242 return new LoadInst(eventIdCopyValue,
"", block);
252 Value *currentDataValue = NULL;
261 Value *currentDataVoidPointer =
generateDataValue(module, block, workerFunction);
263 currentDataValue =
new LoadInst(currentDataPointer,
"", block);
271 return currentDataValue;