ROSE  0.11.96.11
Classes | Typedefs | Enumerations | Functions | Variables
OmpSupport Namespace Reference

Description

Types and functions to support OpenMP.

OpenMP specific data types and functions are put into this namespace

Classes

class  ComplexClause
 
class  SgVarRefExpVisitor
 
class  translationDriver
 A driver to traverse AST trees and invoke individual translators for OpenMP constructs, (not in use) Postorder is preferred. More...
 

Typedefs

typedef std::map< const SgVariableSymbol *, SgVariableSymbol * > VariableSymbolMap_t
 

Enumerations

enum  omp_construct_enum {
  e_unknown = 0,
  e_parallel,
  e_for,
  e_for_simd,
  e_do,
  e_workshare,
  e_sections,
  e_section,
  e_single,
  e_master,
  e_critical,
  e_barrier,
  e_atomic,
  e_flush,
  e_target,
  e_target_declare,
  e_target_data,
  e_target_update,
  e_map,
  e_device,
  e_begin,
  e_end,
  e_threadprivate,
  e_parallel_for,
  e_parallel_for_simd,
  e_parallel_do,
  e_parallel_sections,
  e_parallel_workshare,
  e_task,
  e_taskwait,
  e_ordered_directive,
  e_end_critical,
  e_end_do,
  e_end_master,
  e_end_ordered,
  e_end_parallel_do,
  e_end_parallel_sections,
  e_end_parallel_workshare,
  e_end_parallel,
  e_end_sections,
  e_end_single,
  e_end_task,
  e_end_workshare,
  e_default,
  e_shared,
  e_private,
  e_firstprivate,
  e_lastprivate,
  e_copyin,
  e_copyprivate,
  e_proc_bind,
  e_if,
  e_num_threads,
  e_nowait,
  e_ordered_clause,
  e_reduction,
  e_schedule,
  e_collapse,
  e_untied,
  e_mergeable,
  e_final,
  e_priority,
  e_atomic_clause,
  e_inbranch,
  e_notinbranch,
  e_depend,
  e_default_none,
  e_default_shared,
  e_default_private,
  e_default_firstprivate,
  e_proc_bind_master,
  e_proc_bind_close,
  e_proc_bind_spread,
  e_atomic_read,
  e_atomic_write,
  e_atomic_update,
  e_atomic_capture,
  e_in_reduction_identifier_plus,
  e_in_reduction_identifier_mul,
  e_in_reduction_identifier_minus,
  e_in_reduction_identifier_bitand,
  e_in_reduction_identifier_bitor,
  e_in_reduction_identifier_bitxor,
  e_in_reduction_identifier_logand,
  e_in_reduction_identifier_logor,
  e_in_reduction_identifier_and,
  e_in_reduction_identifier_or,
  e_in_reduction_identifier_eqv,
  e_in_reduction_identifier_neqv,
  e_in_reduction_identifier_max,
  e_in_reduction_identifier_min,
  e_in_reduction_identifier_iand,
  e_in_reduction_identifier_ior,
  e_in_reduction_identifier_ieor,
  e_task_reduction_identifier_plus,
  e_task_reduction_identifier_mul,
  e_task_reduction_identifier_minus,
  e_task_reduction_identifier_bitand,
  e_task_reduction_identifier_bitor,
  e_task_reduction_identifier_bitxor,
  e_task_reduction_identifier_logand,
  e_task_reduction_identifier_logor,
  e_task_reduction_identifier_and,
  e_task_reduction_identifier_or,
  e_task_reduction_identifier_eqv,
  e_task_reduction_identifier_neqv,
  e_task_reduction_identifier_max,
  e_task_reduction_identifier_min,
  e_task_reduction_identifier_iand,
  e_task_reduction_identifier_ior,
  e_task_reduction_identifier_ieor,
  e_reduction_plus,
  e_reduction_mul,
  e_reduction_minus,
  e_reduction_bitand,
  e_reduction_bitor,
  e_reduction_bitxor,
  e_reduction_logand,
  e_reduction_logor,
  e_reduction_and,
  e_reduction_or,
  e_reduction_eqv,
  e_reduction_neqv,
  e_reduction_max,
  e_reduction_min,
  e_reduction_iand,
  e_reduction_ior,
  e_reduction_ieor,
  e_reduction_inscan,
  e_reduction_task,
  e_reduction_default,
  e_lastprivate_conditional,
  e_device_ancestor,
  e_device_device_num,
  e_linear_ref,
  e_linear_val,
  e_linear_uval,
  e_user_defined_parameter,
  e_schedule_none,
  e_schedule_static,
  e_schedule_dynamic,
  e_schedule_guided,
  e_schedule_auto,
  e_schedule_runtime,
  e_map_alloc,
  e_map_to,
  e_map_from,
  e_map_tofrom,
  e_dist_data,
  e_duplicate,
  e_block,
  e_cyclic,
  e_simd,
  e_declare_simd,
  e_safelen,
  e_simdlen,
  e_uniform,
  e_aligned,
  e_linear,
  e_depend_in,
  e_depend_out,
  e_depend_inout,
  e_depend_mutexinoutset,
  e_depend_depobj,
  e_omp_depend_modifier_iterator,
  e_allocate,
  e_allocate_default_mem_alloc,
  e_allocate_large_cap_mem_alloc,
  e_allocate_const_mem_alloc,
  e_allocate_high_bw_mem_alloc,
  e_allocate_low_lat_mem_alloc,
  e_allocate_cgroup_mem_alloc,
  e_allocate_pteam_mem_alloc,
  e_allocate_thread_mem_alloc,
  e_not_omp
}
 
