24#define GEN_PASS_DEF_FUNCTIONFILTERINGPASS
25#include "mlir/Dialect/OpenMP/Transforms/Passes.h.inc"
34class FunctionFilteringPass
39 if (!op || !op.getIsTargetDevice())
47 bool hasTargetRegion =
54 omp::DeclareTargetDeviceType declareType =
55 omp::DeclareTargetDeviceType::host;
56 auto declareTargetOp =
57 dyn_cast<omp::DeclareTargetInterface>(funcOp.getOperation());
58 omp::DeclareTargetAttr declareTargetAttr =
59 declareTargetOp ? declareTargetOp.getDeclareTarget() :
nullptr;
60 if (declareTargetAttr)
61 declareType = declareTargetAttr.getDeviceType();
65 if (declareType != omp::DeclareTargetDeviceType::host)
75 if (isa<FunctionOpInterface>(callOp))
84 opBuilder.setInsertionPoint(callOp);
85 poisonResults.emplace_back(
86 LLVM::PoisonOp::create(opBuilder, res.getLoc(), res.getType()));
94 if (!hasTargetRegion) {
103 if (declareTargetOp && !declareTargetAttr)
104 declareTargetOp.setDeclareTarget(omp::DeclareTargetDeviceType::host,
105 omp::DeclareTargetCaptureClause::to,
This class helps build Operations.
OpT getOperation()
Return the current operation being transformed.
Operation is the basic unit of execution within MLIR.
bool use_empty()
Returns true if this operation has no uses.
void replaceAllUsesWith(ValuesT &&values)
Replace all uses of results of this operation with the provided 'values'.
result_range getResults()
void erase()
Remove this operation from its parent block and delete it.
virtual void runOnOperation()=0
The polymorphic API that runs the pass over the currently held operation.
This class represents a specific symbol use.
This class implements a range of SymbolRef uses.
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
static WalkResult advance()
static WalkResult interrupt()
Include the generated interface declarations.