[flang][NFC] Rename IntType to IntegerType.

https://github.com/flang-compiler/f18-llvm-project/pull/413

Differential Revision: https://reviews.llvm.org/D96072
This commit is contained in:
Eric Schweitz 2021-02-04 12:13:33 -08:00
parent e8a2b7c915
commit ae7e84285f
5 changed files with 27 additions and 27 deletions

View File

@ -34,7 +34,7 @@ def fir_CharacterType : Type<CPred<"$_self.isa<fir::CharacterType>()">,
"FIR character type">; "FIR character type">;
def fir_ComplexType : Type<CPred<"$_self.isa<fir::ComplexType>()">, def fir_ComplexType : Type<CPred<"$_self.isa<fir::ComplexType>()">,
"FIR complex type">; "FIR complex type">;
def fir_IntegerType : Type<CPred<"$_self.isa<fir::IntType>()">, def fir_IntegerType : Type<CPred<"$_self.isa<fir::IntegerType>()">,
"FIR integer type">; "FIR integer type">;
def fir_LogicalType : Type<CPred<"$_self.isa<fir::LogicalType>()">, def fir_LogicalType : Type<CPred<"$_self.isa<fir::LogicalType>()">,
"FIR logical type">; "FIR logical type">;
@ -709,7 +709,7 @@ class fir_IntegralSwitchTerminatorOp<string mnemonic,
let verifier = [{ let verifier = [{
if (!(getSelector().getType().isa<mlir::IntegerType>() || if (!(getSelector().getType().isa<mlir::IntegerType>() ||
getSelector().getType().isa<mlir::IndexType>() || getSelector().getType().isa<mlir::IndexType>() ||
getSelector().getType().isa<fir::IntType>())) getSelector().getType().isa<fir::IntegerType>()))
return emitOpError("must be an integer"); return emitOpError("must be an integer");
auto cases = (*this)->getAttrOfType<mlir::ArrayAttr>(getCasesAttr()).getValue(); auto cases = (*this)->getAttrOfType<mlir::ArrayAttr>(getCasesAttr()).getValue();
auto count = getNumDest(); auto count = getNumDest();
@ -835,7 +835,7 @@ def fir_SelectCaseOp : fir_SwitchTerminatorOp<"select_case"> {
let verifier = [{ let verifier = [{
if (!(getSelector().getType().isa<mlir::IntegerType>() || if (!(getSelector().getType().isa<mlir::IntegerType>() ||
getSelector().getType().isa<mlir::IndexType>() || getSelector().getType().isa<mlir::IndexType>() ||
getSelector().getType().isa<fir::IntType>() || getSelector().getType().isa<fir::IntegerType>() ||
getSelector().getType().isa<fir::LogicalType>() || getSelector().getType().isa<fir::LogicalType>() ||
getSelector().getType().isa<fir::CharacterType>())) getSelector().getType().isa<fir::CharacterType>()))
return emitOpError("must be an integer, character, or logical"); return emitOpError("must be an integer, character, or logical");
@ -2564,7 +2564,7 @@ def fir_ConvertOp : fir_OneResultOp<"convert", [NoSideEffect]> {
def FortranTypeAttr : Attr<And<[CPred<"$_self.isa<TypeAttr>()">, def FortranTypeAttr : Attr<And<[CPred<"$_self.isa<TypeAttr>()">,
Or<[CPred<"$_self.cast<TypeAttr>().getValue().isa<fir::CharacterType>()">, Or<[CPred<"$_self.cast<TypeAttr>().getValue().isa<fir::CharacterType>()">,
CPred<"$_self.cast<TypeAttr>().getValue().isa<fir::ComplexType>()">, CPred<"$_self.cast<TypeAttr>().getValue().isa<fir::ComplexType>()">,
CPred<"$_self.cast<TypeAttr>().getValue().isa<fir::IntType>()">, CPred<"$_self.cast<TypeAttr>().getValue().isa<fir::IntegerType>()">,
CPred<"$_self.cast<TypeAttr>().getValue().isa<fir::LogicalType>()">, CPred<"$_self.cast<TypeAttr>().getValue().isa<fir::LogicalType>()">,
CPred<"$_self.cast<TypeAttr>().getValue().isa<fir::RealType>()">, CPred<"$_self.cast<TypeAttr>().getValue().isa<fir::RealType>()">,
CPred<"$_self.cast<TypeAttr>().getValue().isa<fir::RecordType>()">]>]>, CPred<"$_self.cast<TypeAttr>().getValue().isa<fir::RecordType>()">]>]>,

View File

@ -43,7 +43,7 @@ struct ComplexTypeStorage;
struct DimsTypeStorage; struct DimsTypeStorage;
struct FieldTypeStorage; struct FieldTypeStorage;
struct HeapTypeStorage; struct HeapTypeStorage;
struct IntTypeStorage; struct IntegerTypeStorage;
struct LenTypeStorage; struct LenTypeStorage;
struct LogicalTypeStorage; struct LogicalTypeStorage;
struct PointerTypeStorage; struct PointerTypeStorage;
@ -119,11 +119,11 @@ public:
/// Model of a Fortran INTEGER intrinsic type, including the KIND type /// Model of a Fortran INTEGER intrinsic type, including the KIND type
/// parameter. /// parameter.
class IntType class IntegerType : public mlir::Type::TypeBase<fir::IntegerType, mlir::Type,
: public mlir::Type::TypeBase<IntType, mlir::Type, detail::IntTypeStorage> { detail::IntegerTypeStorage> {
public: public:
using Base::Base; using Base::Base;
static IntType get(mlir::MLIRContext *ctxt, KindTy kind); static fir::IntegerType get(mlir::MLIRContext *ctxt, KindTy kind);
KindTy getFKind() const; KindTy getFKind() const;
}; };
@ -388,7 +388,7 @@ inline bool isa_real(mlir::Type t) {
/// Is `t` an integral type? /// Is `t` an integral type?
inline bool isa_integer(mlir::Type t) { inline bool isa_integer(mlir::Type t) {
return t.isa<mlir::IndexType>() || t.isa<mlir::IntegerType>() || return t.isa<mlir::IndexType>() || t.isa<mlir::IntegerType>() ||
t.isa<fir::IntType>(); t.isa<fir::IntegerType>();
} }
/// Is `t` a FIR or MLIR Complex type? /// Is `t` a FIR or MLIR Complex type?

View File

@ -16,9 +16,9 @@ using namespace fir;
fir::FIROpsDialect::FIROpsDialect(mlir::MLIRContext *ctx) fir::FIROpsDialect::FIROpsDialect(mlir::MLIRContext *ctx)
: mlir::Dialect("fir", ctx, mlir::TypeID::get<FIROpsDialect>()) { : mlir::Dialect("fir", ctx, mlir::TypeID::get<FIROpsDialect>()) {
addTypes<BoxType, BoxCharType, BoxProcType, CharacterType, fir::ComplexType, addTypes<BoxType, BoxCharType, BoxProcType, CharacterType, fir::ComplexType,
DimsType, FieldType, HeapType, IntType, LenType, LogicalType, DimsType, FieldType, HeapType, fir::IntegerType, LenType,
PointerType, RealType, RecordType, ReferenceType, SequenceType, LogicalType, PointerType, RealType, RecordType, ReferenceType,
TypeDescType>(); SequenceType, TypeDescType>();
addAttributes<ClosedIntervalAttr, ExactTypeAttr, LowerBoundAttr, addAttributes<ClosedIntervalAttr, ExactTypeAttr, LowerBoundAttr,
PointIntervalAttr, RealAttr, SubclassAttr, UpperBoundAttr>(); PointIntervalAttr, RealAttr, SubclassAttr, UpperBoundAttr>();
addOperations< addOperations<

View File

@ -337,7 +337,7 @@ mlir::OpFoldResult fir::ConvertOp::fold(llvm::ArrayRef<mlir::Attribute> opnds) {
bool fir::ConvertOp::isIntegerCompatible(mlir::Type ty) { bool fir::ConvertOp::isIntegerCompatible(mlir::Type ty) {
return ty.isa<mlir::IntegerType>() || ty.isa<mlir::IndexType>() || return ty.isa<mlir::IntegerType>() || ty.isa<mlir::IndexType>() ||
ty.isa<fir::IntType>() || ty.isa<fir::LogicalType>() || ty.isa<fir::IntegerType>() || ty.isa<fir::LogicalType>() ||
ty.isa<fir::CharacterType>(); ty.isa<fir::CharacterType>();
} }
@ -996,7 +996,7 @@ static constexpr llvm::StringRef getTargetOffsetAttr() {
template <typename A, typename... AdditionalArgs> template <typename A, typename... AdditionalArgs>
static A getSubOperands(unsigned pos, A allArgs, static A getSubOperands(unsigned pos, A allArgs,
mlir::DenseIntElementsAttr ranges, mlir::DenseIntElementsAttr ranges,
AdditionalArgs &&... additionalArgs) { AdditionalArgs &&...additionalArgs) {
unsigned start = 0; unsigned start = 0;
for (unsigned i = 0; i < pos; ++i) for (unsigned i = 0; i < pos; ++i)
start += (*(ranges.begin() + i)).getZExtValue(); start += (*(ranges.begin() + i)).getZExtValue();

View File

@ -107,8 +107,8 @@ HeapType parseHeap(mlir::DialectAsmParser &parser, mlir::Location loc) {
} }
// `int` `<` kind `>` // `int` `<` kind `>`
IntType parseInteger(mlir::DialectAsmParser &parser) { fir::IntegerType parseInteger(mlir::DialectAsmParser &parser) {
return parseKindSingleton<IntType>(parser); return parseKindSingleton<fir::IntegerType>(parser);
} }
// `len` // `len`
@ -181,7 +181,7 @@ SequenceType parseSequence(mlir::DialectAsmParser &parser, mlir::Location) {
/// Is `ty` a standard or FIR integer type? /// Is `ty` a standard or FIR integer type?
static bool isaIntegerType(mlir::Type ty) { static bool isaIntegerType(mlir::Type ty) {
// TODO: why aren't we using isa_integer? investigatation required. // TODO: why aren't we using isa_integer? investigatation required.
return ty.isa<mlir::IntegerType>() || ty.isa<fir::IntType>(); return ty.isa<mlir::IntegerType>() || ty.isa<fir::IntegerType>();
} }
bool verifyRecordMemberType(mlir::Type ty) { bool verifyRecordMemberType(mlir::Type ty) {
@ -469,17 +469,17 @@ private:
}; };
/// `INTEGER` storage /// `INTEGER` storage
struct IntTypeStorage : public mlir::TypeStorage { struct IntegerTypeStorage : public mlir::TypeStorage {
using KeyTy = KindTy; using KeyTy = KindTy;
static unsigned hashKey(const KeyTy &key) { return llvm::hash_combine(key); } static unsigned hashKey(const KeyTy &key) { return llvm::hash_combine(key); }
bool operator==(const KeyTy &key) const { return key == getFKind(); } bool operator==(const KeyTy &key) const { return key == getFKind(); }
static IntTypeStorage *construct(mlir::TypeStorageAllocator &allocator, static IntegerTypeStorage *construct(mlir::TypeStorageAllocator &allocator,
KindTy kind) { KindTy kind) {
auto *storage = allocator.allocate<IntTypeStorage>(); auto *storage = allocator.allocate<IntegerTypeStorage>();
return new (storage) IntTypeStorage{kind}; return new (storage) IntegerTypeStorage{kind};
} }
KindTy getFKind() const { return kind; } KindTy getFKind() const { return kind; }
@ -488,8 +488,8 @@ protected:
KindTy kind; KindTy kind;
private: private:
IntTypeStorage() = delete; IntegerTypeStorage() = delete;
explicit IntTypeStorage(KindTy kind) : kind{kind} {} explicit IntegerTypeStorage(KindTy kind) : kind{kind} {}
}; };
/// `COMPLEX` storage /// `COMPLEX` storage
@ -901,11 +901,11 @@ int fir::LogicalType::getFKind() const { return getImpl()->getFKind(); }
// INTEGER // INTEGER
IntType fir::IntType::get(mlir::MLIRContext *ctxt, KindTy kind) { fir::IntegerType fir::IntegerType::get(mlir::MLIRContext *ctxt, KindTy kind) {
return Base::get(ctxt, kind); return Base::get(ctxt, kind);
} }
int fir::IntType::getFKind() const { return getImpl()->getFKind(); } int fir::IntegerType::getFKind() const { return getImpl()->getFKind(); }
// COMPLEX // COMPLEX
@ -1290,7 +1290,7 @@ void fir::printFirType(FIROpsDialect *, mlir::Type ty,
os << '>'; os << '>';
return; return;
} }
if (auto type = ty.dyn_cast<fir::IntType>()) { if (auto type = ty.dyn_cast<fir::IntegerType>()) {
os << "int<" << type.getFKind() << '>'; os << "int<" << type.getFKind() << '>';
return; return;
} }