OmpPragma
A helper class to rewrite some "pragma omp" (mostly teams and similar combined constructs), which are not supported by sotoc. More...
#include <OmpPragma.h>
Public Functions
Name | |
---|---|
OmpPragma(TargetCodeRegion * TCR) | |
OmpPragma(clang::OMPExecutableDirective * Directive, clang::PrintingPolicy PP) | |
bool | needsStructuredBlock() Returns true if the omp pragma encapsulated, needs to be followed by a structured block (i.e. |
void | printReplacement(llvm::raw_ostream & Out) Prints a replacement omp pragma for the encapsulated pragma onto Out . |
void | printAddition(llvm::raw_ostream & Out) |
bool | isReplaceable(clang::OMPExecutableDirective * Directive) Determines whether a pragma is replacable. |
bool | needsAdditionalPragma(clang::OMPExecutableDirective * Directive) Determines whether a additional pragma is needed. |
Private Functions
Name | |
---|---|
bool | isClausePrintable(clang::OMPClause * Clause) Determine whether a clause is printable. |
void | rewriteParam(std::string * In) Rewrite clause parameters. |
void | printClauses(llvm::raw_ostream & Out) Print OMP Clauses. |
Private Attributes
Name | |
---|---|
clang::PrintingPolicy | PP |
llvm::ArrayRef< clang::OMPClause * > | Clauses |
clang::OpenMPDirectiveKind | Kind |
unsigned int | ClauseParamCounter |
Detailed Description
1 |
|
A helper class to rewrite some "pragma omp" (mostly teams and similar combined constructs), which are not supported by sotoc.
We currently only support one team to be run on the target because ncc does not support 'freestanding' teams. So we need to remove teams and distribute constructs from the generated target code. But teams constructs can also appear in combined constructs. These combined constructs cannot simply be removed, they must be replace by "non-team" equivalents to preserve correctness. This class provides helper functions that finds a suitable replacement for omp pragmas that contain teams constructs. It is used during code generation: The omp pragma of each target region that is declared as part of a combined construct and each pragma found during pretty printing is encapsulated by an object of this class which is then used to generate a replacement.
Public Functions Documentation
function OmpPragma
1 2 3 |
|
function OmpPragma
1 2 3 4 |
|
function needsStructuredBlock
1 |
|
Returns true if the omp pragma encapsulated, needs to be followed by a structured block (i.e.
Return: true If a structured block is needed
false If no structured block is needed
Determines whether a structured block is needed for a pragma.
{...}).
function printReplacement
1 2 3 |
|
Prints a replacement omp pragma for the encapsulated pragma onto Out
.
Parameters:
- Out Out stream
Print replacement pragmas.
In some cases we have to modify the printed pragma. If we have a combined constructs with target, remove target because we are already running on the target device. If we have a combined construct with teams, remove teams because the runtime can decide to spawn only a single team. If we have a simd, we prepend #pragma _NEC ivdep
to indicate no dependencies.
function printAddition
1 2 3 |
|
function isReplaceable
1 2 3 |
|
Determines whether a pragma is replacable.
Parameters:
- Directive Given Directive
Return: true If the directive is replacable
false If the directive is not replacable
function needsAdditionalPragma
1 2 3 |
|
Determines whether a additional pragma is needed.
Parameters:
- Directive given directive
Return: true Directive needs an additional pragma
false Directive does not need an additional pragma
Private Functions Documentation
function isClausePrintable
1 2 3 |
|
Determine whether a clause is printable.
Parameters:
- Clause Clause to check
Return: true If the clause is printable
false If the clause is not printable
Checks for a clause the clause kind and determines which clauses are printable.
function rewriteParam
1 2 3 |
|
Rewrite clause parameters.
Parameters:
- In Parameter as string (everything in brackets)
Rewrites OMP clause parameters if they are variables to replace the variable name with the one we will use as the function argument.
function printClauses
1 2 3 |
|
Print OMP Clauses.
Parameters:
- Out Out stream
Private Attributes Documentation
variable PP
1 |
|
variable Clauses
1 |
|
variable Kind
1 |
|
variable ClauseParamCounter
1 |
|