summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2016-04-12 11:02:11 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2016-04-12 11:02:11 +0000
commitecba70f194b556ca03df28bfc943878611f12e7a (patch)
treee3cc5ced73eb7acd5a5b6824d3594e7a5c1095bc /clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
parent703c864fe3a15c5d35c5f09b78a152f9809b833e (diff)
downloadbcm5719-llvm-ecba70f194b556ca03df28bfc943878611f12e7a.tar.gz
bcm5719-llvm-ecba70f194b556ca03df28bfc943878611f12e7a.zip
[OPENMP 4.0] Support for 'linear' clause in 'declare simd' directive.
The linear clause declares one or more list items to be private to a SIMD lane and to have a linear relationship with respect to the iteration space of a loop. 'linear' '(' <linear-list> [ ':' <linear-step> ] ')' When a linear-step expression is specified in a linear clause it must be either a constant integer expression or an integer-typed parameter that is specified in a uniform clause on the directive. 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: 266056
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaTemplateInstantiateDecl.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 3a320e11d14..307d804a4ca 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -239,15 +239,13 @@ instantiateDependentModeAttr(Sema &S,
static void instantiateOMPDeclareSimdDeclAttr(
Sema &S, const MultiLevelTemplateArgumentList &TemplateArgs,
const OMPDeclareSimdDeclAttr &Attr, Decl *New) {
- ExprResult Simdlen;
- if (auto *E = Attr.getSimdlen())
- Simdlen = S.SubstExpr(E, TemplateArgs);
// Allow 'this' in clauses with varlists.
if (auto *FTD = dyn_cast<FunctionTemplateDecl>(New))
New = FTD->getTemplatedDecl();
auto *FD = cast<FunctionDecl>(New);
auto *ThisContext = dyn_cast_or_null<CXXRecordDecl>(FD->getDeclContext());
- SmallVector<Expr *, 4> Uniforms, Aligneds, Alignments;
+ SmallVector<Expr *, 4> Uniforms, Aligneds, Alignments, Linears, Steps;
+ SmallVector<unsigned, 4> LinModifiers;
auto &&Subst = [&](Expr *E) -> ExprResult {
if (auto *DRE = dyn_cast<DeclRefExpr>(E->IgnoreParenImpCasts()))
@@ -264,6 +262,10 @@ static void instantiateOMPDeclareSimdDeclAttr(
return S.SubstExpr(E, TemplateArgs);
};
+ ExprResult Simdlen;
+ if (auto *E = Attr.getSimdlen())
+ Simdlen = Subst(E);
+
if (Attr.uniforms_size() > 0) {
for(auto *E : Attr.uniforms()) {
ExprResult Inst = Subst(E);
@@ -285,9 +287,24 @@ static void instantiateOMPDeclareSimdDeclAttr(
Alignments.push_back(Inst.get());
++AI;
}
+
+ auto SI = Attr.steps_begin();
+ for (auto *E : Attr.linears()) {
+ ExprResult Inst = Subst(E);
+ if (Inst.isInvalid())
+ continue;
+ Linears.push_back(Inst.get());
+ Inst = ExprEmpty();
+ if (*SI)
+ Inst = S.SubstExpr(*SI, TemplateArgs);
+ Steps.push_back(Inst.get());
+ ++SI;
+ }
+ LinModifiers.append(Attr.modifiers_begin(), Attr.modifiers_end());
(void)S.ActOnOpenMPDeclareSimdDirective(
S.ConvertDeclToDeclGroup(New), Attr.getBranchState(), Simdlen.get(),
- Uniforms, Aligneds, Alignments, Attr.getRange());
+ Uniforms, Aligneds, Alignments, Linears, LinModifiers, Steps,
+ Attr.getRange());
}
void Sema::InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs,
OpenPOWER on IntegriCloud