Skip to content

Commit cb84983

Browse files
committed
Add documentation to OmpPragma.*
1 parent 1fcbff4 commit cb84983

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

clang/tools/sotoc/src/OmpPragma.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
//===-- sotoc/src/TargetCode ------------------------ ---------------------===//
2+
//
3+
// The LLVM Compiler Infrastructure
4+
//
5+
// This file is distributed under the University of Illinois Open Source
6+
// License. See LICENSE.TXT for details.
7+
//
8+
//===----------------------------------------------------------------------===//
9+
///
10+
/// \file
11+
/// This file implements the class OmpPragma, which is used to generate repla-
12+
/// cement pragmas for teams and team combined constructs.
13+
///
14+
//===----------------------------------------------------------------------===//
15+
116
#include "clang/AST/PrettyPrinter.h"
217

318
#include "OmpPragma.h"

clang/tools/sotoc/src/OmpPragma.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,20 @@
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.
1933
class 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

3451
private:

0 commit comments

Comments
 (0)