MLIR 24.0.0git
MarkDeclareTarget.cpp File Reference
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
#include "mlir/IR/Operation.h"
#include "mlir/IR/SymbolTable.h"
#include "mlir/Interfaces/FunctionInterfaces.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Support/LLVM.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/TypeSwitch.h"
#include "mlir/Dialect/OpenMP/Transforms/Passes.h.inc"

Go to the source code of this file.

Classes

class  mlir::omp::impl::MarkDeclareTargetPassBase< DerivedT >

Namespaces

namespace  mlir
 Include the generated interface declarations.
namespace  mlir::omp
namespace  mlir::omp::impl

Macros

#define GEN_PASS_DEF_MARKDECLARETARGETPASS

Functions

std::unique_ptr<::mlir::Passmlir::omp::impl::createMarkDeclareTargetPass ()
std::unique_ptr<::mlir::Passmlir::omp::createMarkDeclareTargetPass ()
static bool isInTargetRegion (Operation &op)
 Check whether the given operation is located inside of an omp.target.
static void gatherNestedCallees (Operation &op, llvm::StringSet<> &callees, llvm::StringSet<> *targetCallees=nullptr)
 Add to callees all names of the functions called from regions owned by op.
static void gatherSymsFromAttr (ArrayAttr arrayAttr, llvm::StringSet<> &syms)
 Extract from arrayAttr and into syms the list of symbol names stored in the attribute.
static void gatherNestedSymbolUses (Operation &op, llvm::StringSet<> &nestedRecipeUses, llvm::StringSet<> &targetRecipeUses, llvm::StringSet<> &nestedFunctionUses, llvm::StringSet<> &targetFunctionUses)
 Go through all OpenMP dialect operations located in regions owned by op looking for symbol references to accomp::RecipeInterface or FunctionOpInterface operations and, based on whether they are located within a nested omp.target region, add them to the corresponding output StringSet.

Macro Definition Documentation

◆ GEN_PASS_DEF_MARKDECLARETARGETPASS

#define GEN_PASS_DEF_MARKDECLARETARGETPASS

Definition at line 26 of file MarkDeclareTarget.cpp.

Function Documentation

◆ gatherNestedCallees()

void gatherNestedCallees ( Operation & op,
llvm::StringSet<> & callees,
llvm::StringSet<> * targetCallees = nullptr )
static

Add to callees all names of the functions called from regions owned by op.

If targetCallees is provided, split non-target and target uses between these two output sets.

Definition at line 46 of file MarkDeclareTarget.cpp.

References isInTargetRegion(), and mlir::Operation::walk().

◆ gatherNestedSymbolUses()

void gatherNestedSymbolUses ( Operation & op,
llvm::StringSet<> & nestedRecipeUses,
llvm::StringSet<> & targetRecipeUses,
llvm::StringSet<> & nestedFunctionUses,
llvm::StringSet<> & targetFunctionUses )
static

Go through all OpenMP dialect operations located in regions owned by op looking for symbol references to accomp::RecipeInterface or FunctionOpInterface operations and, based on whether they are located within a nested omp.target region, add them to the corresponding output StringSet.

Definition at line 76 of file MarkDeclareTarget.cpp.

References gatherSymsFromAttr(), isInTargetRegion(), and mlir::Operation::walk().

◆ gatherSymsFromAttr()

void gatherSymsFromAttr ( ArrayAttr arrayAttr,
llvm::StringSet<> & syms )
static

Extract from arrayAttr and into syms the list of symbol names stored in the attribute.

Definition at line 62 of file MarkDeclareTarget.cpp.

References ArrayAttr().

Referenced by gatherNestedSymbolUses().

◆ isInTargetRegion()

bool isInTargetRegion ( Operation & op)
static

Check whether the given operation is located inside of an omp.target.

Definition at line 35 of file MarkDeclareTarget.cpp.

References mlir::Operation::getParentOfType().

Referenced by gatherNestedCallees(), and gatherNestedSymbolUses().