enum  omp_rtl_enum {
  e_gomp,
  e_omni,
  e_last_rtl
}
 The type of target runtime libraries (not yet in use)
 

Functions

void processOpenMP (SgSourceFile *sageFilePtr)
 
void postParsingProcessing (SgSourceFile *sageFilePtr)
 
std::string toString (omp_construct_enum omp_type)
 Output omp_construct_enum to a string:
 
bool isFortranEndDirective (omp_construct_enum omp_type)
 Check if the construct is a Fortran END ... directive.
 
bool isFortranBeginDirective (omp_construct_enum omp_type)
 Check if the construct is a Fortran directive which can (optionally) have a corresponding END directive.
 
bool isDirective (omp_construct_enum omp_type)
 Check if an OpenMP construct is a directive.
 
bool isDirectiveWithBody (omp_construct_enum omp_type)
 Check if an OpenMP directive has a structured body.
 
bool isClause (omp_construct_enum omp_type)
 Check if an OpenMP construct is a clause.
 
bool isReductionOperator (omp_construct_enum omp_type)
 Check if an OpenMP construct is a reduction operator.
 
bool isDependenceType (omp_construct_enum omp_type)
 Check if an OpenMP construct is a dependence type for omp task depend.
 
int patchUpSharedVariables (SgFile *)
 makeDataSharingExplicit() can call some of existing functions for some work in OmpSupport namespace by Hongyi 07/16/2012 TODO: add a function within the OmpSupport namespace, the function should transform the AST, so all variables' data-sharing attributes are explicitied represented in the AST. More...
 
int makeDataSharingExplicit (SgFile *)
 
void commandLineProcessing (std::vector< std::string > &argvList)
 
void lower_omp (SgSourceFile *)
 The top level interface to translate OpenMP directives.
 
void analyze_omp (SgSourceFile *)
 
void insertRTLHeaders (SgSourceFile *)
 Insert #include "xxx.h", the interface of a runtime library to the compiler.
 
void insertRTLinitAndCleanCode (SgSourceFile *)
 Insert runtime init and terminate routines to main() entry.
 
void insertAcceleratorInit (SgSourceFile *)
 
void transOmpParallel (SgNode *node)
 Translate omp parallel.
 
void transOmpTargetParallel (SgNode *node)
 Translate omp parallel under "omp target".
 
void transOmpSections (SgNode *node)
 Translate omp sections.
 
void transOmpTask (SgNode *node)
 Translate omp task.
 
void transUpirLoopParallel (SgNode *node)
 Translate UPIR parallel loops.
 
void transOmpLoop (SgNode *node)
 Translate omp for or omp do loops.
 
void transOmpTargetLoop (SgNode *node)
 Translate omp for or omp do loops affected by the "omp target" directive, using naive 1-to-1 mapping Liao 1/28/2013.
 
void transOmpTargetLoop_RoundRobin (SgNode *node)
 Translate omp for or omp do loops affected by the "omp target" directive, using a round robin-scheduler Liao 7/10/2014.
 
void transOmpTarget (SgNode *node)
 Translate Fortran omp do. More...
 
void transOmpTargetData (SgNode *node)
 Translate "omp target data".
 
