16
16
17
17
#include " TargetCodeFragment.h"
18
18
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.
19
33
class OmpPragma {
20
34
clang::PrintingPolicy PP;
21
35
llvm::ArrayRef<clang::OMPClause *> Clauses;
@@ -28,7 +42,10 @@ class OmpPragma {
28
42
OmpPragma (clang::OMPExecutableDirective *Directive, clang::PrintingPolicy PP)
29
43
: PP(PP), Clauses(Directive->clauses ()),
30
44
Kind(Directive->getDirectiveKind ()){};
45
+ // / Returns true if the omp pragma encapsulated, needs to be followed by a
46
+ // / structured block (i.e. {...}).
31
47
bool needsStructuredBlock ();
48
+ // / Prints a replacement omp pragma for the encapsulated pragma onto \p Out.
32
49
void printReplacement (llvm::raw_ostream &Out);
33
50
34
51
private:
0 commit comments