#include "mlir/Conversion/PDLToPDLInterp/PDLToPDLInterp.h"
#include "PredicateTree.h"
#include "mlir/Dialect/PDL/IR/PDL.h"
#include "mlir/Dialect/PDL/IR/PDLTypes.h"
#include "mlir/Dialect/PDLInterp/IR/PDLInterp.h"
#include "mlir/Pass/Pass.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/ScopedHashTable.h"
#include "llvm/ADT/Sequence.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/TypeSwitch.h"
namespace mlir {
#define GEN_PASS_DEF_CONVERTPDLTOPDLINTERP
#include "mlir/Conversion/Passes.h.inc"
}
usingnamespacemlir;
usingnamespacemlir::pdl_to_pdl_interp;
namespace {
struct PatternLowering { … };
}
PatternLowering::PatternLowering(
pdl_interp::FuncOp matcherFunc, ModuleOp rewriterModule,
DenseMap<Operation *, PDLPatternConfigSet *> *configMap)
: … { … }
void PatternLowering::lower(ModuleOp module) { … }
Block *PatternLowering::generateMatcher(MatcherNode &node, Region ®ion,
Block *block) { … }
Value PatternLowering::getValueAt(Block *¤tBlock, Position *pos) { … }
void PatternLowering::generate(BoolNode *boolNode, Block *¤tBlock,
Value val) { … }
template <typename OpT, typename PredT, typename ValT = typename PredT::KeyTy>
static void createSwitchOp(Value val, Block *defaultDest, OpBuilder &builder,
llvm::MapVector<Qualifier *, Block *> &dests) { … }
void PatternLowering::generate(SwitchNode *switchNode, Block *currentBlock,
Value val) { … }
void PatternLowering::generate(SuccessNode *successNode, Block *¤tBlock) { … }
SymbolRefAttr PatternLowering::generateRewriter(
pdl::PatternOp pattern, SmallVectorImpl<Position *> &usedMatchValues) { … }
void PatternLowering::generateRewriter(
pdl::ApplyNativeRewriteOp rewriteOp, DenseMap<Value, Value> &rewriteValues,
function_ref<Value(Value)> mapRewriteValue) { … }
void PatternLowering::generateRewriter(
pdl::AttributeOp attrOp, DenseMap<Value, Value> &rewriteValues,
function_ref<Value(Value)> mapRewriteValue) { … }
void PatternLowering::generateRewriter(
pdl::EraseOp eraseOp, DenseMap<Value, Value> &rewriteValues,
function_ref<Value(Value)> mapRewriteValue) { … }
void PatternLowering::generateRewriter(
pdl::OperationOp operationOp, DenseMap<Value, Value> &rewriteValues,
function_ref<Value(Value)> mapRewriteValue) { … }
void PatternLowering::generateRewriter(
pdl::RangeOp rangeOp, DenseMap<Value, Value> &rewriteValues,
function_ref<Value(Value)> mapRewriteValue) { … }
void PatternLowering::generateRewriter(
pdl::ReplaceOp replaceOp, DenseMap<Value, Value> &rewriteValues,
function_ref<Value(Value)> mapRewriteValue) { … }
void PatternLowering::generateRewriter(
pdl::ResultOp resultOp, DenseMap<Value, Value> &rewriteValues,
function_ref<Value(Value)> mapRewriteValue) { … }
void PatternLowering::generateRewriter(
pdl::ResultsOp resultOp, DenseMap<Value, Value> &rewriteValues,
function_ref<Value(Value)> mapRewriteValue) { … }
void PatternLowering::generateRewriter(
pdl::TypeOp typeOp, DenseMap<Value, Value> &rewriteValues,
function_ref<Value(Value)> mapRewriteValue) { … }
void PatternLowering::generateRewriter(
pdl::TypesOp typeOp, DenseMap<Value, Value> &rewriteValues,
function_ref<Value(Value)> mapRewriteValue) { … }
void PatternLowering::generateOperationResultTypeRewriter(
pdl::OperationOp op, function_ref<Value(Value)> mapRewriteValue,
SmallVectorImpl<Value> &types, DenseMap<Value, Value> &rewriteValues,
bool &hasInferredResultTypes) { … }
namespace {
struct PDLToPDLInterpPass
: public impl::ConvertPDLToPDLInterpBase<PDLToPDLInterpPass> { … };
}
void PDLToPDLInterpPass::runOnOperation() { … }
std::unique_ptr<OperationPass<ModuleOp>> mlir::createPDLToPDLInterpPass() { … }
std::unique_ptr<OperationPass<ModuleOp>> mlir::createPDLToPDLInterpPass(
DenseMap<Operation *, PDLPatternConfigSet *> &configMap) { … }