Skip to content

Commit cb30003

Browse files
committed
Merge branch 'aurora_offloading_prototype' of git.rwth-aachen.de:NEC-RWTH-Projects/clang into aurora_offloading_prototype
2 parents a709aa0 + 18b1e76 commit cb30003

File tree

5 files changed

+53
-3
lines changed

5 files changed

+53
-3
lines changed

clang/tools/nec-aurora-build/compiler.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ int runTargetCompiler(const std::string &InputPath, const std::string &Args) {
6868
int ret = system(CmdLine.str().c_str());
6969

7070
if (!KeepTransformedFilesDir) {
71-
std::cout << "Removing tmpfil" << std::endl;
7271
std::remove(InputPath.c_str());
7372
}
7473

clang/tools/sotoc/Doxyfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ WARN_LOGFILE =
733733
# spaces.
734734
# Note: If this tag is empty the current directory is searched.
735735

736-
INPUT = src
736+
INPUT = docs/main.md src
737737

738738
# This tag can be used to specify the character encoding of the source files
739739
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@@ -869,7 +869,7 @@ FILTER_SOURCE_PATTERNS =
869869
# (index.html). This can be useful if you have a project on for instance GitHub
870870
# and want to reuse the introduction page also for the doxygen output.
871871

872-
USE_MDFILE_AS_MAINPAGE =
872+
USE_MDFILE_AS_MAINPAGE = docs/main.md
873873

874874
#---------------------------------------------------------------------------
875875
# Configuration options related to source browsing

clang/tools/sotoc/docs/main.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
sotoc - Source Transformation for OpenMP Code (suggestions for a better name are greatly appreciated) {#mainpage}
2+
=====================================================================================================
3+
4+
`sotoc` is written as a Clang tool and makes use of the Clang tooling
5+
infrastructure to parse C source files, search for target regions and other
6+
code that will be offloaded to a target device, and then extract and transform
7+
this code into new C code that can then be compiled by a target compiler into
8+
a target image to be used as a OpenMP device binary.
9+
The tool is part of this Clang repository and is automatically build together
10+
with clang.
11+
12+
The tool comes with a regression test suite that uses `llvm-lit`.
13+
The tests can be run using the CMake generated build script when the CMake
14+
option `SOTOC_ENABLE_TESTS` is set to `ON` by running
15+
16+
$ make check-sotoc
17+
18+
To run the tests, make sure that LLVM's `FileCheck` tool is in the path.
19+

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)