11#include "llvm/Support/InterleavedRange.h"
21 os <<
"<NULL-PDLValue>";
26 os << cast<Attribute>();
29 os << *cast<Operation *>();
35 os << llvm::interleaved(cast<TypeRange>());
40 case Kind::ValueRange:
41 os << llvm::interleaved(cast<ValueRange>());
63 case Kind::ValueRange:
73void PDLPatternModule::mergeIn(PDLPatternModule &&other) {
79 for (
auto &it : other.constraintFunctions)
80 registerConstraintFunction(it.first(), std::move(it.second));
81 for (
auto &it : other.rewriteFunctions)
82 registerRewriteFunction(it.first(), std::move(it.second));
83 for (
auto &it : other.configs)
84 configs.emplace_back(std::move(it));
85 configMap.insert_range(other.configMap);
89 pdlModule = std::move(other.pdlModule);
94 Block *block = pdlModule->getBody();
96 other.pdlModule->getBody()->getOperations());
99void PDLPatternModule::attachConfigToPatterns(ModuleOp module,
100 PDLPatternConfigSet &configSet) {
105 module->walk([&](Operation *op) {
106 if (op->hasTrait<SymbolOpInterface::Trait>())
107 configMap[op] = &configSet;
115void PDLPatternModule::registerConstraintFunction(
116 StringRef name, PDLConstraintFunction constraintFn) {
121 constraintFunctions.try_emplace(name, std::move(constraintFn));
124void PDLPatternModule::registerRewriteFunction(StringRef name,
125 PDLRewriteFunction rewriteFn) {
130 rewriteFunctions.try_emplace(name, std::move(rewriteFn));
OpListType & getOperations()
Include the generated interface declarations.