[Mlir-commits] [mlir] Unify handling of operations which are emitted in a deferred way (PR #97804)
Gil Rapaport
llvmlistbot at llvm.org
Fri Jul 5 13:09:01 PDT 2024
================
@@ -1498,24 +1509,25 @@ LogicalResult CppEmitter::emitOperation(Operation &op, bool trailingSemicolon) {
emitc::CallOpaqueOp, emitc::CastOp, emitc::CmpOp,
emitc::ConditionalOp, emitc::ConstantOp, emitc::DeclareFuncOp,
emitc::DivOp, emitc::ExpressionOp, emitc::ForOp, emitc::FuncOp,
- emitc::GlobalOp, emitc::GetGlobalOp, emitc::IfOp,
- emitc::IncludeOp, emitc::LogicalAndOp, emitc::LogicalNotOp,
- emitc::LogicalOrOp, emitc::MulOp, emitc::RemOp, emitc::ReturnOp,
- emitc::SubOp, emitc::SubscriptOp, emitc::UnaryMinusOp,
- emitc::UnaryPlusOp, emitc::VariableOp, emitc::VerbatimOp>(
+ emitc::GlobalOp, emitc::IfOp, emitc::IncludeOp,
+ emitc::LogicalAndOp, emitc::LogicalNotOp, emitc::LogicalOrOp,
+ emitc::MulOp, emitc::RemOp, emitc::ReturnOp, emitc::SubOp,
+ emitc::UnaryMinusOp, emitc::UnaryPlusOp, emitc::VariableOp,
+ emitc::VerbatimOp>(
[&](auto op) { return printOperation(*this, op); })
// Func ops.
.Case<func::CallOp, func::FuncOp, func::ReturnOp>(
[&](auto op) { return printOperation(*this, op); })
- .Case<emitc::LiteralOp>([&](auto op) { return success(); })
+ .Case<emitc::GetGlobalOp, emitc::LiteralOp, emitc::SubscriptOp>(
+ [&](Operation *op) { return cacheDeferredOpResult(op); })
----------------
aniragil wrote:
```suggestion
.Case<emitc::GetGlobalOp>(
[&](auto op) { return cacheDeferredOpResult(op.getResult(), op.getName().str()); })
.Case<emitc::LiteralOp>(
[&](auto op) { return cacheDeferredOpResult(op.getResult(), op.getValue().str()); })
.Case<emitc::SubscriptOp>(
[&](auto op) { return cacheDeferredOpResult(op.getResult(), getSubscriptName(subscript)); })
```
https://github.com/llvm/llvm-project/pull/97804
More information about the Mlir-commits
mailing list