void transOmpBarrier (SgNode *node)
 Translate omp barrier.
 
void transOmpFlush (SgNode *node)
 Translate omp flush.
 
void transOmpTaskwait (SgNode *node)
 Translate omp taskwait.
 
void transOmpThreadprivate (SgNode *node)
 Translate omp threadprivate.
 
void transOmpOrdered (SgNode *node)
 Translate the ordered directive (not the ordered clause)
 
void transOmpAtomic (SgNode *node)
 Translate omp atomic.
 
void transOmpCritical (SgNode *node)
 Translate omp critical.
 
void transOmpMaster (SgNode *node)
 Translate omp master.
 
void transOmpSingle (SgNode *node)
 Translate omp single.
 
void transOmpMetadirective (SgNode *node)
 Translate omp metadirective.
 
void transOmpSimd (SgNode *node)
 Translate omp simd.
 
void transOmpUnroll (SgNode *node)
 Translate omp unroll.
 
void transOmpTile (SgNode *node)
 Translate omp tile.
 
void createUpirStatementTree (SgSourceFile *file)
 Analysis helpers.
 
SgStatementgetUpirParent (SgStatement *node)
 
void setUpirRelationship (SgStatement *parent, SgStatement *child)
 
Rose_STL_Container< SgNode * > mergeSgNodeList (Rose_STL_Container< SgNode * > node_list1, Rose_STL_Container< SgNode * > node_list2)
 
