r219195 - [OPENMP] Small refactoring of EmitOMPSimdLoop helper routine.

Alexander Musman alexander.musman at gmail.com
Tue Oct 7 01:57:09 PDT 2014


Author: amusman
Date: Tue Oct  7 03:57:09 2014
New Revision: 219195

URL: http://llvm.org/viewvc/llvm-project?rev=219195&view=rev
Log:
[OPENMP] Small refactoring of EmitOMPSimdLoop helper routine.
No functional changes intended.
Renamed EmitOMPSimdLoop to EmitOMPInnerLoop, I plan to re-use
it to emit inner loop in the future patches for CodeGen of the
worksharing loop directives (omp for, omp for simd).

Modified:
    cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
    cfe/trunk/lib/CodeGen/CodeGenFunction.h

Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=219195&r1=219194&r2=219195&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Tue Oct  7 03:57:09 2014
@@ -49,7 +49,7 @@ void CodeGenFunction::EmitOMPParallelDir
   EmitRuntimeCall(RTLFn, Args);
 }
 
-void CodeGenFunction::EmitOMPSimdBody(const OMPLoopDirective &S,
+void CodeGenFunction::EmitOMPLoopBody(const OMPLoopDirective &S,
                                       bool SeparateIter) {
   RunCleanupsScope BodyScope(*this);
   // Update counters values on current iteration.
@@ -57,7 +57,7 @@ void CodeGenFunction::EmitOMPSimdBody(co
     EmitIgnoredExpr(I);
   }
   // On a continue in the body, jump to the end.
-  auto Continue = getJumpDestInCurrentScope("simd.continue");
+  auto Continue = getJumpDestInCurrentScope("omp.body.continue");
   BreakContinueStack.push_back(BreakContinue(JumpDest(), Continue));
   // Emit loop body.
   EmitStmt(S.getBody());
@@ -72,14 +72,14 @@ void CodeGenFunction::EmitOMPSimdBody(co
   }
 }
 
-void CodeGenFunction::EmitOMPSimdLoop(const OMPLoopDirective &S,
-                                      OMPPrivateScope &LoopScope,
-                                      bool SeparateIter) {
-  auto LoopExit = getJumpDestInCurrentScope("simd.for.end");
+void CodeGenFunction::EmitOMPInnerLoop(const OMPLoopDirective &S,
+                                       OMPPrivateScope &LoopScope,
+                                       bool SeparateIter) {
+  auto LoopExit = getJumpDestInCurrentScope("omp.inner.for.end");
   auto Cnt = getPGORegionCounter(&S);
 
   // Start the loop with a block that tests the condition.
-  auto CondBlock = createBasicBlock("simd.for.cond");
+  auto CondBlock = createBasicBlock("omp.inner.for.cond");
   EmitBlock(CondBlock);
   LoopStack.push(CondBlock);
 
@@ -87,9 +87,9 @@ void CodeGenFunction::EmitOMPSimdLoop(co
   // create a block to stage a loop exit along.
   auto ExitBlock = LoopExit.getBlock();
   if (LoopScope.requiresCleanups())
-    ExitBlock = createBasicBlock("simd.for.cond.cleanup");
+    ExitBlock = createBasicBlock("omp.inner.for.cond.cleanup");
 
-  auto LoopBody = createBasicBlock("simd.for.body");
+  auto LoopBody = createBasicBlock("omp.inner.for.body");
 
   // Emit condition: "IV < LastIteration + 1 [ - 1]"
   // ("- 1" when lastprivate clause is present - separate one iteration).
@@ -106,10 +106,10 @@ void CodeGenFunction::EmitOMPSimdLoop(co
   Cnt.beginRegion(Builder);
 
   // Create a block for the increment.
-  auto Continue = getJumpDestInCurrentScope("simd.for.inc");
+  auto Continue = getJumpDestInCurrentScope("omp.inner.for.inc");
   BreakContinueStack.push_back(BreakContinue(LoopExit, Continue));
 
-  EmitOMPSimdBody(S, /* SeparateIter */ false);
+  EmitOMPLoopBody(S);
   EmitStopPoint(&S);
 
   // Emit "IV = IV + 1" and a back-edge to the condition block.
@@ -236,8 +236,8 @@ void CodeGenFunction::EmitOMPSimdDirecti
     {
       OMPPrivateScope LoopScope(*this);
       LoopScope.addPrivates(S.counters());
-      EmitOMPSimdLoop(S, LoopScope, /* SeparateIter */ true);
-      EmitOMPSimdBody(S, /* SeparateIter */ true);
+      EmitOMPInnerLoop(S, LoopScope, /* SeparateIter */ true);
+      EmitOMPLoopBody(S, /* SeparateIter */ true);
     }
     EmitOMPSimdFinal(S);
     // Emit: if (LastIteration != 0) - end.
@@ -247,7 +247,7 @@ void CodeGenFunction::EmitOMPSimdDirecti
     {
       OMPPrivateScope LoopScope(*this);
       LoopScope.addPrivates(S.counters());
-      EmitOMPSimdLoop(S, LoopScope, /* SeparateIter */ false);
+      EmitOMPInnerLoop(S, LoopScope);
     }
     EmitOMPSimdFinal(S);
   }

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=219195&r1=219194&r2=219195&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Tue Oct  7 03:57:09 2014
@@ -2016,9 +2016,10 @@ public:
   void EmitOMPTargetDirective(const OMPTargetDirective &S);
 
   /// Helpers for 'omp simd' directive.
-  void EmitOMPSimdBody(const OMPLoopDirective &Directive, bool SeparateIter);
-  void EmitOMPSimdLoop(const OMPLoopDirective &S, OMPPrivateScope &LoopScope,
-                       bool SeparateIter);
+  void EmitOMPLoopBody(const OMPLoopDirective &Directive,
+                       bool SeparateIter = false);
+  void EmitOMPInnerLoop(const OMPLoopDirective &S, OMPPrivateScope &LoopScope,
+                        bool SeparateIter = false);
   void EmitOMPSimdFinal(const OMPLoopDirective &S);
 
   //===--------------------------------------------------------------------===//





More information about the cfe-commits mailing list