added mask for tasking function

This commit is contained in:
Evghenii
2014-01-06 16:18:28 +01:00
parent 7fbe2eba59
commit 3972d740a6
4 changed files with 15 additions and 9 deletions

15
ctx.cpp
View File

@@ -3617,8 +3617,12 @@ FunctionEmitContext::LaunchInst(llvm::Value *callee,
AssertPos(currentPos, llvm::isa<llvm::Function>(callee));
std::vector<llvm::Type*> argTypes;
for (unsigned int i = 0; i < argVals.size(); i++)
argTypes.push_back(argVals[i]->getType());
llvm::Function *F = llvm::dyn_cast<llvm::Function>(callee);
const unsigned int nArgs = F->arg_size();
llvm::Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end();
for (; I != E; ++I)
argTypes.push_back(I->getType());
llvm::Type *st = llvm::StructType::get(*g->ctx, argTypes);
llvm::StructType *argStructType = static_cast<llvm::StructType *>(st);
llvm::Value *structSize = g->target->SizeOf(argStructType, bblock);
@@ -3661,6 +3665,13 @@ FunctionEmitContext::LaunchInst(llvm::Value *callee,
// don't need to do masked store here, I think
StoreInst(argVals[i], ptr);
}
if (nArgs == argVals.size() + 1) {
// copy in the mask
llvm::Value *mask = GetFullMask();
llvm::Value *ptr = AddElementOffset(argmem, argVals.size(), NULL,
"funarg_mask");
StoreInst(mask, ptr);
}
BranchInst(if_false);
/**********************/