diff --git a/mlir/lib/IR/AsmPrinter.cpp b/mlir/lib/IR/AsmPrinter.cpp --- a/mlir/lib/IR/AsmPrinter.cpp +++ b/mlir/lib/IR/AsmPrinter.cpp @@ -356,9 +356,9 @@ /// in the output, and trims down unnecessary output. class DummyAliasOperationPrinter : private OpAsmPrinter { public: - explicit DummyAliasOperationPrinter(const OpPrintingFlags &flags, + explicit DummyAliasOperationPrinter(const OpPrintingFlags &printerFlags, AliasInitializer &initializer) - : printerFlags(flags), initializer(initializer) {} + : printerFlags(printerFlags), initializer(initializer) {} /// Print the given operation. void print(Operation *op) { @@ -789,15 +789,9 @@ private: /// Number the SSA values within the given IR unit. - void numberValuesInRegion( - Region ®ion, - DialectInterfaceCollection &interfaces); - void numberValuesInBlock( - Block &block, - DialectInterfaceCollection &interfaces); - void numberValuesInOp( - Operation &op, - DialectInterfaceCollection &interfaces); + void numberValuesInRegion(Region ®ion); + void numberValuesInBlock(Block &block); + void numberValuesInOp(Operation &op); /// Given a result of an operation 'result', find the result group head /// 'lookupValue' and the result of 'result' within that group in @@ -838,12 +832,15 @@ unsigned nextArgumentID = 0; /// This is the next ID to assign when a name conflict is detected. unsigned nextConflictID = 0; + + DialectInterfaceCollection &interfaces; }; } // end anonymous namespace SSANameState::SSANameState( Operation *op, - DialectInterfaceCollection &interfaces) { + DialectInterfaceCollection &interfaces) + : interfaces(interfaces) { llvm::SaveAndRestore valueIDSaver(nextValueID); llvm::SaveAndRestore argumentIDSaver(nextArgumentID); llvm::SaveAndRestore conflictIDSaver(nextConflictID); @@ -867,7 +864,7 @@ nameContext.push_back(std::make_tuple(®ion, nextValueID, nextArgumentID, nextConflictID, topLevelNamesScope)); - numberValuesInOp(*op, interfaces); + numberValuesInOp(*op); while (!nameContext.empty()) { Region *region; @@ -887,7 +884,7 @@ auto *curNamesScope = new (allocator.Allocate()) UsedNamesScopeTy(usedNames); - numberValuesInRegion(*region, interfaces); + numberValuesInRegion(*region); for (Operation &op : region->getOps()) for (Region ®ion : op.getRegions()) @@ -974,22 +971,18 @@ } } -void SSANameState::numberValuesInRegion( - Region ®ion, - DialectInterfaceCollection &interfaces) { +void SSANameState::numberValuesInRegion(Region ®ion) { // Number the values within this region in a breadth-first order. unsigned nextBlockID = 0; for (auto &block : region) { // Each block gets a unique ID, and all of the operations within it get // numbered as well. blockIDs[&block] = nextBlockID++; - numberValuesInBlock(block, interfaces); + numberValuesInBlock(block); } } -void SSANameState::numberValuesInBlock( - Block &block, - DialectInterfaceCollection &interfaces) { +void SSANameState::numberValuesInBlock(Block &block) { auto setArgNameFn = [&](Value arg, StringRef name) { assert(!valueIDs.count(arg) && "arg numbered multiple times"); assert(arg.cast().getOwner() == &block && @@ -1021,12 +1014,10 @@ // Number the operations in this block. for (auto &op : block) - numberValuesInOp(op, interfaces); + numberValuesInOp(op); } -void SSANameState::numberValuesInOp( - Operation &op, - DialectInterfaceCollection &interfaces) { +void SSANameState::numberValuesInOp(Operation &op) { unsigned numResults = op.getNumResults(); if (numResults == 0) return; @@ -1183,6 +1174,8 @@ /// An optional location map to be populated. AsmState::LocationMap *locationMap; + + OpPrintingFlags printerFlags; }; } // end namespace detail } // end namespace mlir