summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2016-05-10 12:21:02 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2016-05-10 12:21:02 +0000
commit1e1e286a6b376d23114923c53cc462601d198c6f (patch)
treea95e99526fbef5abd4c72224e39e164a045f6b4b /clang/lib
parent2640454d1ccdaf5ad788ffb0ee9f359fcaa84e74 (diff)
downloadbcm5719-llvm-1e1e286a6b376d23114923c53cc462601d198c6f.tar.gz
bcm5719-llvm-1e1e286a6b376d23114923c53cc462601d198c6f.zip
[OPENMP 4.5] Initial codegen for 'priority' clause in task-based
directives. OpenMP 4.5 supports clause 'priority' in task-based directives. Patch adds initial codegen support for this clause in codegen. llvm-svn: 269050
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGOpenMPRuntime.cpp9
-rw-r--r--clang/lib/CodeGen/CGOpenMPRuntime.h2
-rw-r--r--clang/lib/CodeGen/CGStmtOpenMP.cpp7
3 files changed, 16 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index fac8a674c2c..d0b1de81006 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -3674,7 +3674,12 @@ CGOpenMPRuntime::emitTaskInit(CodeGenFunction &CGF, SourceLocation Loc,
// Task flags. Format is taken from
// http://llvm.org/svn/llvm-project/openmp/trunk/runtime/src/kmp.h,
// description of kmp_tasking_flags struct.
- enum { TiedFlag = 0x1, FinalFlag = 0x2, DestructorsFlag = 0x8 };
+ enum {
+ TiedFlag = 0x1,
+ FinalFlag = 0x2,
+ DestructorsFlag = 0x8,
+ PriorityFlag = 0x20
+ };
unsigned Flags = Data.Tied ? TiedFlag : 0;
bool NeedsCleanup = false;
if (!Privates.empty()) {
@@ -3682,6 +3687,8 @@ CGOpenMPRuntime::emitTaskInit(CodeGenFunction &CGF, SourceLocation Loc,
if (NeedsCleanup)
Flags = Flags | DestructorsFlag;
}
+ if (Data.Priority.getInt())
+ Flags = Flags | PriorityFlag;
auto *TaskFlags =
Data.Final.getPointer()
? CGF.Builder.CreateSelect(Data.Final.getPointer(),
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.h b/clang/lib/CodeGen/CGOpenMPRuntime.h
index 773838dbb6a..63616f13f80 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.h
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.h
@@ -98,10 +98,10 @@ struct OMPTaskDataTy final {
SmallVector<std::pair<OpenMPDependClauseKind, const Expr *>, 4> Dependences;
llvm::PointerIntPair<llvm::Value *, 1, bool> Final;
llvm::PointerIntPair<llvm::Value *, 1, bool> Schedule;
+ llvm::PointerIntPair<llvm::Value *, 1, bool> Priority;
unsigned NumberOfParts = 0;
bool Tied = true;
bool Nogroup = false;
- llvm::PointerIntPair<llvm::Value *, 1, bool> Priority;
};
class CGOpenMPRuntime {
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index 322e8ff593f..5cf0cae161b 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -2337,6 +2337,13 @@ void CodeGenFunction::EmitOMPTaskBasedDirective(const OMPExecutableDirective &S,
// By default the task is not final.
Data.Final.setInt(/*IntVal=*/false);
}
+ // Check if the task has 'priority' clause.
+ if (const auto *Clause = S.getSingleClause<OMPPriorityClause>()) {
+ // Runtime currently does not support codegen for priority clause argument.
+ // TODO: Add codegen for priority clause arg when runtime lib support it.
+ auto *Prio = Clause->getPriority();
+ Data.Priority.setInt(Prio);
+ }
// The first function argument for tasks is a thread id, the second one is a
// part id (0 for tied tasks, >=0 for untied task).
llvm::DenseSet<const VarDecl *> EmittedAsPrivate;
OpenPOWER on IntegriCloud