Changeset View
Changeset View
Standalone View
Standalone View
mlir/test/lib/IR/TestPrintNesting.cpp
Show All 31 Lines | void printOperation(Operation *op) { | ||||
// Print the operation itself and some of its properties | // Print the operation itself and some of its properties | ||||
printIndent() << "visiting op: '" << op->getName() << "' with " | printIndent() << "visiting op: '" << op->getName() << "' with " | ||||
<< op->getNumOperands() << " operands and " | << op->getNumOperands() << " operands and " | ||||
<< op->getNumResults() << " results\n"; | << op->getNumResults() << " results\n"; | ||||
// Print the operation attributes | // Print the operation attributes | ||||
if (!op->getAttrs().empty()) { | if (!op->getAttrs().empty()) { | ||||
printIndent() << op->getAttrs().size() << " attributes:\n"; | printIndent() << op->getAttrs().size() << " attributes:\n"; | ||||
for (NamedAttribute attr : op->getAttrs()) | for (NamedAttribute attr : op->getAttrs()) | ||||
printIndent() << " - '" << attr.first << "' : '" << attr.second | printIndent() << " - '" << attr.first.getValue() << "' : '" | ||||
<< "'\n"; | << attr.second << "'\n"; | ||||
} | } | ||||
// Recurse into each of the regions attached to the operation. | // Recurse into each of the regions attached to the operation. | ||||
printIndent() << " " << op->getNumRegions() << " nested regions:\n"; | printIndent() << " " << op->getNumRegions() << " nested regions:\n"; | ||||
auto indent = pushIndent(); | auto indent = pushIndent(); | ||||
for (Region ®ion : op->getRegions()) | for (Region ®ion : op->getRegions()) | ||||
printRegion(region); | printRegion(region); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |