21 #define GEN_PASS_DEF_FORMEXPRESSIONS
22 #include "mlir/Dialect/EmitC/Transforms/Passes.h.inc"
27 using namespace emitc;
30 struct FormExpressionsPass
31 :
public emitc::impl::FormExpressionsBase<FormExpressionsPass> {
32 void runOnOperation()
override {
40 !op->getParentOfType<emitc::ExpressionOp>() &&
41 op->getNumResults() == 1)
44 rootOp->
walk(matchFun);
51 return signalPassFailure();
55 registry.
insert<emitc::EmitCDialect>();
61 return std::make_unique<FormExpressionsPass>();
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
MLIRContext is the top-level object for a collection of MLIR operations.
This class helps build Operations.
Operation is the basic unit of execution within MLIR.
std::enable_if_t< llvm::function_traits< std::decay_t< FnT > >::num_args==1, RetT > walk(FnT &&callback)
Walk the operation by calling the callback for each nested operation (including this one),...
MLIRContext * getContext()
Return the context this operation is associated with.
std::unique_ptr< Pass > createFormExpressionsPass()
Creates an instance of the C-style expressions forming pass.
void populateExpressionPatterns(RewritePatternSet &patterns)
Populates patterns with expression-related patterns.
ExpressionOp createExpression(Operation *op, OpBuilder &builder)
Include the generated interface declarations.
LogicalResult applyPatternsAndFoldGreedily(Region ®ion, const FrozenRewritePatternSet &patterns, GreedyRewriteConfig config=GreedyRewriteConfig(), bool *changed=nullptr)
Rewrite ops in the given region, which must be isolated from above, by repeatedly applying the highes...