[flang-commits] [flang] 0781461 - [fir][NFC] Removed unused declaration from td file
Valentin Clement via flang-commits
flang-commits at lists.llvm.org
Thu Sep 30 07:46:18 PDT 2021
Author: Valentin Clement
Date: 2021-09-30T16:46:13+02:00
New Revision: 0781461959e2159f15fece225fe2a2efb48fe3b3
URL: https://github.com/llvm/llvm-project/commit/0781461959e2159f15fece225fe2a2efb48fe3b3
DIFF: https://github.com/llvm/llvm-project/commit/0781461959e2159f15fece225fe2a2efb48fe3b3.diff
LOG: [fir][NFC] Removed unused declaration from td file
Remove unused code from FIROps.td file after latest
patches.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D110814
Added:
Modified:
flang/include/flang/Optimizer/Dialect/FIROps.td
Removed:
################################################################################
diff --git a/flang/include/flang/Optimizer/Dialect/FIROps.td b/flang/include/flang/Optimizer/Dialect/FIROps.td
index 986892730139..0e6cd354c7e7 100644
--- a/flang/include/flang/Optimizer/Dialect/FIROps.td
+++ b/flang/include/flang/Optimizer/Dialect/FIROps.td
@@ -35,34 +35,6 @@ class fir_SimpleOp<string mnemonic, list<OpTrait> traits>
}];
}
-// Base builder for allocate operations
-def fir_AllocateOpBuilder : OpBuilder<(ins
- "mlir::Type":$inType,
- CArg<"mlir::ValueRange", "{}">:$lenParams,
- CArg<"mlir::ValueRange", "{}">:$sizes,
- CArg<"llvm::ArrayRef<mlir::NamedAttribute>", "{}">:$attributes),
- [{
- $_state.addTypes(getRefTy(inType));
- $_state.addAttribute("in_type", TypeAttr::get(inType));
- $_state.addOperands(sizes);
- $_state.addAttributes(attributes);
- }]>;
-
-def fir_NamedAllocateOpBuilder : OpBuilder<(ins
- "mlir::Type":$inType,
- "llvm::StringRef":$name,
- CArg<"mlir::ValueRange", "{}">:$lenParams,
- CArg<"mlir::ValueRange","{}">:$sizes,
- CArg<"llvm::ArrayRef<mlir::NamedAttribute>", "{}">:$attributes),
- [{
- $_state.addTypes(getRefTy(inType));
- $_state.addAttribute("in_type", TypeAttr::get(inType));
- if (!name.empty())
- $_state.addAttribute("name", $_builder.getStringAttr(name));
- $_state.addOperands(sizes);
- $_state.addAttributes(attributes);
- }]>;
-
def fir_OneResultOpBuilder : OpBuilder<(ins
"mlir::Type":$resultType,
"mlir::ValueRange":$operands,
@@ -86,128 +58,6 @@ class fir_SimpleOneResultOp<string mnemonic, list<OpTrait> traits = []> :
let builders = [fir_OneResultOpBuilder];
}
-class fir_TwoBuilders<OpBuilder b1, OpBuilder b2> {
- list<OpBuilder> builders = [b1, b2];
-}
-
-class fir_AllocatableBaseOp<string mnemonic, list<OpTrait> traits = []> :
- fir_Op<mnemonic, traits>, Results<(outs fir_Type:$res)> {
- let arguments = (ins
- OptionalAttr<StrAttr>:$name,
- OptionalAttr<BoolAttr>:$target
- );
-}
-
-class fir_AllocatableOp<string mnemonic, Resource resource,
- list<OpTrait> traits = []> :
- fir_AllocatableBaseOp<mnemonic,
- !listconcat(traits, [MemoryEffects<[MemAlloc<resource>]>])>,
- fir_TwoBuilders<fir_AllocateOpBuilder, fir_NamedAllocateOpBuilder>,
- Arguments<(ins TypeAttr:$in_type, Variadic<AnyIntegerType>:$args)> {
-
- let parser = [{
- mlir::Type intype;
- if (parser.parseType(intype))
- return mlir::failure();
- auto &builder = parser.getBuilder();
- result.addAttribute(inType(), mlir::TypeAttr::get(intype));
- llvm::SmallVector<mlir::OpAsmParser::OperandType, 8> operands;
- llvm::SmallVector<mlir::Type, 8> typeVec;
- bool hasOperands = false;
- if (!parser.parseOptionalLParen()) {
- // parse the LEN params of the derived type. (<params> : <types>)
- if (parser.parseOperandList(operands,
- mlir::OpAsmParser::Delimiter::None) ||
- parser.parseColonTypeList(typeVec) ||
- parser.parseRParen())
- return mlir::failure();
- auto lens = builder.getI32IntegerAttr(operands.size());
- result.addAttribute(lenpName(), lens);
- hasOperands = true;
- }
- if (!parser.parseOptionalComma()) {
- // parse size to scale by, vector of n dimensions of type index
- auto opSize = operands.size();
- if (parser.parseOperandList(operands, mlir::OpAsmParser::Delimiter::None))
- return mlir::failure();
- for (auto i = opSize, end = operands.size(); i != end; ++i)
- typeVec.push_back(builder.getIndexType());
- hasOperands = true;
- }
- if (hasOperands &&
- parser.resolveOperands(operands, typeVec, parser.getNameLoc(),
- result.operands))
- return mlir::failure();
- mlir::Type restype = wrapResultType(intype);
- if (!restype) {
- parser.emitError(parser.getNameLoc(), "invalid allocate type: ")
- << intype;
- return mlir::failure();
- }
- if (parser.parseOptionalAttrDict(result.attributes) ||
- parser.addTypeToList(restype, result.types))
- return mlir::failure();
- return mlir::success();
- }];
-
- let printer = [{
- p << ' ' << (*this)->getAttr(inType());
- if (hasLenParams()) {
- // print the LEN parameters to a derived type in parens
- p << '(' << getLenParams() << " : " << getLenParams().getTypes() << ')';
- }
- // print the shape of the allocation (if any); all must be index type
- for (auto sh : getShapeOperands()) {
- p << ", ";
- p.printOperand(sh);
- }
- p.printOptionalAttrDict((*this)->getAttrs(), {inType(), lenpName()});
- }];
-
- string extraAllocClassDeclaration = [{
- static constexpr llvm::StringRef inType() { return "in_type"; }
- static constexpr llvm::StringRef lenpName() { return "len_param_count"; }
- mlir::Type getAllocatedType();
-
- bool hasLenParams() { return bool{(*this)->getAttr(lenpName())}; }
- bool hasShapeOperands() { return numShapeOperands() > 0; }
-
- unsigned numLenParams() {
- if (auto val = (*this)->getAttrOfType<mlir::IntegerAttr>(lenpName()))
- return val.getInt();
- return 0;
- }
-
- operand_range getLenParams() {
- return {operand_begin(), operand_begin() + numLenParams()};
- }
-
- unsigned numShapeOperands() {
- return operand_end() - operand_begin() + numLenParams();
- }
-
- operand_range getShapeOperands() {
- return {operand_begin() + numLenParams(), operand_end()};
- }
-
- static mlir::Type getRefTy(mlir::Type ty);
-
- /// Get the input type of the allocation
- mlir::Type getInType() {
- return (*this)->getAttrOfType<mlir::TypeAttr>(inType()).getValue();
- }
- }];
-
- // Verify checks common to all allocation operations
- string allocVerify = [{
- llvm::SmallVector<llvm::StringRef, 8> visited;
- if (verifyInType(getInType(), visited, numShapeOperands()))
- return emitOpError("invalid type for allocation");
- if (verifyRecordLenParams(getInType(), numLenParams()))
- return emitOpError("LEN params do not correspond to type");
- }];
-}
-
//===----------------------------------------------------------------------===//
// Memory SSA operations
//===----------------------------------------------------------------------===//
More information about the flang-commits
mailing list