diff options
author | Joey Gouly <joey.gouly@arm.com> | 2013-03-08 09:42:32 +0000 |
---|---|---|
committer | Joey Gouly <joey.gouly@arm.com> | 2013-03-08 09:42:32 +0000 |
commit | aba589ccebb1f4f873d9682bb8c96aab228b50f4 (patch) | |
tree | d68440bd7e8a2c8dee715f7f2e9c51c01b647074 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | 48f2a724355f922968c8f2137911749a68f53a5d (diff) | |
download | bcm5719-llvm-aba589ccebb1f4f873d9682bb8c96aab228b50f4.tar.gz bcm5719-llvm-aba589ccebb1f4f873d9682bb8c96aab228b50f4.zip |
Add support for the OpenCL attribute 'vec_type_hint'.
Patch by Murat Bolat!
llvm-svn: 176686
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 5e8bce974ba..bd4c98e35b1 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -323,6 +323,23 @@ void CodeGenFunction::EmitOpenCLKernelMetadata(const FunctionDecl *FD, if (CGM.getCodeGenOpts().EmitOpenCLArgMetadata) GenOpenCLArgMetadata(FD, Fn, CGM, Context, kernelMDArgs); + if (FD->hasAttr<VecTypeHintAttr>()) { + VecTypeHintAttr *attr = FD->getAttr<VecTypeHintAttr>(); + QualType hintQTy = attr->getTypeHint(); + const ExtVectorType *hintEltQTy = hintQTy->getAs<ExtVectorType>(); + bool isSignedInteger = + hintQTy->isSignedIntegerType() || + (hintEltQTy && hintEltQTy->getElementType()->isSignedIntegerType()); + llvm::Value *attrMDArgs[] = { + llvm::MDString::get(Context, "vec_type_hint"), + llvm::UndefValue::get(CGM.getTypes().ConvertType(attr->getTypeHint())), + llvm::ConstantInt::get( + llvm::IntegerType::get(Context, 32), + llvm::APInt(32, (uint64_t)(isSignedInteger ? 1 : 0))) + }; + kernelMDArgs.push_back(llvm::MDNode::get(Context, attrMDArgs)); + } + if (FD->hasAttr<WorkGroupSizeHintAttr>()) { WorkGroupSizeHintAttr *attr = FD->getAttr<WorkGroupSizeHintAttr>(); llvm::Value *attrMDArgs[] = { |