aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2016-03-04 09:22:22 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2016-03-04 09:22:22 +0000
commitc5b1d320b856559db375e8effc2fe9b04bfaf6ee (patch)
tree46c64c995cf2180a8a7c9ff2d54e6c18ccc9b72f /clang/lib/CodeGen/CGDecl.cpp
parent678f65a9b4d808fe2f476c43d5acc884927c0377 (diff)
downloadllvm-c5b1d320b856559db375e8effc2fe9b04bfaf6ee.zip
llvm-c5b1d320b856559db375e8effc2fe9b04bfaf6ee.tar.gz
llvm-c5b1d320b856559db375e8effc2fe9b04bfaf6ee.tar.bz2
[OPENMP 4.0] Codegen for 'declare reduction' construct.
Emit function for 'combiner' part of 'declare reduction' construct and 'initialilzer' part, if any. llvm-svn: 262699
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index 36d20cc..e0c2975 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -16,6 +16,7 @@
#include "CGCleanup.h"
#include "CGDebugInfo.h"
#include "CGOpenCLRuntime.h"
+#include "CGOpenMPRuntime.h"
#include "CodeGenModule.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/CharUnits.h"
@@ -120,7 +121,7 @@ void CodeGenFunction::EmitDecl(const Decl &D) {
}
case Decl::OMPDeclareReduction:
- return CGM.EmitOMPDeclareReduction(cast<OMPDeclareReductionDecl>(&D));
+ return CGM.EmitOMPDeclareReduction(cast<OMPDeclareReductionDecl>(&D), this);
case Decl::Typedef: // typedef int X;
case Decl::TypeAlias: { // using X = int; [C++0x]
@@ -1867,6 +1868,10 @@ void CodeGenFunction::EmitParmDecl(const VarDecl &D, ParamValue Arg,
EmitVarAnnotations(&D, DeclPtr.getPointer());
}
-void CodeGenModule::EmitOMPDeclareReduction(
- const OMPDeclareReductionDecl * /*D*/) {}
+void CodeGenModule::EmitOMPDeclareReduction(const OMPDeclareReductionDecl *D,
+ CodeGenFunction *CGF) {
+ if (!LangOpts.OpenMP || (!LangOpts.EmitAllDecls && !D->isUsed()))
+ return;
+ getOpenMPRuntime().emitUserDefinedReduction(CGF, D);
+}