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 {
43 rootOp->
walk(matchFun);
50 return signalPassFailure();
54 registry.
insert<emitc::EmitCDialect>();
60 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.
bool hasTrait()
Returns true if the operation was registered with a particular trait, e.g.
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.
OpTy getParentOfType()
Return the closest surrounding parent operation that is of type 'OpTy'.
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...
bool failed(LogicalResult result)
Utility function that returns true if the provided LogicalResult corresponds to a failure value.