7 #include "ompSupport.h"
16 extern std::vector<SgFunctionDeclaration* >* outlined_function_list;
17 extern std::vector<SgDeclarationStatement *>* outlined_struct_list;
23 extern bool enable_accelerator;
35 int makeDataSharingExplicit(
SgFile* );
47 extern unsigned int nCounter;
50 typedef std::map<const SgVariableSymbol *, SgVariableSymbol *> VariableSymbolMap_t;
52 void commandLineProcessing(std::vector<std::string> &argvList);
150 Rose_STL_Container<SgNode *> mergeSgNodeList(Rose_STL_Container<SgNode *> node_list1, Rose_STL_Container<SgNode *> node_list2);
155 std::set<const SgVariableSymbol*>& syms,
156 std::set<const SgVariableSymbol*>& pdSyms3,
157 bool use_task_param =
false);
205 ROSE_DLL_API Rose_STL_Container<SgOmpClause*>
getClause(
SgStatement* clause_stmt,
const VariantT & vt);
223 ROSE_DLL_API std::string
toString(SgOmpClause::omp_schedule_kind_enum s_kind);
244 ROSE_DLL_API
bool isInUpirDataSharingList(
SgOmpClause* data,
SgSymbol*
variable, SgOmpClause::upir_data_sharing_enum sharing_property);
265 std::map<
SgSymbol*, std::vector< std::pair <SgExpression*, SgExpression*> > > & array_dimensions,
266 std::map<
SgSymbol*, std::vector< std::pair< SgOmpClause::omp_map_dist_data_enum, SgExpression * > > > & dist_data_policies,
270 std::map<
SgSymbol*, std::vector < std::pair <SgExpression*, SgExpression*> > >& array_dimensions,
271 std::set<SgSymbol*>& array_syms,
272 std::set<SgSymbol*>& atom_syms);
275 #endif //OMP_LOWERING_H
void visit(SgNode *)
this method is called at every traversed node.
void transOmpSimd(SgNode *node)
Translate omp simd.
ROSE_DLL_API std::string generateGOMPLoopStartFuncName(bool isOrdered, SgOmpClause::omp_schedule_kind_enum s_kind)
Generate GOMP loop schedule start function's name.
ROSE_DLL_API std::string generateGOMPLoopNextFuncName(bool isOrdered, SgOmpClause::omp_schedule_kind_enum s_kind)
Generate GOMP loop schedule next function's name.
This class represents the concept of a variable name within the compiler (a shared container for the ...
ROSE_DLL_API omp_construct_enum getDataSharingAttribute(SgSymbol *var, SgNode *anchor_node)
Return the data sharing attribute type of a variable, specified as a symbol and an anchor node (Must ...
ROSE_DLL_API int replaceVariableReferences(SgNode *root, SgVariableSymbol *oldVar, SgVariableSymbol *newVar)
Replace references to oldVar within root with references to newVar, return the number of references r...
void transOmpMetadirective(SgNode *node)
Translate omp metadirective.
void categorizeMapClauseVariables(const SgInitializedNamePtrList &all_vars, std::map< SgSymbol *, std::vector< std::pair< SgExpression *, SgExpression * > > > &array_dimensions, std::set< SgSymbol * > &array_syms, std::set< SgSymbol * > &atom_syms)
Categorize mapped variables.
void insertRTLHeaders(SgSourceFile *)
Insert #include "xxx.h", the interface of a runtime library to the compiler.
void transOmpTargetData(SgNode *node)
Translate "omp target data".
void transOmpFlush(SgNode *node)
Translate omp flush.
std::string toString(omp_construct_enum omp_type)
Output omp_construct_enum to a string:
ROSE_DLL_API bool hasClause(SgStatement *clause_stmt, const VariantT &vt)
Check if an OpenMP statement has a clause of type vt.
This class represents the variable refernece in expressions.
ROSE_DLL_API SgOmpVariablesClause * buildOmpVariableClause(SgUpirFieldBodyStatement *clause_stmt, const VariantT &vt)
Build a non-reduction variable clause for a given OpenMP directive. It directly returns the clause if...
This class represents a source file for a project (which may contian many source files and or directo...
ROSE_DLL_API int removeClause(SgStatement *clause_stmt, const VariantT &vt)
Remove one or more clauses of type vt.
void transOmpCritical(SgNode *node)
Translate omp critical.
This class represents the base class for all types.
ROSE_DLL_API bool isInClauseVariableList(SgInitializedName *var, SgUpirFieldBodyStatement *clause_stmt, const VariantT &vt)
Check if a variable is in a variable list of a given clause type.
void transOmpOrdered(SgNode *node)
Translate the ordered directive (not the ordered clause)
SgBasicBlock * getEnclosingRegionOrFuncDefinition(SgNode *)
Find an enclosing parallel region or function definition's body.
void transOmpSections(SgNode *node)
Translate omp sections.
This class represents the concept of a block (not a basic block from control flow analysis).
void transOmpUnroll(SgNode *node)
Translate omp unroll.
void transOmpParallel(SgNode *node)
Translate omp parallel.
This class represents the concept of a function declaration statement.
ROSE_DLL_API void addClauseVariable(SgInitializedName *var, SgUpirFieldBodyStatement *clause_stmt, const VariantT &vt)
Add a variable into a non-reduction clause of an OpenMP statement, create the clause transparently if...
SgVariableDeclaration * buildAndInsertDeclarationForOmp(const std::string &name, SgType *type, SgInitializer *varInit, SgBasicBlock *orig_scope)
Special handling when trying to build and insert a variable declaration into a BB within Fortran Open...
ROSE_DLL_API bool useStaticSchedule(SgUpirFieldBodyStatement *omp_loop)
Check if an omp for/do loop use static schedule or not, including: default schedule,...
ROSE_DLL_API SgExpression * createInitialValueExp(SgOmpClause::omp_reduction_identifier_enum r_operator)
Create an initial value according to reduction operator type.
This class represents the notion of an expression. Expressions are derived from SgLocatedNodes,...
int patchUpSharedVariables(SgFile *)
makeDataSharingExplicit() can call some of existing functions for some work in OmpSupport namespace b...
void transOmpTarget(SgNode *node)
Translate Fortran omp do.
void transOmpBarrier(SgNode *node)
Translate omp barrier.
ROSE_DLL_API bool isThreadprivate(SgSymbol *var)
Check if a variable is a threadprivate variable. It will search for all threadprivate directives to f...
Class for traversing the AST.
ROSE_DLL_API int patchUpFirstprivateVariables(SgFile *)
Patch up firstprivate variables for omp task. The reason is that the specification 3....
ROSE_DLL_API SgOmpClause::omp_reduction_identifier_enum getReductionOperationType(SgInitializedName *init_name, SgUpirFieldBodyStatement *clause_stmt)
Return a reduction variable's reduction operation type.
This class represents the base class for all IR nodes within Sage III.
void transOmpLoop(SgNode *node)
Translate omp for or omp do loops.
void transOmpMaster(SgNode *node)
Translate omp master.
ROSE_DLL_API int patchUpPrivateVariables(SgFile *)
Patch up private variables for omp for of entire file. The reason is that loop indices should be priv...
void lower_omp(SgSourceFile *)
The top level interface to translate OpenMP directives.
This class represents the notion of a declared variable.
Types and functions to support OpenMP.
ROSE_DLL_API void transOmpVariables(SgStatement *ompStmt, SgBasicBlock *bb1, SgExpression *orig_loop_upper=NULL, bool withinAcceleratorModel=false)
Translate OpenMP variables associated with an OpenMP pragma, such as private, firstprivate,...
void transUpirLoopParallel(SgNode *node)
Translate UPIR parallel loops.
A driver to traverse AST trees and invoke individual translators for OpenMP constructs,...
void createUpirStatementTree(SgSourceFile *file)
Analysis helpers.
void insertRTLinitAndCleanCode(SgSourceFile *)
Insert runtime init and terminate routines to main() entry.
SgFunctionDeclaration * generateOutlinedTask(SgNode *node, std::string &wrapper_name, std::set< const SgVariableSymbol * > &syms, std::set< const SgVariableSymbol * > &pdSyms3, bool use_task_param=false)
A helper function to generate implicit or explicit task for either omp parallel or omp task.
void transOmpTargetLoop(SgNode *node)
Translate omp for or omp do loops affected by the "omp target" directive, using naive 1-to-1 mapping ...
void transOmpThreadprivate(SgNode *node)
Translate omp threadprivate.
ROSE_DLL_API bool isSharedAccess(SgVarRefExp *varRef)
Check if a variable access is a shared access , assuming it is already within an OpenMP region.
void extractMapClauses(Rose_STL_Container< SgOmpClause * > map_clauses, std::map< SgSymbol *, std::vector< std::pair< SgExpression *, SgExpression * > > > &array_dimensions, std::map< SgSymbol *, std::vector< std::pair< SgOmpClause::omp_map_dist_data_enum, SgExpression * > > > &dist_data_policies, SgOmpMapClause **map_alloc_clause, SgOmpMapClause **map_to_clause, SgOmpMapClause **map_from_clause, SgOmpMapClause **map_tofrom_clause)
Extract map clause information.
This class represents the concept of a C or C++ variable declaration.
void transOmpTargetLoop_RoundRobin(SgNode *node)
Translate omp for or omp do loops affected by the "omp target" directive, using a round robin-schedul...
void transOmpTaskwait(SgNode *node)
Translate omp taskwait.
void transOmpAtomic(SgNode *node)
Translate omp atomic.
void transOmpSingle(SgNode *node)
Translate omp single.
ROSE_DLL_API SgExpression * getClauseExpression(SgStatement *clause_stmt, const VariantVector &vvt)
Collect expression from given types of OpenMP clauses associated with an omp statement: private,...
This class represents the notion of a statement.
ROSE_DLL_API SgInitializedNamePtrList collectAllClauseVariables(SgUpirFieldBodyStatement *clause_stmt)
Collect all variables from OpenMP clauses associated with an omp statement: private,...
ROSE_DLL_API SgInitializedNamePtrList collectClauseVariables(SgUpirFieldBodyStatement *clause_stmt, const VariantT &vt)
Collect variables from a particular type of OpenMP clauses associated with an omp statement: private,...
std::set< SgInitializedName * > collectThreadprivateVariables()
Collect threadprivate variables within the current project, return a set to avoid duplicated elements...
void transOmpTask(SgNode *node)
Translate omp task.
This class represents the notion of an initializer for a variable declaration or expression in a func...
omp_rtl_enum
The type of target runtime libraries (not yet in use)
int replaceVariablesWithPointerDereference(SgNode *root, std::set< SgVariableSymbol * > &vars)
Replace all variable references in a set by pointers to the variable.
void transOmpTargetParallel(SgNode *node)
Translate omp parallel under "omp target".
This class represents the concept of a name within the compiler.
void transOmpTile(SgNode *node)
Translate omp tile.
ROSE_DLL_API Rose_STL_Container< SgOmpClause * > getClause(SgStatement *clause_stmt, const VariantT &vt)
Get OpenMP clauses from an eligible OpenMP statement.