aboutsummaryrefslogtreecommitdiff
path: root/mlir/lib/Target/Cpp/TranslateToCpp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/lib/Target/Cpp/TranslateToCpp.cpp')
-rw-r--r--mlir/lib/Target/Cpp/TranslateToCpp.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/mlir/lib/Target/Cpp/TranslateToCpp.cpp b/mlir/lib/Target/Cpp/TranslateToCpp.cpp
index 291624c..1b4ec9e 100644
--- a/mlir/lib/Target/Cpp/TranslateToCpp.cpp
+++ b/mlir/lib/Target/Cpp/TranslateToCpp.cpp
@@ -412,13 +412,14 @@ static LogicalResult printOperation(CppEmitter &emitter, func::CallOp callOp) {
return success();
}
-static LogicalResult printOperation(CppEmitter &emitter, emitc::CallOp callOp) {
+static LogicalResult printOperation(CppEmitter &emitter,
+ emitc::CallOpaqueOp callOpaqueOp) {
raw_ostream &os = emitter.ostream();
- Operation &op = *callOp.getOperation();
+ Operation &op = *callOpaqueOp.getOperation();
if (failed(emitter.emitAssignPrefix(op)))
return failure();
- os << callOp.getCallee();
+ os << callOpaqueOp.getCallee();
auto emitArgs = [&](Attribute attr) -> LogicalResult {
if (auto t = dyn_cast<IntegerAttr>(attr)) {
@@ -441,10 +442,10 @@ static LogicalResult printOperation(CppEmitter &emitter, emitc::CallOp callOp) {
return success();
};
- if (callOp.getTemplateArgs()) {
+ if (callOpaqueOp.getTemplateArgs()) {
os << "<";
- if (failed(
- interleaveCommaWithError(*callOp.getTemplateArgs(), os, emitArgs)))
+ if (failed(interleaveCommaWithError(*callOpaqueOp.getTemplateArgs(), os,
+ emitArgs)))
return failure();
os << ">";
}
@@ -452,8 +453,8 @@ static LogicalResult printOperation(CppEmitter &emitter, emitc::CallOp callOp) {
os << "(";
LogicalResult emittedArgs =
- callOp.getArgs()
- ? interleaveCommaWithError(*callOp.getArgs(), os, emitArgs)
+ callOpaqueOp.getArgs()
+ ? interleaveCommaWithError(*callOpaqueOp.getArgs(), os, emitArgs)
: emitter.emitOperands(op);
if (failed(emittedArgs))
return failure();
@@ -949,10 +950,11 @@ LogicalResult CppEmitter::emitOperation(Operation &op, bool trailingSemicolon) {
.Case<cf::BranchOp, cf::CondBranchOp>(
[&](auto op) { return printOperation(*this, op); })
// EmitC ops.
- .Case<emitc::AddOp, emitc::ApplyOp, emitc::AssignOp, emitc::CallOp,
- emitc::CastOp, emitc::CmpOp, emitc::ConstantOp, emitc::DivOp,
- emitc::ForOp, emitc::IfOp, emitc::IncludeOp, emitc::MulOp,
- emitc::RemOp, emitc::SubOp, emitc::VariableOp>(
+ .Case<emitc::AddOp, emitc::ApplyOp, emitc::AssignOp,
+ emitc::CallOpaqueOp, emitc::CastOp, emitc::CmpOp,
+ emitc::ConstantOp, emitc::DivOp, emitc::ForOp, emitc::IfOp,
+ emitc::IncludeOp, emitc::MulOp, emitc::RemOp, emitc::SubOp,
+ emitc::VariableOp>(
[&](auto op) { return printOperation(*this, op); })
// Func ops.
.Case<func::CallOp, func::ConstantOp, func::FuncOp, func::ReturnOp>(