[mlir] Mark OpState::getAttrs() deprecated.
Fix call sites. The method will be removed 2 weeks later. Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D97464
This commit is contained in:
parent
4f395db86b
commit
8c074cb0b7
|
|
@ -162,7 +162,7 @@ class fir_AllocatableOp<string mnemonic, Resource resource,
|
|||
p << ", ";
|
||||
p.printOperand(sh);
|
||||
}
|
||||
p.printOptionalAttrDict(getAttrs(), {inType(), lenpName()});
|
||||
p.printOptionalAttrDict((*this)->getAttrs(), {inType(), lenpName()});
|
||||
}];
|
||||
|
||||
string extraAllocClassDeclaration = [{
|
||||
|
|
@ -343,7 +343,7 @@ def fir_LoadOp : fir_OneResultOp<"load"> {
|
|||
let printer = [{
|
||||
p << getOperationName() << ' ';
|
||||
p.printOperand(memref());
|
||||
p.printOptionalAttrDict(getAttrs(), {});
|
||||
p.printOptionalAttrDict((*this)->getAttrs(), {});
|
||||
p << " : " << memref().getType();
|
||||
}];
|
||||
|
||||
|
|
@ -395,7 +395,7 @@ def fir_StoreOp : fir_Op<"store", []> {
|
|||
p.printOperand(value());
|
||||
p << " to ";
|
||||
p.printOperand(memref());
|
||||
p.printOptionalAttrDict(getAttrs(), {});
|
||||
p.printOptionalAttrDict((*this)->getAttrs(), {});
|
||||
p << " : " << memref().getType();
|
||||
}];
|
||||
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ static mlir::ParseResult parseConstantOp(mlir::OpAsmParser &parser,
|
|||
/// strings, attributes, operands, types, etc.
|
||||
static void print(mlir::OpAsmPrinter &printer, ConstantOp op) {
|
||||
printer << "toy.constant ";
|
||||
printer.printOptionalAttrDict(op.getAttrs(), /*elidedAttrs=*/{"value"});
|
||||
printer.printOptionalAttrDict(op->getAttrs(), /*elidedAttrs=*/{"value"});
|
||||
printer << op.value();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ static mlir::ParseResult parseConstantOp(mlir::OpAsmParser &parser,
|
|||
/// strings, attributes, operands, types, etc.
|
||||
static void print(mlir::OpAsmPrinter &printer, ConstantOp op) {
|
||||
printer << "toy.constant ";
|
||||
printer.printOptionalAttrDict(op.getAttrs(), /*elidedAttrs=*/{"value"});
|
||||
printer.printOptionalAttrDict(op->getAttrs(), /*elidedAttrs=*/{"value"});
|
||||
printer << op.value();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -124,7 +124,11 @@ public:
|
|||
void setLoc(Location loc) { state->setLoc(loc); }
|
||||
|
||||
/// Return all of the attributes on this operation.
|
||||
ArrayRef<NamedAttribute> getAttrs() { return state->getAttrs(); }
|
||||
LLVM_ATTRIBUTE_DEPRECATED(
|
||||
ArrayRef<NamedAttribute> getAttrs(),
|
||||
"Use Operation::getAttrs() instead (replace '.' with '->').") {
|
||||
return state->getAttrs();
|
||||
}
|
||||
|
||||
/// A utility iterator that filters out non-dialect attributes.
|
||||
using dialect_attr_iterator = Operation::dialect_attr_iterator;
|
||||
|
|
|
|||
|
|
@ -420,7 +420,7 @@ public:
|
|||
return success();
|
||||
}
|
||||
rewriter.replaceOpWithNewOp<LLVM::ConstantOp>(constOp, dstType, operands,
|
||||
constOp.getAttrs());
|
||||
constOp->getAttrs());
|
||||
return success();
|
||||
}
|
||||
};
|
||||
|
|
@ -625,7 +625,7 @@ public:
|
|||
if (!dstType)
|
||||
return failure();
|
||||
rewriter.template replaceOpWithNewOp<LLVMOp>(operation, dstType, operands,
|
||||
operation.getAttrs());
|
||||
operation->getAttrs());
|
||||
return success();
|
||||
}
|
||||
};
|
||||
|
|
@ -799,14 +799,14 @@ public:
|
|||
ConversionPatternRewriter &rewriter) const override {
|
||||
if (callOp.getNumResults() == 0) {
|
||||
rewriter.replaceOpWithNewOp<LLVM::CallOp>(callOp, llvm::None, operands,
|
||||
callOp.getAttrs());
|
||||
callOp->getAttrs());
|
||||
return success();
|
||||
}
|
||||
|
||||
// Function returns a single result.
|
||||
auto dstType = typeConverter.convertType(callOp.getType(0));
|
||||
rewriter.replaceOpWithNewOp<LLVM::CallOp>(callOp, dstType, operands,
|
||||
callOp.getAttrs());
|
||||
callOp->getAttrs());
|
||||
return success();
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -506,7 +506,7 @@ static void print(OpAsmPrinter &p, AffineApplyOp op) {
|
|||
p << AffineApplyOp::getOperationName() << " " << op.mapAttr();
|
||||
printDimAndSymbolList(op.operand_begin(), op.operand_end(),
|
||||
op.getAffineMap().getNumDims(), p);
|
||||
p.printOptionalAttrDict(op.getAttrs(), /*elidedAttrs=*/{"map"});
|
||||
p.printOptionalAttrDict(op->getAttrs(), /*elidedAttrs=*/{"map"});
|
||||
}
|
||||
|
||||
static LogicalResult verify(AffineApplyOp op) {
|
||||
|
|
@ -1516,7 +1516,7 @@ static void print(OpAsmPrinter &p, AffineForOp op) {
|
|||
|
||||
p.printRegion(op.region(),
|
||||
/*printEntryBlockArgs=*/false, printBlockTerminators);
|
||||
p.printOptionalAttrDict(op.getAttrs(),
|
||||
p.printOptionalAttrDict(op->getAttrs(),
|
||||
/*elidedAttrs=*/{op.getLowerBoundAttrName(),
|
||||
op.getUpperBoundAttrName(),
|
||||
op.getStepAttrName()});
|
||||
|
|
@ -1969,7 +1969,7 @@ static void print(OpAsmPrinter &p, AffineIfOp op) {
|
|||
}
|
||||
|
||||
// Print the attribute list.
|
||||
p.printOptionalAttrDict(op.getAttrs(),
|
||||
p.printOptionalAttrDict(op->getAttrs(),
|
||||
/*elidedAttrs=*/op.getConditionAttrName());
|
||||
}
|
||||
|
||||
|
|
@ -2100,7 +2100,8 @@ static void print(OpAsmPrinter &p, AffineLoadOp op) {
|
|||
op->getAttrOfType<AffineMapAttr>(op.getMapAttrName()))
|
||||
p.printAffineMapOfSSAIds(mapAttr, op.getMapOperands());
|
||||
p << ']';
|
||||
p.printOptionalAttrDict(op.getAttrs(), /*elidedAttrs=*/{op.getMapAttrName()});
|
||||
p.printOptionalAttrDict(op->getAttrs(),
|
||||
/*elidedAttrs=*/{op.getMapAttrName()});
|
||||
p << " : " << op.getMemRefType();
|
||||
}
|
||||
|
||||
|
|
@ -2216,7 +2217,8 @@ static void print(OpAsmPrinter &p, AffineStoreOp op) {
|
|||
op->getAttrOfType<AffineMapAttr>(op.getMapAttrName()))
|
||||
p.printAffineMapOfSSAIds(mapAttr, op.getMapOperands());
|
||||
p << ']';
|
||||
p.printOptionalAttrDict(op.getAttrs(), /*elidedAttrs=*/{op.getMapAttrName()});
|
||||
p.printOptionalAttrDict(op->getAttrs(),
|
||||
/*elidedAttrs=*/{op.getMapAttrName()});
|
||||
p << " : " << op.getMemRefType();
|
||||
}
|
||||
|
||||
|
|
@ -2268,7 +2270,7 @@ template <typename T> static void printAffineMinMaxOp(OpAsmPrinter &p, T op) {
|
|||
|
||||
if (operands.size() != numDims)
|
||||
p << '[' << operands.drop_front(numDims) << ']';
|
||||
p.printOptionalAttrDict(op.getAttrs(),
|
||||
p.printOptionalAttrDict(op->getAttrs(),
|
||||
/*elidedAttrs=*/{T::getMapAttrName()});
|
||||
}
|
||||
|
||||
|
|
@ -2422,7 +2424,7 @@ static void print(OpAsmPrinter &p, AffinePrefetchOp op) {
|
|||
<< "locality<" << op.localityHint() << ">, "
|
||||
<< (op.isDataCache() ? "data" : "instr");
|
||||
p.printOptionalAttrDict(
|
||||
op.getAttrs(),
|
||||
op->getAttrs(),
|
||||
/*elidedAttrs=*/{op.getMapAttrName(), op.getLocalityHintAttrName(),
|
||||
op.getIsDataCacheAttrName(), op.getIsWriteAttrName()});
|
||||
p << " : " << op.getMemRefType();
|
||||
|
|
@ -2738,7 +2740,7 @@ static void print(OpAsmPrinter &p, AffineParallelOp op) {
|
|||
p.printRegion(op.region(), /*printEntryBlockArgs=*/false,
|
||||
/*printBlockTerminators=*/op.getNumResults());
|
||||
p.printOptionalAttrDict(
|
||||
op.getAttrs(),
|
||||
op->getAttrs(),
|
||||
/*elidedAttrs=*/{AffineParallelOp::getReductionsAttrName(),
|
||||
AffineParallelOp::getLowerBoundsMapAttrName(),
|
||||
AffineParallelOp::getUpperBoundsMapAttrName(),
|
||||
|
|
@ -2938,7 +2940,8 @@ static void print(OpAsmPrinter &p, AffineVectorLoadOp op) {
|
|||
op->getAttrOfType<AffineMapAttr>(op.getMapAttrName()))
|
||||
p.printAffineMapOfSSAIds(mapAttr, op.getMapOperands());
|
||||
p << ']';
|
||||
p.printOptionalAttrDict(op.getAttrs(), /*elidedAttrs=*/{op.getMapAttrName()});
|
||||
p.printOptionalAttrDict(op->getAttrs(),
|
||||
/*elidedAttrs=*/{op.getMapAttrName()});
|
||||
p << " : " << op.getMemRefType() << ", " << op.getType();
|
||||
}
|
||||
|
||||
|
|
@ -3026,7 +3029,8 @@ static void print(OpAsmPrinter &p, AffineVectorStoreOp op) {
|
|||
op->getAttrOfType<AffineMapAttr>(op.getMapAttrName()))
|
||||
p.printAffineMapOfSSAIds(mapAttr, op.getMapOperands());
|
||||
p << ']';
|
||||
p.printOptionalAttrDict(op.getAttrs(), /*elidedAttrs=*/{op.getMapAttrName()});
|
||||
p.printOptionalAttrDict(op->getAttrs(),
|
||||
/*elidedAttrs=*/{op.getMapAttrName()});
|
||||
p << " : " << op.getMemRefType() << ", " << op.getValueToStore().getType();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -135,7 +135,8 @@ static void print(OpAsmPrinter &p, ExecuteOp op) {
|
|||
|
||||
// -> (!async.value<!return.type>, ...)
|
||||
p.printOptionalArrowTypeList(op.getResultTypes().drop_front(1));
|
||||
p.printOptionalAttrDictWithKeyword(op.getAttrs(), {kOperandSegmentSizesAttr});
|
||||
p.printOptionalAttrDictWithKeyword(op->getAttrs(),
|
||||
{kOperandSegmentSizesAttr});
|
||||
p.printRegion(op.body(), /*printEntryBlockArgs=*/false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@ static void printLaunchOp(OpAsmPrinter &p, LaunchOp op) {
|
|||
op.getThreadIds());
|
||||
|
||||
p.printRegion(op.body(), /*printEntryBlockArgs=*/false);
|
||||
p.printOptionalAttrDict(op.getAttrs());
|
||||
p.printOptionalAttrDict(op->getAttrs());
|
||||
}
|
||||
|
||||
// Parse the size assignment blocks for blocks and threads. These have the form
|
||||
|
|
@ -837,7 +837,7 @@ static ParseResult parseGPUModuleOp(OpAsmParser &parser,
|
|||
static void print(OpAsmPrinter &p, GPUModuleOp op) {
|
||||
p << op.getOperationName() << ' ';
|
||||
p.printSymbolName(op.getName());
|
||||
p.printOptionalAttrDictWithKeyword(op.getAttrs(),
|
||||
p.printOptionalAttrDictWithKeyword(op->getAttrs(),
|
||||
{SymbolTable::getSymbolAttrName()});
|
||||
p.printRegion(op->getRegion(0), /*printEntryBlockArgs=*/false,
|
||||
/*printBlockTerminators=*/false);
|
||||
|
|
|
|||
|
|
@ -88,14 +88,14 @@ static void printLLVMOpAttrs(OpAsmPrinter &printer, Operation *op,
|
|||
static void printICmpOp(OpAsmPrinter &p, ICmpOp &op) {
|
||||
p << op.getOperationName() << " \"" << stringifyICmpPredicate(op.predicate())
|
||||
<< "\" " << op.getOperand(0) << ", " << op.getOperand(1);
|
||||
p.printOptionalAttrDict(op.getAttrs(), {"predicate"});
|
||||
p.printOptionalAttrDict(op->getAttrs(), {"predicate"});
|
||||
p << " : " << op.lhs().getType();
|
||||
}
|
||||
|
||||
static void printFCmpOp(OpAsmPrinter &p, FCmpOp &op) {
|
||||
p << op.getOperationName() << " \"" << stringifyFCmpPredicate(op.predicate())
|
||||
<< "\" " << op.getOperand(0) << ", " << op.getOperand(1);
|
||||
p.printOptionalAttrDict(processFMFAttr(op.getAttrs()), {"predicate"});
|
||||
p.printOptionalAttrDict(processFMFAttr(op->getAttrs()), {"predicate"});
|
||||
p << " : " << op.lhs().getType();
|
||||
}
|
||||
|
||||
|
|
@ -172,9 +172,9 @@ static void printAllocaOp(OpAsmPrinter &p, AllocaOp &op) {
|
|||
|
||||
p << op.getOperationName() << ' ' << op.arraySize() << " x " << elemTy;
|
||||
if (op.alignment().hasValue() && *op.alignment() != 0)
|
||||
p.printOptionalAttrDict(op.getAttrs());
|
||||
p.printOptionalAttrDict(op->getAttrs());
|
||||
else
|
||||
p.printOptionalAttrDict(op.getAttrs(), {"alignment"});
|
||||
p.printOptionalAttrDict(op->getAttrs(), {"alignment"});
|
||||
p << " : " << funcTy;
|
||||
}
|
||||
|
||||
|
|
@ -402,7 +402,7 @@ static void printLoadOp(OpAsmPrinter &p, LoadOp &op) {
|
|||
if (op.volatile_())
|
||||
p << "volatile ";
|
||||
p << op.addr();
|
||||
p.printOptionalAttrDict(op.getAttrs(), {kVolatileAttrName});
|
||||
p.printOptionalAttrDict(op->getAttrs(), {kVolatileAttrName});
|
||||
p << " : " << op.addr().getType();
|
||||
}
|
||||
|
||||
|
|
@ -460,7 +460,7 @@ static void printStoreOp(OpAsmPrinter &p, StoreOp &op) {
|
|||
if (op.volatile_())
|
||||
p << "volatile ";
|
||||
p << op.value() << ", " << op.addr();
|
||||
p.printOptionalAttrDict(op.getAttrs(), {kVolatileAttrName});
|
||||
p.printOptionalAttrDict(op->getAttrs(), {kVolatileAttrName});
|
||||
p << " : " << op.addr().getType();
|
||||
}
|
||||
|
||||
|
|
@ -536,7 +536,7 @@ static void printInvokeOp(OpAsmPrinter &p, InvokeOp op) {
|
|||
p << " unwind ";
|
||||
p.printSuccessorAndUseList(op.unwindDest(), op.unwindDestOperands());
|
||||
|
||||
p.printOptionalAttrDict(op.getAttrs(),
|
||||
p.printOptionalAttrDict(op->getAttrs(),
|
||||
{InvokeOp::getOperandSegmentSizeAttr(), "callee"});
|
||||
p << " : ";
|
||||
p.printFunctionalType(
|
||||
|
|
@ -694,7 +694,7 @@ static void printLandingpadOp(OpAsmPrinter &p, LandingpadOp &op) {
|
|||
<< value.getType() << ") ";
|
||||
}
|
||||
|
||||
p.printOptionalAttrDict(op.getAttrs(), {"cleanup"});
|
||||
p.printOptionalAttrDict(op->getAttrs(), {"cleanup"});
|
||||
|
||||
p << ": " << op.getType();
|
||||
}
|
||||
|
|
@ -816,7 +816,7 @@ static void printCallOp(OpAsmPrinter &p, CallOp &op) {
|
|||
|
||||
auto args = op.getOperands().drop_front(isDirect ? 0 : 1);
|
||||
p << '(' << args << ')';
|
||||
p.printOptionalAttrDict(processFMFAttr(op.getAttrs()), {"callee"});
|
||||
p.printOptionalAttrDict(processFMFAttr(op->getAttrs()), {"callee"});
|
||||
|
||||
// Reconstruct the function MLIR function type from operand and result types.
|
||||
p << " : "
|
||||
|
|
@ -922,7 +922,7 @@ void LLVM::ExtractElementOp::build(OpBuilder &b, OperationState &result,
|
|||
static void printExtractElementOp(OpAsmPrinter &p, ExtractElementOp &op) {
|
||||
p << op.getOperationName() << ' ' << op.vector() << "[" << op.position()
|
||||
<< " : " << op.position().getType() << "]";
|
||||
p.printOptionalAttrDict(op.getAttrs());
|
||||
p.printOptionalAttrDict(op->getAttrs());
|
||||
p << " : " << op.vector().getType();
|
||||
}
|
||||
|
||||
|
|
@ -954,7 +954,7 @@ static ParseResult parseExtractElementOp(OpAsmParser &parser,
|
|||
|
||||
static void printExtractValueOp(OpAsmPrinter &p, ExtractValueOp &op) {
|
||||
p << op.getOperationName() << ' ' << op.container() << op.position();
|
||||
p.printOptionalAttrDict(op.getAttrs(), {"position"});
|
||||
p.printOptionalAttrDict(op->getAttrs(), {"position"});
|
||||
p << " : " << op.container().getType();
|
||||
}
|
||||
|
||||
|
|
@ -1037,7 +1037,7 @@ static ParseResult parseExtractValueOp(OpAsmParser &parser,
|
|||
static void printInsertElementOp(OpAsmPrinter &p, InsertElementOp &op) {
|
||||
p << op.getOperationName() << ' ' << op.value() << ", " << op.vector() << "["
|
||||
<< op.position() << " : " << op.position().getType() << "]";
|
||||
p.printOptionalAttrDict(op.getAttrs());
|
||||
p.printOptionalAttrDict(op->getAttrs());
|
||||
p << " : " << op.vector().getType();
|
||||
}
|
||||
|
||||
|
|
@ -1079,7 +1079,7 @@ static ParseResult parseInsertElementOp(OpAsmParser &parser,
|
|||
static void printInsertValueOp(OpAsmPrinter &p, InsertValueOp &op) {
|
||||
p << op.getOperationName() << ' ' << op.value() << ", " << op.container()
|
||||
<< op.position();
|
||||
p.printOptionalAttrDict(op.getAttrs(), {"position"});
|
||||
p.printOptionalAttrDict(op->getAttrs(), {"position"});
|
||||
p << " : " << op.container().getType();
|
||||
}
|
||||
|
||||
|
|
@ -1121,7 +1121,7 @@ static ParseResult parseInsertValueOp(OpAsmParser &parser,
|
|||
|
||||
static void printReturnOp(OpAsmPrinter &p, ReturnOp op) {
|
||||
p << op.getOperationName();
|
||||
p.printOptionalAttrDict(op.getAttrs());
|
||||
p.printOptionalAttrDict(op->getAttrs());
|
||||
assert(op.getNumOperands() <= 1);
|
||||
|
||||
if (op.getNumOperands() == 0)
|
||||
|
|
@ -1258,7 +1258,7 @@ static void printGlobalOp(OpAsmPrinter &p, GlobalOp op) {
|
|||
if (auto value = op.getValueOrNull())
|
||||
p.printAttribute(value);
|
||||
p << ')';
|
||||
p.printOptionalAttrDict(op.getAttrs(),
|
||||
p.printOptionalAttrDict(op->getAttrs(),
|
||||
{SymbolTable::getSymbolAttrName(), "type", "constant",
|
||||
"value", getLinkageAttrName()});
|
||||
|
||||
|
|
@ -1641,7 +1641,7 @@ void LLVM::ShuffleVectorOp::build(OpBuilder &b, OperationState &result,
|
|||
static void printShuffleVectorOp(OpAsmPrinter &p, ShuffleVectorOp &op) {
|
||||
p << op.getOperationName() << ' ' << op.v1() << ", " << op.v2() << " "
|
||||
<< op.mask();
|
||||
p.printOptionalAttrDict(op.getAttrs(), {"mask"});
|
||||
p.printOptionalAttrDict(op->getAttrs(), {"mask"});
|
||||
p << " : " << op.v1().getType() << ", " << op.v2().getType();
|
||||
}
|
||||
|
||||
|
|
@ -1983,7 +1983,7 @@ static void printAtomicRMWOp(OpAsmPrinter &p, AtomicRMWOp &op) {
|
|||
p << op.getOperationName() << ' ' << stringifyAtomicBinOp(op.bin_op()) << ' '
|
||||
<< op.ptr() << ", " << op.val() << ' '
|
||||
<< stringifyAtomicOrdering(op.ordering()) << ' ';
|
||||
p.printOptionalAttrDict(op.getAttrs(), {"bin_op", "ordering"});
|
||||
p.printOptionalAttrDict(op->getAttrs(), {"bin_op", "ordering"});
|
||||
p << " : " << op.res().getType();
|
||||
}
|
||||
|
||||
|
|
@ -2054,7 +2054,7 @@ static void printAtomicCmpXchgOp(OpAsmPrinter &p, AtomicCmpXchgOp &op) {
|
|||
p << op.getOperationName() << ' ' << op.ptr() << ", " << op.cmp() << ", "
|
||||
<< op.val() << ' ' << stringifyAtomicOrdering(op.success_ordering()) << ' '
|
||||
<< stringifyAtomicOrdering(op.failure_ordering());
|
||||
p.printOptionalAttrDict(op.getAttrs(),
|
||||
p.printOptionalAttrDict(op->getAttrs(),
|
||||
{"success_ordering", "failure_ordering"});
|
||||
p << " : " << op.val().getType();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -457,7 +457,7 @@ static void printGenericOp(OpAsmPrinter &p, GenericOpType op) {
|
|||
llvm::StringSet<> genericAttrNamesSet;
|
||||
genericAttrNamesSet.insert(genericAttrNames.begin(), genericAttrNames.end());
|
||||
SmallVector<NamedAttribute, 8> genericAttrs;
|
||||
for (auto attr : op.getAttrs())
|
||||
for (auto attr : op->getAttrs())
|
||||
if (genericAttrNamesSet.count(attr.first.strref()) > 0)
|
||||
genericAttrs.push_back(attr);
|
||||
if (!genericAttrs.empty()) {
|
||||
|
|
@ -472,13 +472,13 @@ static void printGenericOp(OpAsmPrinter &p, GenericOpType op) {
|
|||
genericAttrNamesSet.insert(genericAttrNames.back());
|
||||
|
||||
bool hasExtraAttrs = false;
|
||||
for (NamedAttribute n : op.getAttrs()) {
|
||||
for (NamedAttribute n : op->getAttrs()) {
|
||||
if ((hasExtraAttrs = !genericAttrNamesSet.contains(n.first.strref())))
|
||||
break;
|
||||
}
|
||||
if (hasExtraAttrs) {
|
||||
p << " attrs = ";
|
||||
p.printOptionalAttrDict(op.getAttrs(), /*elidedAttrs=*/genericAttrNames);
|
||||
p.printOptionalAttrDict(op->getAttrs(), /*elidedAttrs=*/genericAttrNames);
|
||||
}
|
||||
|
||||
// Print region.
|
||||
|
|
@ -1635,7 +1635,7 @@ static void print(OpAsmPrinter &p, linalg::YieldOp op) {
|
|||
p << op.getOperationName();
|
||||
if (op.getNumOperands() > 0)
|
||||
p << ' ' << op.getOperands();
|
||||
p.printOptionalAttrDict(op.getAttrs());
|
||||
p.printOptionalAttrDict(op->getAttrs());
|
||||
if (op.getNumOperands() > 0)
|
||||
p << " : " << op.getOperandTypes();
|
||||
}
|
||||
|
|
@ -1754,8 +1754,8 @@ static void print(OpAsmPrinter &p, TiledLoopOp op) {
|
|||
|
||||
p.printRegion(op.region(), /*printEntryBlockArgs=*/false);
|
||||
p.printOptionalAttrDict(
|
||||
op.getAttrs(), /*elidedAttrs=*/{TiledLoopOp::getOperandSegmentSizeAttr(),
|
||||
getIteratorTypesAttrName()});
|
||||
op->getAttrs(), /*elidedAttrs=*/{TiledLoopOp::getOperandSegmentSizeAttr(),
|
||||
getIteratorTypesAttrName()});
|
||||
}
|
||||
|
||||
static ParseResult parseTiledLoopOp(OpAsmParser &parser,
|
||||
|
|
@ -2294,7 +2294,7 @@ static void printNamedStructuredOpResults(OpAsmPrinter &p,
|
|||
template <typename NamedStructuredOpType>
|
||||
static void printNamedStructuredOp(OpAsmPrinter &p, NamedStructuredOpType op) {
|
||||
p << op.getOperationName();
|
||||
p.printOptionalAttrDict(op.getAttrs(),
|
||||
p.printOptionalAttrDict(op->getAttrs(),
|
||||
/*elidedAttrs=*/{"operand_segment_sizes"});
|
||||
|
||||
// Printing is shared with generic ops, except for the region and
|
||||
|
|
|
|||
|
|
@ -445,7 +445,7 @@ static void print(OpAsmPrinter &printer, ParallelOp &op) {
|
|||
/*printEntryBlockArgs=*/false,
|
||||
/*printBlockTerminators=*/true);
|
||||
printer.printOptionalAttrDictWithKeyword(
|
||||
op.getAttrs(), ParallelOp::getOperandSegmentSizeAttr());
|
||||
op->getAttrs(), ParallelOp::getOperandSegmentSizeAttr());
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
@ -608,8 +608,8 @@ static void print(OpAsmPrinter &printer, LoopOp &op) {
|
|||
/*printBlockTerminators=*/true);
|
||||
|
||||
printer.printOptionalAttrDictWithKeyword(
|
||||
op.getAttrs(), {LoopOp::getExecutionMappingAttrName(),
|
||||
LoopOp::getOperandSegmentSizeAttr()});
|
||||
op->getAttrs(), {LoopOp::getExecutionMappingAttrName(),
|
||||
LoopOp::getOperandSegmentSizeAttr()});
|
||||
}
|
||||
|
||||
static LogicalResult verifyLoopOp(acc::LoopOp loopOp) {
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ static void print(OpAsmPrinter &p, OperationOp op) {
|
|||
// Print the result type constraints of the operation.
|
||||
if (!op.results().empty())
|
||||
p << " -> " << op.types();
|
||||
p.printOptionalAttrDict(op.getAttrs(),
|
||||
p.printOptionalAttrDict(op->getAttrs(),
|
||||
{"attributeNames", "name", "operand_segment_sizes"});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ static ParseResult parseCreateOperationOp(OpAsmParser &p,
|
|||
|
||||
static void print(OpAsmPrinter &p, CreateOperationOp op) {
|
||||
p << "pdl_interp.create_operation ";
|
||||
p.printOptionalAttrDict(op.getAttrs(),
|
||||
p.printOptionalAttrDict(op->getAttrs(),
|
||||
{"attributeNames", "name", "operand_segment_sizes"});
|
||||
p << '"' << op.name() << "\"(" << op.operands() << ')';
|
||||
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ static void print(OpAsmPrinter &p, ForOp op) {
|
|||
p.printRegion(op.region(),
|
||||
/*printEntryBlockArgs=*/false,
|
||||
/*printBlockTerminators=*/op.hasIterOperands());
|
||||
p.printOptionalAttrDict(op.getAttrs());
|
||||
p.printOptionalAttrDict(op->getAttrs());
|
||||
}
|
||||
|
||||
static ParseResult parseForOp(OpAsmParser &parser, OperationState &result) {
|
||||
|
|
@ -679,7 +679,7 @@ static void print(OpAsmPrinter &p, IfOp op) {
|
|||
/*printBlockTerminators=*/printBlockTerminators);
|
||||
}
|
||||
|
||||
p.printOptionalAttrDict(op.getAttrs());
|
||||
p.printOptionalAttrDict(op->getAttrs());
|
||||
}
|
||||
|
||||
/// Given the region at `index`, or the parent operation if `index` is None,
|
||||
|
|
@ -996,7 +996,7 @@ static void print(OpAsmPrinter &p, ParallelOp op) {
|
|||
p.printOptionalArrowTypeList(op.getResultTypes());
|
||||
p.printRegion(op.region(), /*printEntryBlockArgs=*/false);
|
||||
p.printOptionalAttrDict(
|
||||
op.getAttrs(), /*elidedAttrs=*/ParallelOp::getOperandSegmentSizeAttr());
|
||||
op->getAttrs(), /*elidedAttrs=*/ParallelOp::getOperandSegmentSizeAttr());
|
||||
}
|
||||
|
||||
Region &ParallelOp::getLoopBody() { return region(); }
|
||||
|
|
@ -1266,7 +1266,7 @@ static void print(OpAsmPrinter &p, scf::WhileOp op) {
|
|||
p.printRegion(op.before(), /*printEntryBlockArgs=*/false);
|
||||
p << " do";
|
||||
p.printRegion(op.after());
|
||||
p.printOptionalAttrDictWithKeyword(op.getAttrs());
|
||||
p.printOptionalAttrDictWithKeyword(op->getAttrs());
|
||||
}
|
||||
|
||||
/// Verifies that two ranges of types match, i.e. have the same number of
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public:
|
|||
spirv::PointerType::get(structType, ptrType.getStorageClass());
|
||||
|
||||
// Save all named attributes except "type" attribute.
|
||||
for (const auto &attr : op.getAttrs()) {
|
||||
for (const auto &attr : op->getAttrs()) {
|
||||
if (attr.first == "type") {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ static void print(OpAsmPrinter &p, AssumingOp op) {
|
|||
p.printRegion(op.doRegion(),
|
||||
/*printEntryBlockArgs=*/false,
|
||||
/*printBlockTerminators=*/yieldsResults);
|
||||
p.printOptionalAttrDict(op.getAttrs());
|
||||
p.printOptionalAttrDict(op->getAttrs());
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
|
@ -415,7 +415,7 @@ OpFoldResult ConcatOp::fold(ArrayRef<Attribute> operands) {
|
|||
|
||||
static void print(OpAsmPrinter &p, ConstShapeOp &op) {
|
||||
p << "shape.const_shape ";
|
||||
p.printOptionalAttrDict(op.getAttrs(), /*elidedAttrs=*/{"shape"});
|
||||
p.printOptionalAttrDict(op->getAttrs(), /*elidedAttrs=*/{"shape"});
|
||||
p << "[";
|
||||
interleaveComma(op.shape().getValues<int64_t>(), p,
|
||||
[&](int64_t i) { p << i; });
|
||||
|
|
@ -723,7 +723,7 @@ void print(OpAsmPrinter &p, FunctionLibraryOp op) {
|
|||
p << op.getOperationName() << ' ';
|
||||
p.printSymbolName(op.getName());
|
||||
p.printOptionalAttrDictWithKeyword(
|
||||
op.getAttrs(), {SymbolTable::getSymbolAttrName(), "mapping"});
|
||||
op->getAttrs(), {SymbolTable::getSymbolAttrName(), "mapping"});
|
||||
p.printRegion(op.getOperation()->getRegion(0), /*printEntryBlockArgs=*/false,
|
||||
/*printBlockTerminators=*/false);
|
||||
p << " mapping ";
|
||||
|
|
@ -1100,7 +1100,7 @@ static void print(OpAsmPrinter &p, ReduceOp op) {
|
|||
<< ") : " << op.shape().getType();
|
||||
p.printOptionalArrowTypeList(op.getResultTypes());
|
||||
p.printRegion(op.region());
|
||||
p.printOptionalAttrDict(op.getAttrs());
|
||||
p.printOptionalAttrDict(op->getAttrs());
|
||||
}
|
||||
|
||||
#define GET_OP_CLASSES
|
||||
|
|
|
|||
|
|
@ -603,7 +603,7 @@ static void print(OpAsmPrinter &p, GenericAtomicRMWOp op) {
|
|||
p << op.getOperationName() << ' ' << op.memref() << "[" << op.indices()
|
||||
<< "] : " << op.memref().getType();
|
||||
p.printRegion(op.body());
|
||||
p.printOptionalAttrDict(op.getAttrs());
|
||||
p.printOptionalAttrDict(op->getAttrs());
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
@ -1164,9 +1164,9 @@ Block *CondBranchOp::getSuccessorForOperands(ArrayRef<Attribute> operands) {
|
|||
|
||||
static void print(OpAsmPrinter &p, ConstantOp &op) {
|
||||
p << "constant ";
|
||||
p.printOptionalAttrDict(op.getAttrs(), /*elidedAttrs=*/{"value"});
|
||||
p.printOptionalAttrDict(op->getAttrs(), /*elidedAttrs=*/{"value"});
|
||||
|
||||
if (op.getAttrs().size() > 1)
|
||||
if (op->getAttrs().size() > 1)
|
||||
p << ' ';
|
||||
p << op.getValue();
|
||||
|
||||
|
|
@ -1599,7 +1599,7 @@ void DmaStartOp::print(OpAsmPrinter &p) {
|
|||
if (isStrided())
|
||||
p << ", " << getStride() << ", " << getNumElementsPerStride();
|
||||
|
||||
p.printOptionalAttrDict(getAttrs());
|
||||
p.printOptionalAttrDict((*this)->getAttrs());
|
||||
p << " : " << getSrcMemRef().getType() << ", " << getDstMemRef().getType()
|
||||
<< ", " << getTagMemRef().getType();
|
||||
}
|
||||
|
|
@ -1763,7 +1763,7 @@ void DmaWaitOp::build(OpBuilder &builder, OperationState &result,
|
|||
void DmaWaitOp::print(OpAsmPrinter &p) {
|
||||
p << "dma_wait " << getTagMemRef() << '[' << getTagIndices() << "], "
|
||||
<< getNumElements();
|
||||
p.printOptionalAttrDict(getAttrs());
|
||||
p.printOptionalAttrDict((*this)->getAttrs());
|
||||
p << " : " << getTagMemRef().getType();
|
||||
}
|
||||
|
||||
|
|
@ -2337,7 +2337,7 @@ static void print(OpAsmPrinter &p, PrefetchOp op) {
|
|||
p << ", locality<" << op.localityHint();
|
||||
p << ">, " << (op.isDataCache() ? "data" : "instr");
|
||||
p.printOptionalAttrDict(
|
||||
op.getAttrs(),
|
||||
op->getAttrs(),
|
||||
/*elidedAttrs=*/{"localityHint", "isWrite", "isDataCache"});
|
||||
p << " : " << op.getMemRefType();
|
||||
}
|
||||
|
|
@ -2454,7 +2454,7 @@ OpFoldResult SelectOp::fold(ArrayRef<Attribute> operands) {
|
|||
|
||||
static void print(OpAsmPrinter &p, SelectOp op) {
|
||||
p << "select " << op.getOperands();
|
||||
p.printOptionalAttrDict(op.getAttrs());
|
||||
p.printOptionalAttrDict(op->getAttrs());
|
||||
p << " : ";
|
||||
if (ShapedType condType = op.getCondition().getType().dyn_cast<ShapedType>())
|
||||
p << condType << ", ";
|
||||
|
|
@ -3914,7 +3914,7 @@ void TransposeOp::build(OpBuilder &b, OperationState &result, Value in,
|
|||
// transpose $in $permutation attr-dict : type($in) `to` type(results)
|
||||
static void print(OpAsmPrinter &p, TransposeOp op) {
|
||||
p << "transpose " << op.in() << " " << op.permutation();
|
||||
p.printOptionalAttrDict(op.getAttrs(),
|
||||
p.printOptionalAttrDict(op->getAttrs(),
|
||||
{TransposeOp::getPermutationAttrName()});
|
||||
p << " : " << op.in().getType() << " to " << op.getType();
|
||||
}
|
||||
|
|
@ -4069,7 +4069,7 @@ static void print(OpAsmPrinter &p, ViewOp op) {
|
|||
p << op.getOperationName() << ' ' << op.getOperand(0) << '[';
|
||||
p.printOperand(op.byte_shift());
|
||||
p << "][" << op.sizes() << ']';
|
||||
p.printOptionalAttrDict(op.getAttrs());
|
||||
p.printOptionalAttrDict(op->getAttrs());
|
||||
p << " : " << op.getOperand(0).getType() << " to " << op.getType();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -376,7 +376,7 @@ static void print(OpAsmPrinter &p, ContractionOp op) {
|
|||
llvm::StringSet<> traitAttrsSet;
|
||||
traitAttrsSet.insert(attrNames.begin(), attrNames.end());
|
||||
SmallVector<NamedAttribute, 8> attrs;
|
||||
for (auto attr : op.getAttrs())
|
||||
for (auto attr : op->getAttrs())
|
||||
if (traitAttrsSet.count(attr.first.strref()) > 0)
|
||||
attrs.push_back(attr);
|
||||
|
||||
|
|
@ -386,7 +386,7 @@ static void print(OpAsmPrinter &p, ContractionOp op) {
|
|||
if (op.masks().size() == 2)
|
||||
p << ", " << op.masks();
|
||||
|
||||
p.printOptionalAttrDict(op.getAttrs(), attrNames);
|
||||
p.printOptionalAttrDict(op->getAttrs(), attrNames);
|
||||
p << " : " << op.lhs().getType() << ", " << op.rhs().getType() << " into "
|
||||
<< op.getResultType();
|
||||
}
|
||||
|
|
@ -776,7 +776,7 @@ void vector::ExtractOp::build(OpBuilder &builder, OperationState &result,
|
|||
|
||||
static void print(OpAsmPrinter &p, vector::ExtractOp op) {
|
||||
p << op.getOperationName() << " " << op.vector() << op.position();
|
||||
p.printOptionalAttrDict(op.getAttrs(), {"position"});
|
||||
p.printOptionalAttrDict(op->getAttrs(), {"position"});
|
||||
p << " : " << op.vector().getType();
|
||||
}
|
||||
|
||||
|
|
@ -1351,7 +1351,7 @@ void ShuffleOp::build(OpBuilder &builder, OperationState &result, Value v1,
|
|||
static void print(OpAsmPrinter &p, ShuffleOp op) {
|
||||
p << op.getOperationName() << " " << op.v1() << ", " << op.v2() << " "
|
||||
<< op.mask();
|
||||
p.printOptionalAttrDict(op.getAttrs(), {ShuffleOp::getMaskAttrName()});
|
||||
p.printOptionalAttrDict(op->getAttrs(), {ShuffleOp::getMaskAttrName()});
|
||||
p << " : " << op.v1().getType() << ", " << op.v2().getType();
|
||||
}
|
||||
|
||||
|
|
@ -1708,7 +1708,7 @@ static void print(OpAsmPrinter &p, OuterProductOp op) {
|
|||
p << op.getOperationName() << " " << op.lhs() << ", " << op.rhs();
|
||||
if (!op.acc().empty()) {
|
||||
p << ", " << op.acc();
|
||||
p.printOptionalAttrDict(op.getAttrs());
|
||||
p.printOptionalAttrDict(op->getAttrs());
|
||||
}
|
||||
p << " : " << op.lhs().getType() << ", " << op.rhs().getType();
|
||||
}
|
||||
|
|
@ -2307,7 +2307,7 @@ static void printTransferAttrs(OpAsmPrinter &p, VectorTransferOpInterface op) {
|
|||
}
|
||||
if (elideMasked)
|
||||
elidedAttrs.push_back(op.getMaskedAttrName());
|
||||
p.printOptionalAttrDict(op.getAttrs(), elidedAttrs);
|
||||
p.printOptionalAttrDict(op->getAttrs(), elidedAttrs);
|
||||
}
|
||||
|
||||
static void print(OpAsmPrinter &p, TransferReadOp op) {
|
||||
|
|
@ -3217,7 +3217,7 @@ static ParseResult parseTupleOp(OpAsmParser &parser, OperationState &result) {
|
|||
static void print(OpAsmPrinter &p, TupleOp op) {
|
||||
p << op.getOperationName() << ' ';
|
||||
p.printOperands(op.getOperands());
|
||||
p.printOptionalAttrDict(op.getAttrs());
|
||||
p.printOptionalAttrDict(op->getAttrs());
|
||||
p << " : ";
|
||||
llvm::interleaveComma(op->getOperandTypes(), p);
|
||||
}
|
||||
|
|
@ -3362,7 +3362,7 @@ static ParseResult parseTupleGetOp(OpAsmParser &parser,
|
|||
|
||||
static void print(OpAsmPrinter &p, TupleGetOp op) {
|
||||
p << op.getOperationName() << ' ' << op.getOperand() << ", " << op.index();
|
||||
p.printOptionalAttrDict(op.getAttrs(),
|
||||
p.printOptionalAttrDict(op->getAttrs(),
|
||||
/*elidedAttrs=*/{TupleGetOp::getIndexAttrName()});
|
||||
p << " : " << op.getOperand().getType();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,9 +162,9 @@ static LogicalResult verify(FuncOp op) {
|
|||
void FuncOp::cloneInto(FuncOp dest, BlockAndValueMapping &mapper) {
|
||||
// Add the attributes of this function to dest.
|
||||
llvm::MapVector<Identifier, Attribute> newAttrs;
|
||||
for (auto &attr : dest.getAttrs())
|
||||
for (const auto &attr : dest->getAttrs())
|
||||
newAttrs.insert(attr);
|
||||
for (auto &attr : getAttrs())
|
||||
for (const auto &attr : (*this)->getAttrs())
|
||||
newAttrs.insert(attr);
|
||||
dest->setAttrs(DictionaryAttr::get(getContext(), newAttrs.takeVector()));
|
||||
|
||||
|
|
@ -233,7 +233,7 @@ ModuleOp ModuleOp::create(Location loc, Optional<StringRef> name) {
|
|||
static LogicalResult verify(ModuleOp op) {
|
||||
// Check that none of the attributes are non-dialect attributes, except for
|
||||
// the symbol related attributes.
|
||||
for (auto attr : op.getAttrs()) {
|
||||
for (auto attr : op->getAttrs()) {
|
||||
if (!attr.first.strref().contains('.') &&
|
||||
!llvm::is_contained(
|
||||
ArrayRef<StringRef>{mlir::SymbolTable::getSymbolAttrName(),
|
||||
|
|
|
|||
Loading…
Reference in New Issue