Skip to content

OmpSupport

Types and functions to support OpenMP

Description

OpenMP specific data types and functions are put into this namespace

Types

Name Description
ClauseVariableCopyIdentity Exact identities produced when an outlined OpenMP clause-variable record is transferred through one deep-copy transaction.
ComplexClause
OpenMPConversionSession
OpenMPConversionSessionAccess

Type Aliases

Name
VariableSymbolMap_t

Enums

Name Description
AssociatedLoopPathContract Typed allowlists for the structural path from an OpenMP directive's exact body edge to its associated loop. Worksharing and SIMD constructs permit only transparent singleton basic blocks. Loop transformations additionally permit nested, supported loop-transformation directives; semantic OpenMP regions and attributed statements are never transparent wrappers.
omp_construct_enum

Functions

Name Description
addClauseVariable
[[visibility("default")]] void addClauseVariable( SgInitializedName* var, SgOmpClauseBodyStatement* clause_stmt, VariantT const& vt);
Add a variable into a non-reduction clause of an OpenMP statement, create the clause transparently if it does not exist
addGeneratedOmpClause
void addGeneratedOmpClause( SgStatement* node, SgOmpClause* clause);
Attach a transformation-generated OpenMP clause, assigning exact source-order provenance when the directive came from combined syntax.
addOmpClause
void addOmpClause( SgStatement* node, SgOmpClause* clause);
Attach an OpenMP clause to directive
analyze_omp
void analyze_omp(SgSourceFile*);
beginOpenACCCxxExactSemanticConsumption
void beginOpenACCCxxExactSemanticConsumption(SgPragmaDeclaration* pragma);
beginOpenACCCxxExactSemanticExpression
void beginOpenACCCxxExactSemanticExpression( SgPragmaDeclaration* pragma, std::string const& expression, OpenMPExprParseMode parse_mode);
beginOpenACCFortranExactSemanticConsumption
void beginOpenACCFortranExactSemanticConsumption(SgPragmaDeclaration* pragma);
beginOpenACCFortranExactSemanticExpression
void beginOpenACCFortranExactSemanticExpression( SgPragmaDeclaration* pragma, std::string const& expression);
buildAndInsertDeclarationForOmp
SgVariableDeclaration* buildAndInsertDeclarationForOmp( std::string const& 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
buildFortranOutlinedFunctionRef
SgFunctionRefExp* buildFortranOutlinedFunctionRef(SgFunctionDeclaration* declaration);
Build a reference to a generated Fortran outlined procedure through its exact semantic-only publication.
buildOmpVariableClause
[[visibility("default")]] SgOmpVariablesClause* buildOmpVariableClause( SgOmpClauseBodyStatement* clause_stmt, VariantT const& vt);
Build a non-reduction variable clause for a given OpenMP directive. It directly returns the clause if the clause already exists
clearImplicitTargetMapVariables
[[visibility("default")]] void clearImplicitTargetMapVariables();
collectAllClauseVariables
[[visibility("default")]] SgInitializedNamePtrList collectAllClauseVariables(SgStatement* clause_stmt);
Collect all variables from OpenMP clauses associated with an omp statement: private, reduction, etc
collectClauseVariables
[[visibility("default")]] SgInitializedNamePtrList collectClauseVariables( SgStatement* clause_stmt, VariantT const& vt);
collectClauseVariables overloads
collectThreadprivateVariables
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
commandLineProcessing
void commandLineProcessing(std::vector<std::string>& argvList);
consumeOpenACCFortranExactSemanticEnd
void consumeOpenACCFortranExactSemanticEnd(SgPragmaDeclaration* pragma);
consumeOpenACCFortranExactSemanticSyntax
void consumeOpenACCFortranExactSemanticSyntax( SgPragmaDeclaration* pragma, std::string const& spelling);
createInitialValueExp
[[visibility("default")]] SgExpression* createInitialValueExp(SgOmpClause::omp_reduction_identifier_enum r_operator);
Create an initial value according to reduction operator type
createOmpStatementTree
void createOmpStatementTree(SgSourceFile* file);
Analysis helpers
discardOpenMPProducerSemanticRecords
void discardOpenMPProducerSemanticRecords(SgSourceFile* source_file);
endOpenACCCxxExactSemanticExpression
void endOpenACCCxxExactSemanticExpression(SgPragmaDeclaration* pragma);
endOpenACCFortranExactSemanticExpression
void endOpenACCFortranExactSemanticExpression(SgPragmaDeclaration* pragma);
finishOpenACCCxxExactSemanticConsumption
void finishOpenACCCxxExactSemanticConsumption(SgPragmaDeclaration* pragma);
finishOpenACCFortranExactSemanticConsumption
void finishOpenACCFortranExactSemanticConsumption(SgPragmaDeclaration* pragma);
generateOutlinedTask
SgFunctionDeclaration* generateOutlinedTask( SgNode* node, std::string& wrapper_name, ASTtools::VarSymSet_t& syms, ASTtools::VarSymSet_t& pdSyms3, bool insert_runtime_ids = true);
A helper function to generate implicit or explicit task for either omp parallel or omp task
getClause
[[visibility("default")]] std::vector<SgOmpClause*> getClause( SgStatement* clause_stmt, VariantT const& vt);
Get OpenMP clauses from an eligible OpenMP statement
getClauseExpression
[[visibility("default")]] SgExpression* getClauseExpression( SgStatement* clause_stmt, VariantVector const& vvt);
Collect expression from given types of OpenMP clauses associated with an omp statement: private, reduction, etc
getDataSharingAttribute
[[visibility("default")]] omp_construct_enum getDataSharingAttribute(SgVarRefExp* varRef);
getDataSharingAttribute overloads
getEnclosingRegionOrFuncDefinition
SgBasicBlock* getEnclosingRegionOrFuncDefinition(SgNode*);
Find an enclosing parallel region or function definition's body
getKmpcRuntimeFunctionName
std::string getKmpcRuntimeFunctionName(std::string const& abiName);
Return the exact source-language identifier for one LLVM OpenMP runtime entry point. C/C++ use the ABI spelling directly; Fortran uses the standards-conforming REX adapter spelling exported by kmpc_fortran_wrappers.c. Non-__kmpc names are contract violations.
getOmpClauseList
SgOmpClauseList* getOmpClauseList(SgStatement* node);
getOmpParent
SgStatement* getOmpParent(SgStatement* node);
getOpenMPMergedEndClauseSource
std::string const& getOpenMPMergedEndClauseSource(OpenMPClause const* clause);
getReductionOperationType
[[visibility("default")]] SgOmpClause::omp_reduction_identifier_enum getReductionOperationType( SgInitializedName* init_name, SgOmpClauseBodyStatement* clause_stmt);
Return a reduction variable's reduction operation type
hasClause
[[visibility("default")]] bool hasClause( SgStatement* clause_stmt, VariantT const& vt);
Check if an OpenMP statement has a clause of type vt
initializeTaskDataEnvironment
void initializeTaskDataEnvironment( SgOmpTaskStatement* task, SgOmpClauseBodyStatement* source_context, std::vector<SgInitializedName*> const& generated_firstprivate, std::vector<SgInitializedName*> const& generated_private);
insertAcceleratorInit
void insertAcceleratorInit(SgSourceFile*);
insertRTLHeaders
void insertRTLHeaders(SgSourceFile*);
Insert #include "xxx.h", the interface of a runtime library to the compiler
isClause
bool isClause(omp_construct_enum omp_type);
Check if an OpenMP construct is a clause
isDependenceType
bool isDependenceType(omp_construct_enum omp_type);
Check if an OpenMP construct is a dependence type for omp task depend
isDirective
bool isDirective(omp_construct_enum omp_type);
Check if an OpenMP construct is a directive
isDirectiveWithBody
bool isDirectiveWithBody(omp_construct_enum omp_type);
Check if an OpenMP directive has a structured body
isFortranBeginDirective
bool isFortranBeginDirective(omp_construct_enum omp_type);
Check if the construct is a Fortran directive which can (optionally) have a corresponding END directive
isFortranEndDirective
bool isFortranEndDirective(omp_construct_enum omp_type);
Check if the construct is a Fortran END ... directive
isImplicitTargetMapVariable
[[visibility("default")]] bool isImplicitTargetMapVariable( SgOmpClauseBodyStatement const* target, SgSymbol const* sym);
isInClauseVariableList
[[visibility("default")]] bool isInClauseVariableList( SgInitializedName* var, SgOmpClauseBodyStatement* clause_stmt, VariantT const& vt);
isInClauseVariableList overloads
isInOmpTargetRegion
bool isInOmpTargetRegion(SgStatement* node);
Check whether a SgNode is inside omp target
isOmpContextSelectorMetadataDirective
bool isOmpContextSelectorMetadataDirective(SgNode const*);
Return true when an OpenMP statement is a syntax-only construct selector owned by a MATCH/WHEN clause rather than an executable AST statement.
isOpenMPMergedEndClause
bool isOpenMPMergedEndClause(OpenMPClause const* clause);
isReductionOperator
bool isReductionOperator(omp_construct_enum omp_type);
Check if an OpenMP construct is a reduction operator
isSharedAccess
[[visibility("default")]] bool isSharedAccess(SgVarRefExp* varRef);
Check if a variable access is a shared access , assuming it is already within an OpenMP region.
isThreadprivate
[[visibility("default")]] bool isThreadprivate(SgSymbol* var);
Check if a variable is a threadprivate variable. It will search for all threadprivate directives to find the answer.
lower_omp
void lower_omp(SgSourceFile*);
The top level interface to translate OpenMP directives
markImplicitTargetMapVariable
[[visibility("default")]] void markImplicitTargetMapVariable( SgOmpClauseBodyStatement* target, SgInitializedName* var);
markOpenMPMergedEndClause
void markOpenMPMergedEndClause( OpenMPClause* clause, std::string const& source_text);
mergeSgNodeList
std::vector<SgNode*> mergeSgNodeList( std::vector<SgNode*> node_list1, std::vector<SgNode*> node_list2);
openMPExpressionVariables
std::vector<SgNode*>& openMPExpressionVariables();
patchUpPrivateVariables
[[visibility("default")]] int patchUpPrivateVariables(SgFile*);
patchUpPrivateVariables overloads
prepareSourceForOpenMPTransformation
void prepareSourceForOpenMPTransformation(SgNode*);
Prepare the exact written directive/body surfaces before an actual lowering operation changes them. Direct transformation APIs use the same boundary as the lowering driver; unrelated source inclusions remain retained.
processOpenMP
void processOpenMP(SgSourceFile*& sageFilePtr);
registerOpenACCCxxExactSemanticBindings
void registerOpenACCCxxExactSemanticBindings( SgSourceFile* source_file, SgPragmaDeclaration* pragma, OpenACCCxxExactSemanticBindings bindings);
registerOpenMPFortranExactSemanticBindings
void registerOpenMPFortranExactSemanticBindings( SgSourceFile* source_file, SgPragmaDeclaration* pragma, OmpFortranExactSemanticBindings bindings);
registerOpenMPProducerSemanticRecords
void registerOpenMPProducerSemanticRecords( SgSourceFile* source_file, SgPragmaDeclaration* pragma, OpenMPProducerSemanticRecords records);
removeClause
[[visibility("default")]] int removeClause( SgStatement* clause_stmt, VariantT const& vt);
Remove one or more clauses of type vt
replaceVariableReferences
[[visibility("default")]] int replaceVariableReferences( SgNode* root, VariableSymbolMap_t varRemap);
replaceVariableReferences overloads
replaceVariablesWithPointerDereference
int replaceVariablesWithPointerDereference( SgNode* root, std::set<SgVariableSymbol*>& vars);
Replace all variable references in a set by pointers to the variable
requireExactAssociatedForLoop
SgForStatement* requireExactAssociatedForLoop( SgOmpBodyStatement* directive, SgStatement* expected_root, AssociatedLoopPathContract path_contract, char const* contract);
requireExactAssociatedLoop
SgStatement* requireExactAssociatedLoop( SgOmpBodyStatement* directive, SgStatement* expected_root, AssociatedLoopPathContract path_contract, char const* contract);
Return the one exact loop owned by directive through expected_root. Every structural edge must be unique and parent-consistent, and every wrapper must be admitted by path_contract. Malformed, ambiguous, cyclic, attributed, or semantically different wrapper paths are hard errors.
requireExactClauseVariableCopyIdentity
[[visibility("default")]] ClauseVariableCopyIdentity requireExactClauseVariableCopyIdentity( SgCopyHelp::copiedNodeMapType const& identityMap, SgOmpExecStatement* originalDirective, SgInitializedName* originalClauseVariable, SgVariableSymbol* originalBackingSymbol);
Resolve one original directive, all of the clause variable's exact expression identities, and its pointer-backing symbol through the deep-copy identity map. The copied clause expressions must agree on exactly one symbol/declaration. Missing, identity, ambiguous, or wrongly typed mappings are hard errors; spelling and scope lookup are never used.
requireExactIntegralConstantExpression
void requireExactIntegralConstantExpression( SgExpression* expression, char const* contract);
Require expression to be one language-valid target-ABI integral constant expression. This is a proof-only API: every runtime expression is a hard contract violation.
requireExactPositiveIntegralConstant
unsigned long long requireExactPositiveIntegralConstant( SgExpression* expression, unsigned long long maximum, char const* contract);
Evaluate a language-valid, target-ABI integral constant and require it to be in [1, maximum]. Unsupported, malformed, volatile, cyclic, or undefined constant expressions are hard errors; no textual parsing or fallback value is permitted.
requireFortranDirectiveSemanticProducer
void requireFortranDirectiveSemanticProducer( SgPragmaDeclaration* pragma, OmpFortranExactSemanticBindings::Producer producer, char const* operation, SgPragmaDeclaration::fortran_directive_family_enum expected_family = SgPragmaDeclaration::e_fortran_directive_none);
requireOpenMPConversionSession
void requireOpenMPConversionSession();
retireConsumedOmpDirective
void retireConsumedOmpDirective(SgStatement* directive);
setOmpRelationship
void setOmpRelationship( SgStatement* parent, SgStatement* child);
snapshotOpenMPProducerSemanticRecords
OpenMPProducerSemanticRecords snapshotOpenMPProducerSemanticRecords(SgPragmaDeclaration* pragma);
toString
std::string toString(omp_construct_enum omp_type);
toString overloads
transOmpAtomic
void transOmpAtomic(SgNode* node);
Translate omp atomic
transOmpBarrier
void transOmpBarrier(SgNode* node);
Translate omp barrier
transOmpCollapse
void transOmpCollapse(SgStatement* node);
transOmpCritical
void transOmpCritical(SgNode* node);
Translate omp critical
transOmpFlush
void transOmpFlush(SgNode* node);
Translate omp flush
transOmpLoop
void transOmpLoop(SgNode* node);
Translate omp for or omp do loops
transOmpMaster
void transOmpMaster(SgNode* node);
Translate omp master
transOmpMetadirective
void transOmpMetadirective(SgNode* node);
Translate omp metadirective
transOmpOrdered
void transOmpOrdered(SgNode* node);
Translate the ordered directive (not the ordered clause)
transOmpParallel
void transOmpParallel(SgNode* node);
Translate omp parallel
transOmpSections
void transOmpSections(SgNode* node);
Translate omp sections
transOmpSimd
void transOmpSimd(SgNode* node);
Translate omp simd
transOmpSingle
void transOmpSingle(SgNode* node);
Translate omp single
transOmpTarget
void transOmpTarget(SgNode* node);
Translate "omp target"
transOmpTargetData
void transOmpTargetData(SgNode* node);
Translate "omp target data"
transOmpTargetParallel
void transOmpTargetParallel(SgNode* node);
Translate omp parallel under "omp target"
transOmpTask
void transOmpTask(SgNode* node);
Translate omp task
transOmpTaskgroup
void transOmpTaskgroup(SgNode* node);
transOmpTaskloop
void transOmpTaskloop(SgNode* node);
transOmpTaskwait
void transOmpTaskwait(SgNode* node);
Translate omp taskwait
transOmpThreadprivate
void transOmpThreadprivate(SgNode* node);
Translate omp threadprivate
transOmpTile
void transOmpTile(SgNode* node);
Translate omp tile
transOmpUnroll
void transOmpUnroll(SgNode* node);
Translate omp unroll
transOmpVariables
[[visibility("default")]] 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
useStaticSchedule
[[visibility("default")]] bool useStaticSchedule(SgOmpClauseBodyStatement* omp_loop);
Check if an omp for/do loop use static schedule or not, including: default schedule, or schedule(static[,chunk_size])

Variables

Name
cur_omp_directive
enable_accelerator
nCounter

Created with MrDocs