diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2011-02-14 01:42:53 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2011-02-14 01:42:53 +0000 |
commit | 7ce13fc940deb8324278cbc7dd76d33235149492 (patch) | |
tree | 249238b36c442b727f1e0e73c5d0d5f7f475b655 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | 564c0fa47a4cb4edfd4c56a24e83cc5b807405d3 (diff) | |
download | bcm5719-llvm-7ce13fc940deb8324278cbc7dd76d33235149492.tar.gz bcm5719-llvm-7ce13fc940deb8324278cbc7dd76d33235149492.zip |
OpenCL: add support for __kernel, kernel keywords and EXTENSION,
FP_CONTRACT pragmas. Patch originally by ARM.
llvm-svn: 125475
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 38ca0214da3..39aff78c73c 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -239,6 +239,19 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, break; } + if (getContext().getLangOptions().OpenCL) { + // Add metadata for a kernel function. + if (const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(D)) + if (FD->hasAttr<OpenCLKernelAttr>()) { + llvm::LLVMContext &Context = getLLVMContext(); + llvm::NamedMDNode *OpenCLMetadata = + CGM.getModule().getOrInsertNamedMetadata("opencl.kernels"); + + llvm::Value *Op = Fn; + OpenCLMetadata->addOperand(llvm::MDNode::get(Context, &Op, 1)); + } + } + llvm::BasicBlock *EntryBB = createBasicBlock("entry", CurFn); // Create a marker to make it easy to insert allocas into the entryblock |