ABataev added inline comments.
================
Comment at: lib/CodeGen/CGOpenMPRuntime.h:543
virtual llvm::Value *emitParallelOrTeamsOutlinedFunction(
- const OMPExecutableDirective &D, const VarDecl *ThreadIDVar,
- OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen);
+ const OMPExecutableDirective &D, const CapturedStmt *CS,
+ const VarDecl *ThreadIDVar, OpenMPDirectiveKind InnermostKind,
----------------
arpith-jacob wrote:
> ABataev wrote:
> > I don't think you need to pass a new `CS` parameter here, you can use
> > `InnermostKind` param as an arg to `getCapturedStmt()` function
> Hi Alexey, this is tricky.
>
> emitParallelOrTeamsOutlinedFunction() is called from
> emitCommonOMPParallelDirective(...InnermostKind...). Here is how that
> function is called for 'parallel for'.
>
>
> ```
> void CodeGenFunction::EmitOMPParallelForDirective(
> const OMPParallelForDirective &S) {
> ...
> emitCommonOMPParallelDirective(*this, S, /*InnermostKind=*/OMPD_for,
> CodeGen);
> }
>
> ```
> You'll notice that InnermostKind is OMPD_for. OMPD_for does not have a
> CapturedStmt, only the OMPD_parallel part. So we cannot use the
> InnermostKind variable.
>
> Here is an alternative solution:
>
> I will split emitParallelOrTeamsOutlinedFunction() to
> emitParallelOutlinedFunction() and emitTeamsOutlinedFunction(). I can then
> use getCapturedStmt(OMPD_parallel) and getCapturedStmt(OMPD_teams)
> respectively and I don't have to pass the CS parameter.
>
> I also think this makes sense because apart from the host, teams and parallel
> codegen are very different and so they should be in different routines.
>
> Let me know if you disagree.
Arpith, I'm ok with your idea
https://reviews.llvm.org/D28753
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits