Allows generation of combined 'parallel for' directive that represents 'parallel' region with internal implicit 'for' worksharing region.
A new combined region RAII is added to the runtime support module, intended to be used for all combined directives, like 'parallel sections', 'parallel for simd' etc.
This RAII region allows to split codegen for combined directives into several independent steps: at first it tries to generate the code for the outher implicit OpenMP region, then for internal. For example, for 'parallel for' directive on first iteration it generates an outlined function for parallel region, and then generates internal loop using information from the outer region. This region stores a kind of implicit directive for which it currently emits code and then advances to the next implicit directive. This allows to reuse the codegen emission method for combined directive for all implicitly included directives just like this:
if (<CurrentImplicitRegion> == OMPD_parallel) <Generate code for 'parallel' region> else if (<CurrentImplicitRegion> == OMPD_for> <Generate code for 'for' region> ...
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.