1616
1717#include " TargetCodeFragment.h"
1818
19+ // / A helper class to rewrite some "pragma omp" (mostly teams and similar
20+ // / combined constructs), which are not supported by sotoc.
21+ // / We currently only support one team to be run on the target because ncc does
22+ // / not support 'freestanding' teams. So we need to remove teams and
23+ // / distribute constructs from the generated target code. But teams constructs
24+ // / can also appear in combined constructs. These combined constructs cannot
25+ // / simply be removed, they must be replace by "non-team" equivalents to
26+ // / preserve correctness.
27+ // / This class provides helper functions that finds a suitable replacement for
28+ // / omp pragmas that contain teams constructs.
29+ // / It is used during code generation: The omp pragma of each target region
30+ // / that is declared as part of a combined construct and each pragma found
31+ // / during pretty printing is encapsulated by an object of this class which is
32+ // / then used to generate a replacement.
1933class OmpPragma {
2034 clang::PrintingPolicy PP;
2135 llvm::ArrayRef<clang::OMPClause *> Clauses;
@@ -28,7 +42,10 @@ class OmpPragma {
2842 OmpPragma (clang::OMPExecutableDirective *Directive, clang::PrintingPolicy PP)
2943 : PP(PP), Clauses(Directive->clauses ()),
3044 Kind(Directive->getDirectiveKind ()){};
45+ // / Returns true if the omp pragma encapsulated, needs to be followed by a
46+ // / structured block (i.e. {...}).
3147 bool needsStructuredBlock ();
48+ // / Prints a replacement omp pragma for the encapsulated pragma onto \p Out.
3249 void printReplacement (llvm::raw_ostream &Out);
3350
3451private:
0 commit comments