diff options
| author | River Riddle <riverriddle@google.com> | 2020-01-14 15:09:39 -0800 |
|---|---|---|
| committer | River Riddle <riverriddle@google.com> | 2020-01-14 15:10:07 -0800 |
| commit | 20c6e0749461147df19a3b126d1a48106c63c351 (patch) | |
| tree | 4315fe3223af3a6a05d7a35ed70bb0a0ff1b3077 /mlir/lib/IR | |
| parent | cbc9d22e49b434b6ceb2eb94b67079d02e0a7b74 (diff) | |
| download | bcm5719-llvm-20c6e0749461147df19a3b126d1a48106c63c351.tar.gz bcm5719-llvm-20c6e0749461147df19a3b126d1a48106c63c351.zip | |
[mlir] Enable printing of FuncOp in the generic form.
Summary:
This was previously disabled as FunctionType TypeAttrs could not be roundtripped in the IR. This has been fixed, so we can now generically print FuncOp.
Depends On D72429
Reviewed By: jpienaar, mehdi_amini
Differential Revision: https://reviews.llvm.org/D72642
Diffstat (limited to 'mlir/lib/IR')
| -rw-r--r-- | mlir/lib/IR/AsmPrinter.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp index 49830aae485..afb94fea0cd 100644 --- a/mlir/lib/IR/AsmPrinter.cpp +++ b/mlir/lib/IR/AsmPrinter.cpp @@ -1936,16 +1936,14 @@ void OperationPrinter::printOperation(Operation *op) { os << " = "; } - // TODO(riverriddle): FuncOp cannot be round-tripped currently, as - // FunctionType cannot be used in a TypeAttr. - if (printerFlags.shouldPrintGenericOpForm() && !isa<FuncOp>(op)) - return printGenericOp(op); - - // Check to see if this is a known operation. If so, use the registered - // custom printer hook. - if (auto *opInfo = op->getAbstractOperation()) { - opInfo->printAssembly(op, *this); - return; + // If requested, always print the generic form. + if (!printerFlags.shouldPrintGenericOpForm()) { + // Check to see if this is a known operation. If so, use the registered + // custom printer hook. + if (auto *opInfo = op->getAbstractOperation()) { + opInfo->printAssembly(op, *this); + return; + } } // Otherwise print with the generic assembly form. |

