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;
217 std::string
toString(omp_construct_enum omp_type);
232 bool isClause(omp_construct_enum omp_type);
244 ROSE_DLL_API OmpAttribute*
buildOmpAttribute(
enum omp_construct_enum directive_type,
SgNode* context_node,
bool useDefined);
255 class OmpAttributeList;
300 std::vector<OmpAttribute*> ompAttriList;
302 std::string toOpenMPString();
312 return CUSTOM_OWNERSHIP;
315 virtual std::string attribute_class_name()
const override;
333 void setNode(
SgNode* n) { mNode= n;};
336 omp_construct_enum getOmpDirectiveType() {
return omp_type;}
340 void addClause(omp_construct_enum clause_type);
342 bool hasClause(omp_construct_enum clause_type);
345 std::vector<omp_construct_enum> getClauses();
355 bool hasVariableList(omp_construct_enum);
357 std::vector<std::pair<std::string,SgNode* > >
358 getVariableList(omp_construct_enum);
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;
372 std::vector<enum omp_construct_enum> get_clauses(
const std::string&
variable);
378 std::vector < std::pair < omp_construct_enum, SgExpression*> > getDistDataPolicy (
SgVariableSymbol* array_symbol);
382 void addExpression(omp_construct_enum targetConstruct,
const std::string& expString,
SgExpression* sgexp=NULL);
385 std::pair<std::string, SgExpression*>
386 getExpression(omp_construct_enum targetConstruct);
395 void setReductionOperator(omp_construct_enum operatorx);
398 std::vector<omp_construct_enum> getReductionOperators();
401 bool hasReductionOperator(omp_construct_enum operatorx);
405 void setDependenceType(omp_construct_enum operatorx);
408 std::vector<omp_construct_enum> getDependenceTypes();
411 bool hasDependenceType(omp_construct_enum operatorx);
417 void setMapVariant(omp_construct_enum operatorx);
419 std::vector<omp_construct_enum> getMapVariants();
421 bool hasMapVariant(omp_construct_enum operatorx);
424 bool isMapVariant(omp_construct_enum omp_type);
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);
443 bool isInConstruct(
const std::string &
variable,
enum omp_construct_enum);
446 void setCriticalName(
const std::string & name);
447 std::string getCriticalName() {
return name;};
448 bool isNamedCritical(){
return hasName;};
454 bool get_isUserDefined() {
return isUserDefined; }
458 std::string toOpenMPString();
469 omp_type = e_unknown;
471 isUserDefined =
true;
474 OmpAttribute(omp_construct_enum omptype,
SgNode* mynode):
475 mNode(mynode),omp_type(omptype){
479 isUserDefined =
true;
482 #if 0 // [Robb Matzke 2021-03-28]: causes unused variable warning every time this header is included
484 ROSE_ASSERT (lnode != NULL);
486 #else // fixed version
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;
594 #endif //Omp_Attribute_h_INCLUDED
bool isDirectiveWithBody(omp_construct_enum omp_type)
Check if an OpenMP directive has a structured body.
SgNode * getNode()
Get the associated SgNode, can be SgPragmaDeclaration or others( for fortran nodes or during parallel...
OwnershipPolicy
Who owns this attribute.
virtual OwnershipPolicy getOwnershipPolicy() const override
Who owns this attribute.
This class represents the notion of a declared variable.
omp_construct_enum getEndOmpConstructEnum(omp_construct_enum begin_enum)
Get the corresponding end construct enum from a begin construct enum.
ROSE_DLL_API bool isEquivalentOmpAttribute(OmpAttribute *a1, OmpAttribute *a2)
Check if two OmpAttributes are semantically equivalent to each other.
ROSE_DLL_API OmpAttributeList * getOmpAttributeList(SgNode *node)
Get OmpAttribute from a SgNode, return NULL if not found.
OmpAttribute * getOmpAttribute(SgNode *node)
Get the first OmpAttribute from a SgNode, return NULL if not found.
omp_construct_enum getBeginOmpConstructEnum(omp_construct_enum end_enum)
Get the corresponding begin construct enum from an end construct enum.
This class represents the notion of an expression. Expressions are derived from SgLocatedNodes, since similar to statement, expressions have a concrete location within the user's source code.
bool isFortranBeginDirective(omp_construct_enum omp_type)
Check if the construct is a Fortran directive which can (optionally) have a corresponding END directi...
bool isReductionOperator(omp_construct_enum omp_type)
Check if an OpenMP construct is a reduction operator.
bool isClause(omp_construct_enum omp_type)
Check if an OpenMP construct is a clause.
bool isDependenceType(omp_construct_enum omp_type)
Check if an OpenMP construct is a dependence type for omp task depend.
ROSE_DLL_API void generatePragmaFromOmpAttribute(SgNode *sg_node)
Generate a pragma declaration from OmpAttribute attached to a statement.
Base class for all IR node attribute values.
One attribute object stores all information within an OpenMP pragma (directive and clauses) ...
ROSE_DLL_API OmpAttribute * buildOmpAttribute(enum omp_construct_enum directive_type, SgNode *context_node, bool useDefined)
Some utility functions to manipulate OmpAttribute.
This class represents the base class for all IR nodes within Sage III.
This class represents the concept of a variable name within the compiler (a shared container for the ...
bool isDirective(omp_construct_enum omp_type)
Check if an OpenMP construct is a directive.
For preprocessing information including source comments, include , if, define, etc.
ROSE_DLL_API bool hasClause(SgOmpClauseBodyStatement *clause_stmt, const VariantT &vt)
Check if an OpenMP statement has a clause of type vt.
This class represents the concept of a C Assembler statement (untested).
bool isFortranEndDirective(omp_construct_enum omp_type)
Check if the construct is a Fortran END ... directive.
ROSE_DLL_API void removeOmpAttribute(OmpAttribute *ompattribute, SgNode *node)
Remove OmpAttribute from a SgNode.
This class represents the notion of an expression or statement which has a position within the source...
PreprocessingInfo * getPreprocessingInfo()
Get the associated PreprocessingInfo for Fortran, if any.
Types and functions to support OpenMP.
std::string toString(omp_construct_enum omp_type)
Output omp_construct_enum to a string:
ROSE_DLL_API void addOmpAttribute(OmpAttribute *ompattribute, SgNode *node)
Add OmpAttribute to a SgNode.
omp_construct_enum getOmpConstructEnum(SgPragmaDeclaration *decl)
Get omp enum from an OpenMP pragma attached with OmpAttribute.
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]) ...
void setOmpDirectiveType(omp_construct_enum omptype)
---------—directive type----—
ROSE_DLL_API std::string generateDiffTextFromOmpAttribute(SgNode *sg_node)
Generate diff text from OmpAttribute attached to a statement.