[PATCH] [OPENMP] Initial codegen for 'parallel for' directive.

Alexey Bataev a.bataev at hotmail.com
Mon Mar 30 23:59:18 PDT 2015


================
Comment at: lib/CodeGen/CGOpenMPRuntime.h:51
@@ +50,3 @@
+  /// \brief Iterator range for  codegen kinds for combined directives.
+  class CombinedCodeGenKind {
+    combined_iterator begin_iterator, end_iterator;
----------------
ABataev wrote:
> rjmccall wrote:
> > This isn't really a Kind, and the name makes it really confusing.  It's not a "range" either in the usual C++ sense of a pair of iterators.  It's really a generator, although that name is also misleading in the broader context of IRGen.
> > 
> > I think this is probably just not the right abstraction.  Would it make more sense for the emission of the combining directives to take a lambda (probably as an llvm::FunctionRef) that fills in the outlined function body?  "parallel" would just pass a lambda that just emits the captured statement, while "parallel for" would pass a lambda that builds a "for" around the captured statement.  As it is, there is a lot of hard-to-follow recursion here.
> John, this solution would work for 'simple' combined constructs, like 'parallel for' or 'parallel sections'. But what with combined directives like 'target teams distribute parallel for simd'? Here we have two outlined functions (one for 'teams', one for 'parallel' regions) with several inlined regions ('target' in the outer scope, 'distribute' in first outlined function and 'for simd' in the second outlined region). It seems to me recursion is much better for such complex cases.
Or another option - to pass a set of lambdas responsible for codegen of each particular region (i.e. passing of codegen methods instead of list of directives)

http://reviews.llvm.org/D8631

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list