1#ifndef Omp_Attribute_h_INCLUDED 
    2#define Omp_Attribute_h_INCLUDED 
   31  enum  omp_construct_enum 
 
   79    e_end_parallel_sections,
 
   80    e_end_parallel_workshare,
 
  124    e_default_firstprivate,
 
  210  extern omp_construct_enum cur_omp_directive; 
 
  300      std::vector<OmpAttribute*> ompAttriList;
 
  302      std::string toOpenMPString();
 
  312          return CUSTOM_OWNERSHIP;
 
 
 
  333      void setNode(
SgNode* n) { mNode= n;};
 
  336      omp_construct_enum getOmpDirectiveType() {
return omp_type;}
 
  357      std::vector<std::pair<std::string,SgNode* > > 
 
  362      std::map<SgSymbol*,  std::vector < std::pair <SgExpression*, SgExpression*> > >  
array_dimensions;  
 
  369      std::map <SgSymbol* ,  std::vector < std::pair<omp_construct_enum, SgExpression*> >   >  dist_data_policies; 
 
  385      std::pair<std::string, SgExpression*>  
 
  405      void setDependenceType(omp_construct_enum operatorx);
 
  417      void setMapVariant(omp_construct_enum operatorx);
 
  427      void setDefaultValue(omp_construct_enum valuex);
 
  428      omp_construct_enum getDefaultValue();
 
  431      void setProcBindPolicy(omp_construct_enum valuex);
 
  432      omp_construct_enum getProcBindPolicy();
 
  435      void setAtomicAtomicity(omp_construct_enum valuex);
 
  436      omp_construct_enum getAtomicAtomicity();
 
  439      omp_construct_enum getScheduleKind(); 
 
  440      void setScheduleKind(omp_construct_enum kindx);
 
  447      std::string  getCriticalName() {
return name;};
 
  448      bool isNamedCritical(){
return hasName;};
 
  454      bool get_isUserDefined() {
return isUserDefined; }
 
  469        omp_type = e_unknown;
 
  471        isUserDefined = 
