diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-03-10 04:40:21 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-03-10 04:40:21 +0000 |
commit | eb26ddf559cf9ce2e198f7d9ea1241f2bbb6cf32 (patch) | |
tree | b777b2c79f6bf375b129cb0be69aba0bb2f574c8 /clang/lib/CodeGen/CGStmtOpenMP.cpp | |
parent | c63a98a662c257d5bf0ceb52003065658977ded5 (diff) | |
download | bcm5719-llvm-eb26ddf559cf9ce2e198f7d9ea1241f2bbb6cf32.tar.gz bcm5719-llvm-eb26ddf559cf9ce2e198f7d9ea1241f2bbb6cf32.zip |
Revert "[OPENMP] Improved code for generating debug info + generation of all OpenMP regions in termination scope Patch adds proper generation of debug info for all OpenMP regions. Also, all OpenMP regions are generated in a termination scope, because standard does not allow to throw exceptions out of structured blocks, associated with the OpenMP regions Differential Revision: http://reviews.llvm.org/D7935"
This reverts commit r231752.
It was failing to link with cmake:
lib64/libclangCodeGen.a(CGOpenMPRuntime.cpp.o):/home/espindola/llvm/llvm/tools/clang/lib/CodeGen/CGOpenMPRuntime.cpp:function clang::CodeGen::InlinedOpenMPRegionRAII::~InlinedOpenMPRegionRAII(): error: undefined reference to 'clang::CodeGen::EHScopeStack::popTerminate()'
clang-3.7: error: linker command failed with exit code 1 (use -v to see invocation)
llvm-svn: 231754
Diffstat (limited to 'clang/lib/CodeGen/CGStmtOpenMP.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGStmtOpenMP.cpp | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp index 245fed01e52..c83dfa17064 100644 --- a/clang/lib/CodeGen/CGStmtOpenMP.cpp +++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -23,20 +23,6 @@ using namespace CodeGen; //===----------------------------------------------------------------------===// // OpenMP Directive Emission //===----------------------------------------------------------------------===// -namespace { -/// \brief RAII for inlined OpenMP regions (like 'omp for', 'omp simd', 'omp -/// critical' etc.). Helps to generate proper debug info and provides correct -/// code generation for such constructs. -class InlinedOpenMPRegionScopeRAII { - InlinedOpenMPRegionRAII Region; - CodeGenFunction::LexicalScope DirectiveScope; - -public: - InlinedOpenMPRegionScopeRAII(CodeGenFunction &CGF, - const OMPExecutableDirective &D) - : Region(CGF, D), DirectiveScope(CGF, D.getSourceRange()) {} -}; -} // namespace /// \brief Emits code for OpenMP 'if' clause using specified \a CodeGen /// function. Here is the logic: @@ -431,7 +417,12 @@ void CodeGenFunction::EmitOMPSimdDirective(const OMPSimdDirective &S) { } } - InlinedOpenMPRegionScopeRAII Region(*this, S); + InlinedOpenMPRegionRAII Region(*this, S); + RunCleanupsScope DirectiveScope(*this); + + CGDebugInfo *DI = getDebugInfo(); + if (DI) + DI->EmitLexicalBlockStart(Builder, S.getSourceRange().getBegin()); // Emit the loop iteration variable. const Expr *IVExpr = S.getIterationVariable(); @@ -475,6 +466,9 @@ void CodeGenFunction::EmitOMPSimdDirective(const OMPSimdDirective &S) { } EmitOMPSimdFinal(S); } + + if (DI) + DI->EmitLexicalBlockEnd(Builder, S.getSourceRange().getEnd()); } void CodeGenFunction::EmitOMPForOuterLoop(OpenMPScheduleClauseKind ScheduleKind, @@ -656,13 +650,20 @@ void CodeGenFunction::EmitOMPWorksharingLoop(const OMPLoopDirective &S) { } void CodeGenFunction::EmitOMPForDirective(const OMPForDirective &S) { - InlinedOpenMPRegionScopeRAII Region(*this, S); + InlinedOpenMPRegionRAII Region(*this, S); + RunCleanupsScope DirectiveScope(*this); + + CGDebugInfo *DI = getDebugInfo(); + if (DI) + DI->EmitLexicalBlockStart(Builder, S.getSourceRange().getBegin()); EmitOMPWorksharingLoop(S); // Emit an implicit barrier at the end. CGM.getOpenMPRuntime().emitBarrierCall(*this, S.getLocStart(), /*IsExplicit*/ false); + if (DI) + DI->EmitLexicalBlockEnd(Builder, S.getSourceRange().getEnd()); } void CodeGenFunction::EmitOMPForSimdDirective(const OMPForSimdDirective &) { @@ -679,7 +680,8 @@ void CodeGenFunction::EmitOMPSectionDirective(const OMPSectionDirective &) { void CodeGenFunction::EmitOMPSingleDirective(const OMPSingleDirective &S) { CGM.getOpenMPRuntime().emitSingleRegion(*this, [&]() -> void { - InlinedOpenMPRegionScopeRAII Region(*this, S); + InlinedOpenMPRegionRAII Region(*this, S); + RunCleanupsScope Scope(*this); EmitStmt(cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt()); EnsureInsertPoint(); }, S.getLocStart()); @@ -687,7 +689,8 @@ void CodeGenFunction::EmitOMPSingleDirective(const OMPSingleDirective &S) { void CodeGenFunction::EmitOMPMasterDirective(const OMPMasterDirective &S) { CGM.getOpenMPRuntime().emitMasterRegion(*this, [&]() -> void { - InlinedOpenMPRegionScopeRAII Region(*this, S); + InlinedOpenMPRegionRAII Region(*this, S); + RunCleanupsScope Scope(*this); EmitStmt(cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt()); EnsureInsertPoint(); }, S.getLocStart()); @@ -696,7 +699,8 @@ void CodeGenFunction::EmitOMPMasterDirective(const OMPMasterDirective &S) { void CodeGenFunction::EmitOMPCriticalDirective(const OMPCriticalDirective &S) { CGM.getOpenMPRuntime().emitCriticalRegion( *this, S.getDirectiveName().getAsString(), [&]() -> void { - InlinedOpenMPRegionScopeRAII Region(*this, S); + InlinedOpenMPRegionRAII Region(*this, S); + RunCleanupsScope Scope(*this); EmitStmt(cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt()); EnsureInsertPoint(); }, S.getLocStart()); @@ -894,7 +898,6 @@ void CodeGenFunction::EmitOMPAtomicDirective(const OMPAtomicDirective &S) { break; } } - InlinedOpenMPRegionScopeRAII Region(*this, S); EmitOMPAtomicExpr(*this, Kind, IsSeqCst, S.getX(), S.getV(), S.getExpr(), S.getLocStart()); } |