public final class Directive
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
NO_COLLAPSE |
Modifier and Type | Method and Description |
---|---|
static Xnode |
findParallelRegionEnd(Xnode functionDefinition,
Xnode from)
Skip elements in epilogue and find the last element that will be included
in the parallel region.
|
static Xnode |
findParallelRegionStart(Xnode functionDefinition,
Xnode from)
Skip elements in preamble and find the first element that will be included
in the parallel region.
|
static Xnode |
generateAcceleratorClause(XcodeProgram xcodeml,
Xnode startStmt,
java.lang.String accClause)
Generate corresponding pragmas applied directly after a CLAW pragma.
|
static void |
generateDataRegionClause(XcodeProgram xcodeml,
java.util.List<java.lang.String> presents,
java.util.List<java.lang.String> creates,
Xnode startStmt,
Xnode endStmt)
Generate directive directive for a data region.
|
static void |
generateLoopDirectives(XcodeProgram xcodeml,
Xnode startStmt,
Xnode endStmt,
int collapse)
Generates directive directive for a loop region.
|
static int |
generateLoopSeq(XcodeProgram xcodeml,
FfunctionDefinition fctDef,
java.lang.String noDependencyDirective)
Generate loop seq directives on the top of loops in the given function
definition.
|
static Xnode |
generateParallelClause(XcodeProgram xcodeml,
Xnode startStmt,
Xnode endStmt)
Generate corresponding pragmas to surround the code with a parallel
accelerated region.
|
static void |
generateParallelLoopClause(XcodeProgram xcodeml,
java.util.List<java.lang.String> privates,
Xnode startStmt,
Xnode endStmt,
int collapse)
Generate directive directive for a parallel loop.
|
static void |
generatePrivateClause(XcodeProgram xcodeml,
Xnode stmt,
java.lang.String var)
Generate the correct clauses for private variable on directive.
|
static void |
generateRoutineDirectives(XcodeProgram xcodeml,
FfunctionDefinition fctDef)
Generate all corresponding pragmas to be applied to an accelerated
function/subroutine.
|
static Xnode |
generateUpdate(XcodeProgram xcodeml,
Xnode hook,
java.util.List<java.lang.String> vars,
DataMovement direction)
Generate update directives for device and host data transfer.
|
static java.util.List<java.lang.String> |
getLocalArrays(XcodeProgram xcodeml,
FfunctionDefinition fctDef)
Get all the local variables in the function definition.
|
static java.util.List<java.lang.String> |
getLocalVariables(XcodeProgram xcodeml,
FfunctionDefinition fctDef)
Get all the local variables in the function definition.
|
static java.util.List<java.lang.String> |
getPresentVariables(XcodeProgram xcodeml,
FfunctionDefinition fctDef)
Get all the function variables that are input/output parameters.
|
public static final int NO_COLLAPSE
public static int generateLoopSeq(XcodeProgram xcodeml, FfunctionDefinition fctDef, java.lang.String noDependencyDirective)
xcodeml
- Object representation of the current XcodeML
representation in which the pragmas will be
generated.fctDef
- Function definition in which do statements
will be decorated.noDependencyDirective
- Directive string used to flag a loop as
no dependency loop.public static Xnode generateUpdate(XcodeProgram xcodeml, Xnode hook, java.util.List<java.lang.String> vars, DataMovement direction)
xcodeml
- Object representation of the current XcodeML
representation in which the pragmas will be generated.hook
- Node used as a hook for insertion. Update device are
generated before the hook and update host after the hook.vars
- List of variables inserted in the directive.direction
- Direction of the update directive.public static Xnode generateParallelClause(XcodeProgram xcodeml, Xnode startStmt, Xnode endStmt)
xcodeml
- Object representation of the current XcodeML
representation in which the pragmas will be generated.startStmt
- Start statement representing the beginning of the parallel
region.endStmt
- End statement representing the end of the parallel region.public static void generateParallelLoopClause(XcodeProgram xcodeml, java.util.List<java.lang.String> privates, Xnode startStmt, Xnode endStmt, int collapse)
xcodeml
- Object representation of the current XcodeML
representation in which the pragmas will be generated.privates
- List of variables to be set privates.startStmt
- Start statement representing the beginning of the parallel
region.endStmt
- End statement representing the end of the parallel region.collapse
- If value bigger than 0, a corresponding collapse
constructs can be generated.public static void generateLoopDirectives(XcodeProgram xcodeml, Xnode startStmt, Xnode endStmt, int collapse)
xcodeml
- Object representation of the current XcodeML
representation in which the pragmas will be generated.startStmt
- Start statement representing the beginning of the loop
region.endStmt
- End statement representing the end of the loop region.collapse
- If value bigger than 0, a corresponding collapse
constructs can be generated.public static void generateDataRegionClause(XcodeProgram xcodeml, java.util.List<java.lang.String> presents, java.util.List<java.lang.String> creates, Xnode startStmt, Xnode endStmt)
xcodeml
- Object representation of the current XcodeML
representation in which the pragmas will be generated.presents
- List of variables to be set as present.creates
- List of variables to be created.startStmt
- Start statement representing the beginning of the data
region.endStmt
- End statement representing the end of the data region.public static java.util.List<java.lang.String> getPresentVariables(XcodeProgram xcodeml, FfunctionDefinition fctDef)
xcodeml
- Current XcodeML program unit.fctDef
- Function definition to look in.public static java.util.List<java.lang.String> getLocalVariables(XcodeProgram xcodeml, FfunctionDefinition fctDef)
xcodeml
- Current XcodeML program unit.fctDef
- Function definition to look in.public static java.util.List<java.lang.String> getLocalArrays(XcodeProgram xcodeml, FfunctionDefinition fctDef)
xcodeml
- Current XcodeML program unit.fctDef
- Function definition to look in.public static Xnode generateAcceleratorClause(XcodeProgram xcodeml, Xnode startStmt, java.lang.String accClause)
startStmt
- Start statement representing the beginning of the parallel
region.xcodeml
- Object representation of the current XcodeML
representation in which the pragmas will be generated.accClause
- Additional clause append at the end of the directive.public static void generateRoutineDirectives(XcodeProgram xcodeml, FfunctionDefinition fctDef)
xcodeml
- Object representation of the current XcodeML
representation in which the pragmas will be generated.fctDef
- Function/subroutine in which directive directives are
generated.public static void generatePrivateClause(XcodeProgram xcodeml, Xnode stmt, java.lang.String var)
xcodeml
- Object representation of the current XcodeML
representation in which the pragmas will be generated.stmt
- Statement from which we looks for a parallel clause to
append private clauses.var
- Variable to generate the private clause.public static Xnode findParallelRegionStart(Xnode functionDefinition, Xnode from)
functionDefinition
- Function definition in which body checked.from
- Optional element to start from. If null, starts
from first element in function's body.public static Xnode findParallelRegionEnd(Xnode functionDefinition, Xnode from)
functionDefinition
- Function definition in which body checked.from
- Optional element to start from. If null, starts
from last element in function's body.