true;
 
  475        mNode(mynode),omp_type(omptype){ 
 
  479          isUserDefined = 
true;
 
  484            ROSE_ASSERT (lnode != NULL);
 
  487            ROSE_ASSERT(isSgLocatedNode(mNode));
 
  504      enum omp_construct_enum  omp_type; 
 
  510      std::vector<omp_construct_enum> clauses;
 
  511      std::map<omp_construct_enum,bool> clause_map;
 
  515      std::vector<omp_construct_enum> reduction_operators;
 
  518      std::vector<omp_construct_enum> dependence_types;
 
  522      std::vector<omp_construct_enum> map_variants; 
 
  532      std::map<omp_construct_enum, std::vector<std::pair<std::string,SgNode* > > > variable_lists; 
 
  534      std::map<std::string, std::vector<omp_construct_enum> > var_clauses;
 
  539      std::map<omp_construct_enum, std::pair<std::string, SgExpression*> > expressions;
 
  544      omp_construct_enum default_scope; 
 
  547      omp_construct_enum proc_bind_policy; 
 
  550      omp_construct_enum atomicity; 
 
  553      omp_construct_enum schedule_kind;
 
  568      OmpAttribute * parent; 
 
  577      std::string toOpenMPString(omp_construct_enum omp_type);
 
  580      std::string toOpenMPString(std::vector<std::pair<std::string,SgNode* > > varList, 
bool checkDistPolicy = 
false);
 
  583      std::string toOpenMPString (std::vector < std::pair <omp_construct_enum, SgExpression*> > dim_policies);
 
 
  589  extern std::list<OmpAttribute* > omp_comment_list;
 
Base class for all IR node attribute values.
 
OwnershipPolicy
Who owns this attribute.
 
virtual OwnershipPolicy getOwnershipPolicy() const override
Who owns this attribute.
 
virtual std::string attribute_class_name() const override
Attribute class name.
 
One attribute object stores all information within an OpenMP pragma (directive and clauses)
 
void addExpression(omp_construct_enum targetConstruct, const std::string &expString, SgExpression *sgexp=NULL)
-----—Expressions --------------------------— Add an expression to a clause
 
SgVariableSymbol * addVariable(omp_construct_enum targetConstruct, const std::string &varString, SgInitializedName *sgvar=NULL)
-----—var list -----------— Add a variable into a variable list of an OpenMP construct ,...
 
PreprocessingInfo * getPreprocessingInfo()
Get the associated PreprocessingInfo for Fortran, if any
 
std::vector< omp_construct_enum > getMapVariants()
Get map clauses for each variant, map(variant:var_list)
 
std::map< SgSymbol *, std::vector< std::pair< SgExpression *, SgExpression * > > > array_dimensions
Dimension information for array variables, used by map clause, such as map (tofrom:array[0:n][0:m])
 
bool hasMapVariant(omp_construct_enum operatorx)
Check if a map variant exists.
 
std::vector< omp_construct_enum > getDependenceTypes()
Get dependence clauses for each type, depend(type:varlist)
 
void setReductionOperator(omp_construct_enum operatorx)
-----—values for some clauses -------—
 
void setCriticalName(const std::string &name)
Set name for named critical section.
 
friend OmpAttribute * buildOmpAttribute(omp_construct_enum directive_type, SgNode *node, bool userDefined)
Some utility functions to manipulate OmpAttribute.
 
std::vector< std::pair< std::string, SgNode * > > getVariableList(omp_construct_enum)
Get the variable list associated with a construct.
 
bool hasDependenceType(omp_construct_enum operatorx)
Check if a depend type exists.
 
bool isMapVariant(omp_construct_enum omp_type)
Check if the input parameter is a map variant enum type.
 
bool hasClause(omp_construct_enum clause_type)
Check if a directive has a clause of the specified type.
 
void addClause(omp_construct_enum clause_type)
--------—clauses-------------— Add a clause into an OpenMP directive, the content of the clause is se...
 
std::vector< omp_construct_enum > getClauses()
Get all existing clauses.
 
bool hasVariableList(omp_construct_enum)
Check if a variable list is associated with a construct.
 
std::vector< std::pair< omp_construct_enum, SgExpression * > > getDistDataPolicy(SgVariableSymbol *array_symbol)
Obtain data distribution policy for an array. There are up to 3 pairs for 3-D.
 
SgNode * getNode()
Get the associated SgNode, can be SgPragmaDeclaration or others( for fortran nodes or during parallel...
 
SgPragmaDeclaration * getPragmaDeclaration()
-----------—AST connection---------------— Get the associated SgPragmaDeclaration for C/C++,...
 
std::pair< std::string, SgExpression * > getExpression(omp_construct_enum targetConstruct)
Get expression of a clause.
 
std::vector< omp_construct_enum > getReductionOperators()
Get reduction clauses for each operations, reduction(op:kind)
 
bool appendDistDataPolicy(SgVariableSymbol *array_symbol, omp_construct_enum dist_data_policy, SgExpression *size_exp=NULL)
Insert dist_data policy for one dimension of an array into its policy vector (duplicate,...
 
std::string toOpenMPString()
Convert OmpAttribute to a legal OpenMP pragma string,.
 
bool isInConstruct(const std::string &variable, enum omp_construct_enum)
Check if a variable is inside a variable list of a clause/directive.
 
std::vector< enum omp_construct_enum > get_clauses(const std::string &variable)
Find the relevant clauses for a variable.
 
void setOmpDirectiveType(omp_construct_enum omptype)
---------—directive type----—
 
bool hasReductionOperator(omp_construct_enum operatorx)
Check if a reduction operation exists.
 
void print()
Pretty print the OmpAttribute.
 
SgVariableSymbol * addVariable(omp_construct_enum targetConstruct, SgExpression *varExp)
Add a variable ref expression to a clause: this is useful for array reference expression....
 
For preprocessing information including source comments, include , if, define, etc.
 
This class represents the notion of an expression. Expressions are derived from SgLocatedNodes,...
 
This class represents the notion of a declared variable.
 
This class represents the notion of an expression or statement which has a position within the source...
 
This class represents the base class for all IR nodes within Sage III.
 
This class represents the concept of a C Assembler statement (untested).
 
This class represents the concept of a variable name within the compiler (a shared container for the ...
 
Types and functions to support OpenMP.
 
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.
 
OmpAttribute * getOmpAttribute(SgNode *node)
Get the first OmpAttribute from a SgNode, return NULL if not found.
 
ROSE_DLL_API void removeOmpAttribute(OmpAttribute *ompattribute, SgNode *node)
Remove OmpAttribute from a SgNode.
 
ROSE_DLL_API std::string generateDiffTextFromOmpAttribute(SgNode *sg_node)
Generate diff text from OmpAttribute attached to a statement.
 
omp_construct_enum getOmpConstructEnum(SgPragmaDeclaration *decl)
Get omp enum from an OpenMP pragma attached with OmpAttribute.
 
omp_construct_enum getBeginOmpConstructEnum(omp_construct_enum end_enum)
Get the corresponding begin construct enum from an end construct enum.
 
bool isFortranBeginDirective(omp_construct_enum omp_type)
Check if the construct is a Fortran directive which can (optionally) have a corresponding END directi...
 
ROSE_DLL_API void addOmpAttribute(OmpAttribute *ompattribute, SgNode *node)
Add OmpAttribute to a SgNode.
 
ROSE_DLL_API void generatePragmaFromOmpAttribute(SgNode *sg_node)
Generate a pragma declaration from OmpAttribute attached to a statement.
 
bool isDependenceType(omp_construct_enum omp_type)
Check if an OpenMP construct is a dependence type for omp task depend.
 
std::string toString(omp_construct_enum omp_type)
Output omp_construct_enum to a string:
 
ROSE_DLL_API bool isEquivalentOmpAttribute(OmpAttribute *a1, OmpAttribute *a2)
Check if two OmpAttributes are semantically equivalent to each other.
 
ROSE_DLL_API OmpAttribute * buildOmpAttribute(enum omp_construct_enum directive_type, SgNode *context_node, bool useDefined)
Some utility functions to manipulate OmpAttribute.
 
bool isReductionOperator(omp_construct_enum omp_type)
Check if an OpenMP construct is a reduction operator.
 
ROSE_DLL_API OmpAttributeList * getOmpAttributeList(SgNode *node)
Get OmpAttribute from a SgNode, return NULL if not found.
 
bool isFortranEndDirective(omp_construct_enum omp_type)
Check if the construct is a Fortran END ... directive.
 
bool isClause(omp_construct_enum omp_type)
Check if an OpenMP construct is a clause.
 
omp_construct_enum getEndOmpConstructEnum(omp_construct_enum begin_enum)
Get the corresponding end construct enum from a begin construct enum.