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;
62 ConstantInt *oneValue = ConstantInt::get(module->getContext(), APInt(64, 1));
64 new StoreInst(dataValue, dataCopyAddress,
false, block);
65 dataCopyAsVoidPointer =
new BitCastInst(dataCopyAddress, voidPointer,
"", block);
69 dataCopyAsVoidPointer = ConstantPointerNull::get(voidPointer);
76 new StoreInst(eventIdValue, eventIdCopyAddress,
false, block);
79 dataCopyAsVoidPointer, eventIdCopyAddress);
84 minThreadsNeeded, maxThreadsNeeded,
85 eventIdValue, compositionStateValue, chainCount);
93 string workerFunctionName, Value *workerFunctionArg)
97 PointerType *voidPointer = PointerType::get(IntegerType::get(module->getContext(), 8), 0);
98 Value *argAsVoidPointer;
99 if (workerFunctionArg)
100 argAsVoidPointer =
new BitCastInst(workerFunctionArg, voidPointer,
"", block);
102 argAsVoidPointer = ConstantPointerNull::get(voidPointer);
108 return workerFunction;
116 PointerType *voidPointer = PointerType::get(IntegerType::get(module->getContext(), 8), 0);
118 vector<Type *> workerFunctionParams;
119 workerFunctionParams.push_back(voidPointer);
120 FunctionType *workerFunctionType = FunctionType::get(Type::getVoidTy(module->getContext()),
121 workerFunctionParams,
124 Function *workerFunction = module->getFunction(functionName);
125 if (! workerFunction) {
126 workerFunction = Function::Create(workerFunctionType,
127 isExternal ? GlobalValue::ExternalLinkage : GlobalValue::InternalLinkage,
132 return workerFunction;
141 ConstantInt *timeoutDeltaValue = ConstantInt::get(module->getContext(), APInt(64, 0));
190 Value *contextValue = workerFunction->arg_begin();
202 Value *contextValue = workerFunction->arg_begin();
203 Type *voidPointerType = contextValue->getType();
204 Type *voidPointerPointerType = PointerType::get(voidPointerType, 0);
207 Value *contextValueAsVoidPointerArray =
new BitCastInst(contextValue, voidPointerPointerType,
"", block);
209 return new BitCastInst(compositionStateAsVoidPointer, compositionStatePointerType,
"", block);
221 Value *contextValue = workerFunction->arg_begin();
222 Type *voidPointerType = contextValue->getType();
223 Type *voidPointerPointerType = PointerType::get(voidPointerType, 0);
225 Value *contextValueAsVoidPointerArray =
new BitCastInst(contextValue, voidPointerPointerType,
"", block);
227 PointerType *pointerToDataType = PointerType::get(
getDataType(), 0);
228 Value *dataCopyValue =
new BitCastInst(dataCopyAsVoidPointer, pointerToDataType,
"", block);
229 return new LoadInst(dataCopyValue,
"", block);
241 Value *contextValue = workerFunction->arg_begin();
242 Type *voidPointerType = contextValue->getType();
243 Type *voidPointerPointerType = PointerType::get(voidPointerType, 0);
246 Value *contextValueAsVoidPointerArray =
new BitCastInst(contextValue, voidPointerPointerType,
"", block);
248 PointerType *pointerToEventIdType = PointerType::get(eventIdType, 0);
249 Value *eventIdCopyValue =
new BitCastInst(eventIdCopyAsVoidPointer, pointerToEventIdType,
"", block);
250 return new LoadInst(eventIdCopyValue,
"", block);
260 Value *currentDataValue = NULL;
284 return currentDataValue;