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