Skip to content

Commit ae7e842

Browse files
committed
[flang][NFC] Rename IntType to IntegerType.
flang-compiler#413 Differential Revision: https://reviews.llvm.org/D96072
1 parent e8a2b7c commit ae7e842

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

flang/include/flang/Optimizer/Dialect/FIROps.td

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def fir_CharacterType : Type<CPred<"$_self.isa<fir::CharacterType>()">,
3434
"FIR character type">;
3535
def fir_ComplexType : Type<CPred<"$_self.isa<fir::ComplexType>()">,
3636
"FIR complex type">;
37-
def fir_IntegerType : Type<CPred<"$_self.isa<fir::IntType>()">,
37+
def fir_IntegerType : Type<CPred<"$_self.isa<fir::IntegerType>()">,
3838
"FIR integer type">;
3939
def fir_LogicalType : Type<CPred<"$_self.isa<fir::LogicalType>()">,
4040
"FIR logical type">;
@@ -709,7 +709,7 @@ class fir_IntegralSwitchTerminatorOp<string mnemonic,
709709
let verifier = [{
710710
if (!(getSelector().getType().isa<mlir::IntegerType>() ||
711711
getSelector().getType().isa<mlir::IndexType>() ||
712-
getSelector().getType().isa<fir::IntType>()))
712+
getSelector().getType().isa<fir::IntegerType>()))
713713
return emitOpError("must be an integer");
714714
auto cases = (*this)->getAttrOfType<mlir::ArrayAttr>(getCasesAttr()).getValue();
715715
auto count = getNumDest();
@@ -835,7 +835,7 @@ def fir_SelectCaseOp : fir_SwitchTerminatorOp<"select_case"> {
835835
let verifier = [{
836836
if (!(getSelector().getType().isa<mlir::IntegerType>() ||
837837
getSelector().getType().isa<mlir::IndexType>() ||
838-
getSelector().getType().isa<fir::IntType>() ||
838+
getSelector().getType().isa<fir::IntegerType>() ||
839839
getSelector().getType().isa<fir::LogicalType>() ||
840840
getSelector().getType().isa<fir::CharacterType>()))
841841
return emitOpError("must be an integer, character, or logical");
@@ -2564,7 +2564,7 @@ def fir_ConvertOp : fir_OneResultOp<"convert", [NoSideEffect]> {
25642564
def FortranTypeAttr : Attr<And<[CPred<"$_self.isa<TypeAttr>()">,
25652565
Or<[CPred<"$_self.cast<TypeAttr>().getValue().isa<fir::CharacterType>()">,
25662566
CPred<"$_self.cast<TypeAttr>().getValue().isa<fir::ComplexType>()">,
2567-
CPred<"$_self.cast<TypeAttr>().getValue().isa<fir::IntType>()">,
2567+
CPred<"$_self.cast<TypeAttr>().getValue().isa<fir::IntegerType>()">,
25682568
CPred<"$_self.cast<TypeAttr>().getValue().isa<fir::LogicalType>()">,
25692569
CPred<"$_self.cast<TypeAttr>().getValue().isa<fir::RealType>()">,
25702570
CPred<"$_self.cast<TypeAttr>().getValue().isa<fir::RecordType>()">]>]>,

flang/include/flang/Optimizer/Dialect/FIRType.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct ComplexTypeStorage;
4343
struct DimsTypeStorage;
4444
struct FieldTypeStorage;
4545
struct HeapTypeStorage;
46-
struct IntTypeStorage;
46+
struct IntegerTypeStorage;
4747
struct LenTypeStorage;
4848
struct LogicalTypeStorage;
4949
struct PointerTypeStorage;
@@ -119,11 +119,11 @@ class ComplexType : public mlir::Type::TypeBase<fir::ComplexType, mlir::Type,
119119

120120
/// Model of a Fortran INTEGER intrinsic type, including the KIND type
121121
/// parameter.
122-
class IntType
123-
: public mlir::Type::TypeBase<IntType, mlir::Type, detail::IntTypeStorage> {
122+
class IntegerType : public mlir::Type::TypeBase<fir::IntegerType, mlir::Type,
123+
detail::IntegerTypeStorage> {
124124
public:
125125
using Base::Base;
126-
static IntType get(mlir::MLIRContext *ctxt, KindTy kind);
126+
static fir::IntegerType get(mlir::MLIRContext *ctxt, KindTy kind);
127127
KindTy getFKind() const;
128128
};
129129

@@ -388,7 +388,7 @@ inline bool isa_real(mlir::Type t) {
388388
/// Is `t` an integral type?
389389
inline bool isa_integer(mlir::Type t) {
390390
return t.isa<mlir::IndexType>() || t.isa<mlir::IntegerType>() ||
391-
t.isa<fir::IntType>();
391+
t.isa<fir::IntegerType>();
392392
}
393393

394394
/// Is `t` a FIR or MLIR Complex type?

flang/lib/Optimizer/Dialect/FIRDialect.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ using namespace fir;
1616
fir::FIROpsDialect::FIROpsDialect(mlir::MLIRContext *ctx)
1717
: mlir::Dialect("fir", ctx, mlir::TypeID::get<FIROpsDialect>()) {
1818
addTypes<BoxType, BoxCharType, BoxProcType, CharacterType, fir::ComplexType,
19-
DimsType, FieldType, HeapType, IntType, LenType, LogicalType,
20-
PointerType, RealType, RecordType, ReferenceType, SequenceType,
21-
TypeDescType>();
19+
DimsType, FieldType, HeapType, fir::IntegerType, LenType,
20+
LogicalType, PointerType, RealType, RecordType, ReferenceType,
21+
SequenceType, TypeDescType>();
2222
addAttributes<ClosedIntervalAttr, ExactTypeAttr, LowerBoundAttr,
2323
PointIntervalAttr, RealAttr, SubclassAttr, UpperBoundAttr>();
2424
addOperations<

flang/lib/Optimizer/Dialect/FIROps.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ mlir::OpFoldResult fir::ConvertOp::fold(llvm::ArrayRef<mlir::Attribute> opnds) {
337337

338338
bool fir::ConvertOp::isIntegerCompatible(mlir::Type ty) {
339339
return ty.isa<mlir::IntegerType>() || ty.isa<mlir::IndexType>() ||
340-
ty.isa<fir::IntType>() || ty.isa<fir::LogicalType>() ||
340+
ty.isa<fir::IntegerType>() || ty.isa<fir::LogicalType>() ||
341341
ty.isa<fir::CharacterType>();
342342
}
343343

@@ -996,7 +996,7 @@ static constexpr llvm::StringRef getTargetOffsetAttr() {
996996
template <typename A, typename... AdditionalArgs>
997997
static A getSubOperands(unsigned pos, A allArgs,
998998
mlir::DenseIntElementsAttr ranges,
999-
AdditionalArgs &&... additionalArgs) {
999+
AdditionalArgs &&...additionalArgs) {
10001000
unsigned start = 0;
10011001
for (unsigned i = 0; i < pos; ++i)
10021002
start += (*(ranges.begin() + i)).getZExtValue();

flang/lib/Optimizer/Dialect/FIRType.cpp

+13-13
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ HeapType parseHeap(mlir::DialectAsmParser &parser, mlir::Location loc) {
107107
}
108108

109109
// `int` `<` kind `>`
110-
IntType parseInteger(mlir::DialectAsmParser &parser) {
111-
return parseKindSingleton<IntType>(parser);
110+
fir::IntegerType parseInteger(mlir::DialectAsmParser &parser) {
111+
return parseKindSingleton<fir::IntegerType>(parser);
112112
}
113113

114114
// `len`
@@ -181,7 +181,7 @@ SequenceType parseSequence(mlir::DialectAsmParser &parser, mlir::Location) {
181181
/// Is `ty` a standard or FIR integer type?
182182
static bool isaIntegerType(mlir::Type ty) {
183183
// TODO: why aren't we using isa_integer? investigatation required.
184-
return ty.isa<mlir::IntegerType>() || ty.isa<fir::IntType>();
184+
return ty.isa<mlir::IntegerType>() || ty.isa<fir::IntegerType>();
185185
}
186186

187187
bool verifyRecordMemberType(mlir::Type ty) {
@@ -469,17 +469,17 @@ struct LogicalTypeStorage : public mlir::TypeStorage {
469469
};
470470

471471
/// `INTEGER` storage
472-
struct IntTypeStorage : public mlir::TypeStorage {
472+
struct IntegerTypeStorage : public mlir::TypeStorage {
473473
using KeyTy = KindTy;
474474

475475
static unsigned hashKey(const KeyTy &key) { return llvm::hash_combine(key); }
476476

477477
bool operator==(const KeyTy &key) const { return key == getFKind(); }
478478

479-
static IntTypeStorage *construct(mlir::TypeStorageAllocator &allocator,
480-
KindTy kind) {
481-
auto *storage = allocator.allocate<IntTypeStorage>();
482-
return new (storage) IntTypeStorage{kind};
479+
static IntegerTypeStorage *construct(mlir::TypeStorageAllocator &allocator,
480+
KindTy kind) {
481+
auto *storage = allocator.allocate<IntegerTypeStorage>();
482+
return new (storage) IntegerTypeStorage{kind};
483483
}
484484

485485
KindTy getFKind() const { return kind; }
@@ -488,8 +488,8 @@ struct IntTypeStorage : public mlir::TypeStorage {
488488
KindTy kind;
489489

490490
private:
491-
IntTypeStorage() = delete;
492-
explicit IntTypeStorage(KindTy kind) : kind{kind} {}
491+
IntegerTypeStorage() = delete;
492+
explicit IntegerTypeStorage(KindTy kind) : kind{kind} {}
493493
};
494494

495495
/// `COMPLEX` storage
@@ -901,11 +901,11 @@ int fir::LogicalType::getFKind() const { return getImpl()->getFKind(); }
901901

902902
// INTEGER
903903

904-
IntType fir::IntType::get(mlir::MLIRContext *ctxt, KindTy kind) {
904+
fir::IntegerType fir::IntegerType::get(mlir::MLIRContext *ctxt, KindTy kind) {
905905
return Base::get(ctxt, kind);
906906
}
907907

908-
int fir::IntType::getFKind() const { return getImpl()->getFKind(); }
908+
int fir::IntegerType::getFKind() const { return getImpl()->getFKind(); }
909909

910910
// COMPLEX
911911

@@ -1290,7 +1290,7 @@ void fir::printFirType(FIROpsDialect *, mlir::Type ty,
12901290
os << '>';
12911291
return;
12921292
}
1293-
if (auto type = ty.dyn_cast<fir::IntType>()) {
1293+
if (auto type = ty.dyn_cast<fir::IntegerType>()) {
12941294
os << "int<" << type.getFKind() << '>';
12951295
return;
12961296
}

0 commit comments

Comments
 (0)