Add support for the OpenCL attribute 'vec_type_hint'.
Patch by Murat Bolat! llvm-svn: 176686
This commit is contained in:
@@ -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[] = {
|
||||
|
||||
Reference in New Issue
Block a user