Skip to content

Commit a96e62b

Browse files
marbremgehre-amd
authored andcommitted
[mlir][EmitC] Remove func.constant from emitter (llvm#82342)
As part of the renaming the Standard dialect to Func dialect, *support* for the `func.constant` operation was added to the emitter. However, the emitter cannot emit function types. Hence the emission for a snippet like ``` %0 = func.constant @myFN : (f32) -> f32 func.func private @myFN(%arg0: f32) -> f32 { return %arg0 : f32 } ``` failes with `func.mlir:1:6: error: cannot emit type '(f32) -> f32'`. This removes `func.constant` from the emitter.
1 parent f5ea103 commit a96e62b

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

mlir/docs/Dialects/emitc.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ translating the following operations:
2828
* `cf.cond_br`
2929
* 'func' Dialect
3030
* `func.call`
31-
* `func.constant`
3231
* `func.func`
3332
* `func.return`
3433
* 'arith' Dialect

mlir/lib/Target/Cpp/TranslateToCpp.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -338,14 +338,6 @@ static LogicalResult printOperation(CppEmitter &emitter,
338338
return printConstantOp(emitter, operation, value);
339339
}
340340

341-
static LogicalResult printOperation(CppEmitter &emitter,
342-
func::ConstantOp constantOp) {
343-
Operation *operation = constantOp.getOperation();
344-
Attribute value = constantOp.getValueAttr();
345-
346-
return printConstantOp(emitter, operation, value);
347-
}
348-
349341
static LogicalResult printOperation(CppEmitter &emitter,
350342
emitc::AssignOp assignOp) {
351343
OpResult result = assignOp.getVar().getDefiningOp()->getResult(0);
@@ -1331,7 +1323,7 @@ LogicalResult CppEmitter::emitOperation(Operation &op, bool trailingSemicolon) {
13311323
emitc::VerbatimOp>(
13321324
[&](auto op) { return printOperation(*this, op); })
13331325
// Func ops.
1334-
.Case<func::CallOp, func::ConstantOp, func::FuncOp, func::ReturnOp>(
1326+
.Case<func::CallOp, func::FuncOp, func::ReturnOp>(
13351327
[&](auto op) { return printOperation(*this, op); })
13361328
// Arithmetic ops.
13371329
.Case<arith::ConstantOp>(

0 commit comments

Comments
 (0)