diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2016-04-12 09:35:56 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2016-04-12 09:35:56 +0000 |
commit | d93d376ba9c9f2443f3bdd61e43e7b09b762ad24 (patch) | |
tree | 483e9beb248cea3f008785cf153b4987b5ae3fc5 /clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | 65f86cd8b09b15e6ba531309325750d1a3f4af7c (diff) | |
download | bcm5719-llvm-d93d376ba9c9f2443f3bdd61e43e7b09b762ad24.tar.gz bcm5719-llvm-d93d376ba9c9f2443f3bdd61e43e7b09b762ad24.zip |
[OPENMP 4.0] Support for 'aligned' clause in 'declare simd' directive.
The aligned clause declares that the object to which each list item points is aligned to the number of bytes expressed in the optional parameter of the aligned clause.
'aligned' '(' <argument-list> [ ':' <alignment> ] ')'
The optional parameter of the aligned clause, alignment, must be a constant positive integer expression. If no optional parameter is specified, implementation-defined default alignments for SIMD instructions on the target platforms are assumed.
The special this pointer can be used as if was one of the arguments to the function in any of the linear, aligned, or uniform clauses.
llvm-svn: 266052
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index 168bf6f451d..3a320e11d14 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -247,7 +247,7 @@ static void instantiateOMPDeclareSimdDeclAttr( New = FTD->getTemplatedDecl(); auto *FD = cast<FunctionDecl>(New); auto *ThisContext = dyn_cast_or_null<CXXRecordDecl>(FD->getDeclContext()); - SmallVector<Expr *, 4> Uniforms; + SmallVector<Expr *, 4> Uniforms, Aligneds, Alignments; auto &&Subst = [&](Expr *E) -> ExprResult { if (auto *DRE = dyn_cast<DeclRefExpr>(E->IgnoreParenImpCasts())) @@ -273,9 +273,21 @@ static void instantiateOMPDeclareSimdDeclAttr( } } - (void)S.ActOnOpenMPDeclareSimdDirective(S.ConvertDeclToDeclGroup(New), - Attr.getBranchState(), Simdlen.get(), - Uniforms, Attr.getRange()); + auto AI = Attr.alignments_begin(); + for (auto *E : Attr.aligneds()) { + ExprResult Inst = Subst(E); + if (Inst.isInvalid()) + continue; + Aligneds.push_back(Inst.get()); + Inst = ExprEmpty(); + if (*AI) + Inst = S.SubstExpr(*AI, TemplateArgs); + Alignments.push_back(Inst.get()); + ++AI; + } + (void)S.ActOnOpenMPDeclareSimdDirective( + S.ConvertDeclToDeclGroup(New), Attr.getBranchState(), Simdlen.get(), + Uniforms, Aligneds, Alignments, Attr.getRange()); } void Sema::InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs, |