From ae233204174a9d3c41060087ac4e54af10a4b174 Mon Sep 17 00:00:00 2001 From: Evghenii Date: Mon, 28 Oct 2013 12:10:40 +0100 Subject: [PATCH] added metadata for tasks with nvptx64 target. not tasks are kernel callable from host --- func.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/func.cpp b/func.cpp index b0bbc70f..609e2554 100644 --- a/func.cpp +++ b/func.cpp @@ -47,6 +47,7 @@ #include #if defined(LLVM_3_1) || defined(LLVM_3_2) + #include #include #include #include @@ -54,6 +55,7 @@ #include #include #else + #include #include #include #include @@ -316,6 +318,16 @@ Function::emitCode(FunctionEmitContext *ctx, llvm::Function *function, taskCountSym2->storagePtr = ctx->AllocaInst(LLVMTypes::Int32Type, "taskCount2"); ctx->StoreInst(taskCount2, taskCountSym2->storagePtr); } + else + { + llvm::NamedMDNode* annotations = + m->module->getOrInsertNamedMetadata("nvvm.annotations"); + llvm::SmallVector av; + av.push_back(function); + av.push_back(llvm::MDString::get(*g->ctx, "kernel")); + av.push_back(llvm::ConstantInt::get(llvm::IntegerType::get(*g->ctx,32), 1)); + annotations->addOperand(llvm::MDNode::get(*g->ctx, av)); + } } else { // Regular, non-task function