SgFunctionDeclarationgenerateOutlinedTask (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.
 
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, lastprivate, reduction, etc. bb1 is the translation generated code block in which the variable handling statements will be inserted. Original loop upper bound is needed for implementing lastprivate (check if it is the last iteration). withinAcceleratorModel means if we only translate private() variables, used to support accelerator model.
 
ROSE_DLL_API SgInitializedNamePtrList collectAllClauseVariables (SgUpirFieldBodyStatement *clause_stmt)
 Collect all variables from OpenMP clauses associated with an omp statement: private, reduction, etc.
 
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, reduction, etc.
 
ROSE_DLL_API SgInitializedNamePtrList collectClauseVariables (SgUpirFieldBodyStatement *clause_stmt, const VariantVector &vvt)
 Collect variables from given types of OpenMP clauses associated with an omp statement: private, reduction, etc.
 
ROSE_DLL_API SgExpressiongetClauseExpression (SgStatement *clause_stmt, const VariantVector &vvt)
 Collect expression from given types of OpenMP clauses associated with an omp statement: private, reduction, etc.
 
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.
 
ROSE_DLL_API bool isInClauseVariableList (SgInitializedName *var, SgUpirFieldBodyStatement *clause_stmt, const VariantVector &vvt)
 Check if a variable is in variable lists of given clause types.
 
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 replaced.
 
ROSE_DLL_API int replaceVariableReferences (SgNode *root, VariableSymbolMap_t varRemap)
 Replace variable references within root based on a map from old symbols to new symbols.
 
int replaceVariablesWithPointerDereference (SgNode *root, std::set< SgVariableSymbol * > &vars)
 Replace all variable references in a set by pointers to the variable.
 
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 it does not exist.
 
ROSE_DLL_API void addUpirDataVariable (SgUpirFieldBodyStatement *target, SgUpirDataItemField *data_item)
 
ROSE_DLL_API SgOmpVariablesClausebuildOmpVariableClause (SgUpirFieldBodyStatement *clause_stmt, const VariantT &vt)
 Build a non-reduction variable clause for a given OpenMP directive. It directly returns the clause if the clause already exists.
 
ROSE_DLL_API int removeClause (SgStatement *clause_stmt, const VariantT &vt)
 Remove one or more clauses of type vt.
 
ROSE_DLL_API bool hasClause (SgStatement *clause_stmt, const VariantT &vt)
 Check if an OpenMP statement has a clause of type vt.
 
ROSE_DLL_API Rose_STL_Container< SgOmpClause * > getClause (SgStatement *clause_stmt, const VariantT &vt)
 Get OpenMP clauses from an eligible OpenMP statement.
 
ROSE_DLL_API bool useStaticSchedule (SgUpirFieldBodyStatement *omp_loop)
 Check if an omp for/do loop use static schedule or not, including: default schedule, or schedule(static[,chunk_size])
 
ROSE_DLL_API SgOmpClause::omp_reduction_identifier_enum getReductionOperationType (SgInitializedName *init_name, SgUpirFieldBodyStatement *clause_stmt)
 Return a reduction variable's reduction operation type.
 
ROSE_DLL_API SgExpressioncreateInitialValueExp (SgOmpClause::omp_reduction_identifier_enum r_operator)
 Create an initial value according to reduction operator type.
 
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.
 
ROSE_DLL_API std::string toString (SgOmpClause::omp_schedule_kind_enum s_kind)
 Convert a schedule kind enum value to a small case string.
 
ROSE_DLL_API int patchUpPrivateVariables (SgFile *)
 Patch up private variables for omp for of entire file. The reason is that loop indices should be private by default and this function will make this explicit.
 
ROSE_DLL_API int patchUpPrivateVariables (SgStatement *omp_loop)
 Patch up private variables for omp for. The reason is that loop indices should be private by default and this function will make this explicit.
 
ROSE_DLL_API int patchUpFirstprivateVariables (SgFile *)
 Patch up firstprivate variables for omp task. The reason is that the specification 3.0 defines rules for implicitly determined data-sharing attributes and this function will make the firstprivate variable of omp task explicit.
 
std::set< SgInitializedName * > collectThreadprivateVariables ()
 Collect threadprivate variables within the current project, return a set to avoid duplicated elements. No input parameters are needed since it finds match from memory pools.
 
SgVariableDeclarationbuildAndInsertDeclarationForOmp (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 OpenMP code.
 
SgBasicBlockgetEnclosingRegionOrFuncDefinition (SgNode *)
 Find an enclosing parallel region or function definition's body.
 
ROSE_DLL_API bool isInClauseVariableList (SgOmpClause *cls, SgSymbol *var)
 Check if a variable is in the clause's variable list.
 
ROSE_DLL_API bool isInUpirDataSharingList (SgOmpClause *data, SgSymbol *variable, SgOmpClause::upir_data_sharing_enum sharing_property)
 
ROSE_DLL_API bool isInUpirDataSharingList (SgUpirFieldBodyStatement *target, SgSymbol *variable, SgOmpClause::upir_data_sharing_enum sharing_property)
 
ROSE_DLL_API bool isInUpirDataSharingList (SgUpirFieldBodyStatement *target, SgSymbol *variable, std::set< SgOmpClause::upir_data_sharing_enum > sharing_property)
 
ROSE_DLL_API bool isInUpirDataList (SgUpirFieldBodyStatement *target, SgSymbol *variable)
 
ROSE_DLL_API SgUpirDataItemFieldisInUpirDataList (SgOmpClause *target, SgSymbol *variable)
 
ROSE_DLL_API bool isThreadprivate (SgSymbol *var)
 Check if a variable is a threadprivate variable. It will search for all threadprivate directives to find the answer.
 
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 be the inner most node associated with the variable reference, e.g. More...
 
ROSE_DLL_API omp_construct_enum getDataSharingAttribute (SgVarRefExp *varRef)
 Return the OpenMP data sharing attribute type of a variable reference.
 
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.
 
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.
 

Variables

omp_construct_enum cur_omp_directive
 
bool enable_accelerator
 
bool useDDE
 
unsigned int nCounter
 
omp_rtl_enum rtl_type
 

Function Documentation

◆ patchUpSharedVariables()

int OmpSupport::patchUpSharedVariables ( SgFile )

makeDataSharingExplicit() can call some of existing functions for some work in OmpSupport namespace by Hongyi 07/16/2012 TODO: add a function within the OmpSupport namespace, the function should transform the AST, so all variables' data-sharing attributes are explicitied represented in the AST.

ROSE has dedicated AST nodes for OpenMP directives and the associated clauses, such as private, shared, reduction.

◆ transOmpTarget()

void OmpSupport::transOmpTarget ( SgNode node)

Translate Fortran omp do.

Translate "omp target"

◆ getDataSharingAttribute()

ROSE_DLL_API omp_construct_enum OmpSupport::getDataSharingAttribute ( SgSymbol var,
SgNode anchor_node 
)

Return the data sharing attribute type of a variable, specified as a symbol and an anchor node (Must be the inner most node associated with the variable reference, e.g.

a SgVarRefExp, SgVariableDeclaration, etc) Possible returned values include: e_shared, e_private, e_firstprivate, e_lastprivate, e_reduction, e_threadprivate, e_copyin, and e_copyprivate.