mirror of https://github.com/llvm/circt.git
[Moore] Use free variants of isa/cast/dyn_cast
Refer to https://mlir.llvm.org/deprecation/
This commit is contained in:
parent
f396653c7c
commit
93e2cb71a2
|
@ -354,7 +354,7 @@ def NotOp : MooreOp<"not", [Pure, SameOperandsAndResultType]> {
|
|||
class ReduceOpBase<string mnemonic, string operatorName> : MooreOp<mnemonic, [
|
||||
Pure,
|
||||
TypesMatchWith<"result is single bit of input", "input", "result", [{
|
||||
$_self.cast<UnpackedType>()
|
||||
llvm::cast<UnpackedType>($_self)
|
||||
.getSimpleBitVector()
|
||||
.toSingleBit()
|
||||
.getType($_self.getContext())
|
||||
|
@ -385,7 +385,7 @@ def BoolCastOp : MooreOp<"bool_cast", [
|
|||
TypesMatchWith<"result is single bit matching input domain",
|
||||
"input", "result", [{
|
||||
IntType::get($_self.getContext(),
|
||||
IntType::getAtomForDomain($_self.cast<UnpackedType>().getDomain()))
|
||||
IntType::getAtomForDomain(llvm::cast<UnpackedType>($_self).getDomain()))
|
||||
}]>
|
||||
]> {
|
||||
let summary = "Cast a value to a single bit boolean";
|
||||
|
@ -571,7 +571,7 @@ class LogicalEqOpBase<string mnemonic> : MooreOp<mnemonic, [
|
|||
TypesMatchWith<"result is single bit matching input domain",
|
||||
"lhs", "result", [{
|
||||
IntType::get($_self.getContext(),
|
||||
IntType::getAtomForDomain($_self.cast<UnpackedType>().getDomain()))
|
||||
IntType::getAtomForDomain(llvm::cast<UnpackedType>($_self).getDomain()))
|
||||
}]>
|
||||
]> {
|
||||
let description = [{
|
||||
|
@ -628,7 +628,7 @@ class WildcardEqOpBase<string mnemonic> : MooreOp<mnemonic, [
|
|||
TypesMatchWith<"result is single bit matching input domain",
|
||||
"lhs", "result", [{
|
||||
IntType::get($_self.getContext(),
|
||||
IntType::getAtomForDomain($_self.cast<UnpackedType>().getDomain()))
|
||||
IntType::getAtomForDomain(llvm::cast<UnpackedType>($_self).getDomain()))
|
||||
}]>
|
||||
]> {
|
||||
let description = [{
|
||||
|
@ -661,7 +661,7 @@ class RelationalOpBase<string mnemonic> : MooreOp<mnemonic, [
|
|||
TypesMatchWith<"result is single bit matching input domain",
|
||||
"lhs", "result", [{
|
||||
IntType::get($_self.getContext(),
|
||||
IntType::getAtomForDomain($_self.cast<UnpackedType>().getDomain()))
|
||||
IntType::getAtomForDomain(llvm::cast<UnpackedType>($_self).getDomain()))
|
||||
}]>
|
||||
]> {
|
||||
let description = [{
|
||||
|
|
|
@ -291,10 +291,10 @@ class UnpackedStructType;
|
|||
class UnpackedType : public SVType {
|
||||
public:
|
||||
static bool classof(Type type) {
|
||||
return type.isa<PackedType>() || type.isa<StringType>() ||
|
||||
type.isa<ChandleType>() || type.isa<EventType>() ||
|
||||
type.isa<RealType>() || type.isa<UnpackedIndirectType>() ||
|
||||
type.isa<UnpackedDim>() || type.isa<UnpackedStructType>();
|
||||
return llvm::isa<PackedType>(type) || llvm::isa<StringType>(type) ||
|
||||
llvm::isa<ChandleType>(type) || llvm::isa<EventType>(type) ||
|
||||
llvm::isa<RealType>(type) || llvm::isa<UnpackedIndirectType>(type) ||
|
||||
llvm::isa<UnpackedDim>(type) || llvm::isa<UnpackedStructType>(type);
|
||||
}
|
||||
|
||||
/// Resolve one level of name or type reference indirection.
|
||||
|
@ -423,9 +423,9 @@ class PackedStructType;
|
|||
class PackedType : public UnpackedType {
|
||||
public:
|
||||
static bool classof(Type type) {
|
||||
return type.isa<VoidType>() || type.isa<IntType>() ||
|
||||
type.isa<PackedIndirectType>() || type.isa<PackedDim>() ||
|
||||
type.isa<EnumType>() || type.isa<PackedStructType>();
|
||||
return llvm::isa<VoidType>(type) || llvm::isa<IntType>(type) ||
|
||||
llvm::isa<PackedIndirectType>(type) || llvm::isa<PackedDim>(type) ||
|
||||
llvm::isa<EnumType>(type) || llvm::isa<PackedStructType>(type);
|
||||
}
|
||||
|
||||
/// Resolve one level of name or type reference indirection.
|
||||
|
@ -680,7 +680,7 @@ protected:
|
|||
public:
|
||||
/// Get the type this indirection wraps.
|
||||
BaseTy getInner() const {
|
||||
return detail::getIndirectTypeInner(this->impl).template cast<BaseTy>();
|
||||
return cast<BaseTy>(detail::getIndirectTypeInner(this->impl));
|
||||
}
|
||||
|
||||
/// Get the location in the source text where the indirection was generated.
|
||||
|
@ -749,7 +749,7 @@ public:
|
|||
class PackedIndirectType : public IndirectTypeBase<PackedType> {
|
||||
public:
|
||||
static bool classof(Type type) {
|
||||
return type.isa<PackedNamedType>() || type.isa<PackedRefType>();
|
||||
return llvm::isa<PackedNamedType>(type) || llvm::isa<PackedRefType>(type);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -760,7 +760,8 @@ protected:
|
|||
class UnpackedIndirectType : public IndirectTypeBase<UnpackedType> {
|
||||
public:
|
||||
static bool classof(Type type) {
|
||||
return type.isa<UnpackedNamedType>() || type.isa<UnpackedRefType>();
|
||||
return llvm::isa<UnpackedNamedType>(type) ||
|
||||
llvm::isa<UnpackedRefType>(type);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -817,7 +818,7 @@ class PackedUnsizedDim;
|
|||
class PackedDim : public PackedType {
|
||||
public:
|
||||
static bool classof(Type type) {
|
||||
return type.isa<PackedRangeDim>() || type.isa<PackedUnsizedDim>();
|
||||
return llvm::isa<PackedRangeDim>(type) || llvm::isa<PackedUnsizedDim>(type);
|
||||
}
|
||||
|
||||
/// Get the element type of the dimension. This is the `x` in `x[a:b]`.
|
||||
|
@ -902,9 +903,11 @@ class UnpackedQueueDim;
|
|||
class UnpackedDim : public UnpackedType {
|
||||
public:
|
||||
static bool classof(Type type) {
|
||||
return type.isa<UnpackedUnsizedDim>() || type.isa<UnpackedArrayDim>() ||
|
||||
type.isa<UnpackedRangeDim>() || type.isa<UnpackedAssocDim>() ||
|
||||
type.isa<UnpackedQueueDim>();
|
||||
return llvm::isa<UnpackedUnsizedDim>(type) ||
|
||||
llvm::isa<UnpackedArrayDim>(type) ||
|
||||
llvm::isa<UnpackedRangeDim>(type) ||
|
||||
llvm::isa<UnpackedAssocDim>(type) ||
|
||||
llvm::isa<UnpackedQueueDim>(type);
|
||||
}
|
||||
|
||||
/// Get the element type of the dimension. This is the `x` in `x[a:b]`.
|
||||
|
|
|
@ -21,29 +21,29 @@ include "mlir/IR/EnumAttr.td"
|
|||
class MooreType<Pred condition, string description, string cppClassName>
|
||||
: DialectType<MooreDialect, condition, description, cppClassName>;
|
||||
|
||||
def PackedType : MooreType<CPred<"$_self.isa<moore::PackedType>()">,
|
||||
def PackedType : MooreType<CPred<"llvm::isa<moore::PackedType>($_self)">,
|
||||
"packed type", "moore::PackedType">;
|
||||
|
||||
def UnpackedType : MooreType<CPred<"$_self.isa<moore::UnpackedType>()">,
|
||||
def UnpackedType : MooreType<CPred<"llvm::isa<moore::UnpackedType>($_self)">,
|
||||
"unpacked type", "moore::UnpackedType">;
|
||||
|
||||
/// A simple bit vector type.
|
||||
def SimpleBitVectorType : MooreType<CPred<[{
|
||||
$_self.isa<moore::UnpackedType>() &&
|
||||
$_self.cast<moore::UnpackedType>().isSimpleBitVector()
|
||||
llvm::isa<moore::UnpackedType>($_self) &&
|
||||
llvm::cast<moore::UnpackedType>($_self).isSimpleBitVector()
|
||||
}]>, "simple bit vector type", "moore::UnpackedType">;
|
||||
|
||||
/// A single bit type (`bit`, `logic`, `reg`).
|
||||
def AnySingleBitType : MooreType<CPred<[{
|
||||
$_self.isa<moore::IntType>() &&
|
||||
$_self.cast<moore::IntType>().getBitSize() == 1
|
||||
llvm::isa<moore::IntType>($_self) &&
|
||||
llvm::cast<moore::IntType>($_self).getBitSize() == 1
|
||||
}]>, "single bit type", "moore::IntType">;
|
||||
|
||||
/// A `bit` type.
|
||||
def BitType : MooreType<CPred<[{
|
||||
$_self.isa<moore::IntType>() &&
|
||||
$_self.cast<moore::IntType>().getBitSize() == 1 &&
|
||||
$_self.cast<moore::IntType>().getDomain() == moore::Domain::TwoValued
|
||||
llvm::isa<moore::IntType>($_self) &&
|
||||
llvm::cast<moore::IntType>($_self).getBitSize() == 1 &&
|
||||
llvm::cast<moore::IntType>($_self).getDomain() == moore::Domain::TwoValued
|
||||
}]>, "`bit` type", "moore::IntType"> {
|
||||
let builderCall = [{
|
||||
$_builder.getType<moore::IntType>(IntType::Kind::Bit)
|
||||
|
@ -54,7 +54,7 @@ def BitType : MooreType<CPred<[{
|
|||
// Integer atom types
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
def MooreIntType : MooreType<CPred<"$_self.isa<moore::IntType>()">,
|
||||
def MooreIntType : MooreType<CPred<"llvm::isa<moore::IntType>($_self)">,
|
||||
"an SystemVerilog int", "moore::IntType">;
|
||||
|
||||
#endif // CIRCT_DIALECT_MOORE_MOORETYPES
|
||||
|
|
|
@ -124,7 +124,7 @@ MlirType mooreRealTypeGet(MlirContext ctx, enum MooreRealKind kind) {
|
|||
|
||||
/// Create a packed unsized dimension type.
|
||||
MlirType moorePackedUnsizedDimTypeGet(MlirType inner) {
|
||||
return wrap(PackedUnsizedDim::get(unwrap(inner).cast<PackedType>()));
|
||||
return wrap(PackedUnsizedDim::get(cast<PackedType>(unwrap(inner))));
|
||||
}
|
||||
|
||||
/// Create a packed range dimension type.
|
||||
|
@ -132,59 +132,59 @@ MlirType moorePackedRangeDimTypeGet(MlirType inner, unsigned size, bool upDir,
|
|||
int offset) {
|
||||
RangeDir dir = upDir ? RangeDir::Up : RangeDir::Down;
|
||||
return wrap(
|
||||
PackedRangeDim::get(unwrap(inner).cast<PackedType>(), size, dir, offset));
|
||||
PackedRangeDim::get(cast<PackedType>(unwrap(inner)), size, dir, offset));
|
||||
}
|
||||
|
||||
/// Create a unpacked unsized dimension type.
|
||||
MlirType mooreUnpackedUnsizedDimTypeGet(MlirType inner) {
|
||||
return wrap(UnpackedUnsizedDim::get(unwrap(inner).cast<UnpackedType>()));
|
||||
return wrap(UnpackedUnsizedDim::get(cast<UnpackedType>(unwrap(inner))));
|
||||
}
|
||||
|
||||
/// Create a unpacked array dimension type.
|
||||
MlirType mooreUnpackedArrayDimTypeGet(MlirType inner, unsigned size) {
|
||||
return wrap(UnpackedArrayDim::get(unwrap(inner).cast<UnpackedType>(), size));
|
||||
return wrap(UnpackedArrayDim::get(cast<UnpackedType>(unwrap(inner)), size));
|
||||
}
|
||||
|
||||
/// Create a unpacked range dimension type.
|
||||
MlirType mooreUnpackedRangeDimTypeGet(MlirType inner, unsigned size, bool upDir,
|
||||
int offset) {
|
||||
RangeDir dir = upDir ? RangeDir::Up : RangeDir::Down;
|
||||
return wrap(UnpackedRangeDim::get(unwrap(inner).cast<UnpackedType>(), size,
|
||||
return wrap(UnpackedRangeDim::get(cast<UnpackedType>(unwrap(inner)), size,
|
||||
dir, offset));
|
||||
}
|
||||
|
||||
/// Create a unpacked assoc dimension type without index.
|
||||
MlirType mooreUnpackedAssocDimTypeGet(MlirType inner) {
|
||||
return wrap(UnpackedAssocDim::get(unwrap(inner).cast<UnpackedType>()));
|
||||
return wrap(UnpackedAssocDim::get(cast<UnpackedType>(unwrap(inner))));
|
||||
}
|
||||
|
||||
/// Create a unpacked assoc dimension type with index.
|
||||
MlirType mooreUnpackedAssocDimTypeGetWithIndex(MlirType inner,
|
||||
MlirType indexType) {
|
||||
return wrap(UnpackedAssocDim::get(unwrap(inner).cast<UnpackedType>(),
|
||||
unwrap(indexType).cast<UnpackedType>()));
|
||||
return wrap(UnpackedAssocDim::get(cast<UnpackedType>(unwrap(inner)),
|
||||
cast<UnpackedType>(unwrap(indexType))));
|
||||
}
|
||||
|
||||
/// Create a unpacked queue dimension type without bound.
|
||||
MlirType mooreUnpackedQueueDimTypeGet(MlirType inner) {
|
||||
return wrap(UnpackedQueueDim::get(unwrap(inner).cast<UnpackedType>()));
|
||||
return wrap(UnpackedQueueDim::get(cast<UnpackedType>(unwrap(inner))));
|
||||
}
|
||||
|
||||
/// Create a unpacked queue dimension type with bound.
|
||||
MlirType mooreUnpackedQueueDimTypeGetWithBound(MlirType inner, unsigned bound) {
|
||||
return wrap(UnpackedQueueDim::get(unwrap(inner).cast<UnpackedType>(), bound));
|
||||
return wrap(UnpackedQueueDim::get(cast<UnpackedType>(unwrap(inner)), bound));
|
||||
}
|
||||
|
||||
/// Create a enum type without base.
|
||||
MlirType mooreEnumTypeGet(MlirAttribute name, MlirLocation loc) {
|
||||
return wrap(EnumType::get(unwrap(name).cast<StringAttr>(), unwrap(loc)));
|
||||
return wrap(EnumType::get(cast<StringAttr>(unwrap(name)), unwrap(loc)));
|
||||
}
|
||||
|
||||
/// Create a enum type width base.
|
||||
MlirType mooreEnumTypeGetWithBase(MlirAttribute name, MlirLocation loc,
|
||||
MlirType base) {
|
||||
return wrap(EnumType::get(unwrap(name).cast<StringAttr>(), unwrap(loc),
|
||||
unwrap(base).cast<PackedType>()));
|
||||
return wrap(EnumType::get(cast<StringAttr>(unwrap(name)), unwrap(loc),
|
||||
cast<PackedType>(unwrap(base))));
|
||||
}
|
||||
|
||||
/// Create a simple bit-vector type.
|
||||
|
@ -197,15 +197,15 @@ MlirType mooreSimpleBitVectorTypeGet(MlirContext ctx, bool isFourValued,
|
|||
|
||||
/// Checks whether the passed UnpackedType is a four-valued type.
|
||||
bool mooreIsFourValuedType(MlirType type) {
|
||||
return unwrap(type).cast<UnpackedType>().getDomain() == Domain::FourValued;
|
||||
return cast<UnpackedType>(unwrap(type)).getDomain() == Domain::FourValued;
|
||||
}
|
||||
|
||||
/// Checks whether the passed type is a simple bit-vector.
|
||||
bool mooreIsSimpleBitVectorType(MlirType type) {
|
||||
return unwrap(type).cast<UnpackedType>().isSimpleBitVector();
|
||||
return cast<UnpackedType>(unwrap(type)).isSimpleBitVector();
|
||||
}
|
||||
|
||||
/// Returns the size of a simple bit-vector type in bits.
|
||||
unsigned mooreGetSimpleBitVectorSize(MlirType type) {
|
||||
return unwrap(type).cast<UnpackedType>().getSimpleBitVector().size;
|
||||
return cast<UnpackedType>(unwrap(type)).getSimpleBitVector().size;
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ LogicalResult ConstantOp::verify() {
|
|||
|
||||
void ConstantOp::build(OpBuilder &builder, OperationState &result, Type type,
|
||||
const APInt &value) {
|
||||
auto sbvt = type.cast<UnpackedType>().getSimpleBitVector();
|
||||
auto sbvt = cast<UnpackedType>(type).getSimpleBitVector();
|
||||
assert(sbvt.size == value.getBitWidth() &&
|
||||
"APInt width must match simple bit vector's bit width");
|
||||
build(builder, result, type,
|
||||
|
@ -136,7 +136,7 @@ void ConstantOp::build(OpBuilder &builder, OperationState &result, Type type,
|
|||
/// `int64_t`.
|
||||
void ConstantOp::build(OpBuilder &builder, OperationState &result, Type type,
|
||||
int64_t value) {
|
||||
auto sbvt = type.cast<UnpackedType>().getSimpleBitVector();
|
||||
auto sbvt = cast<UnpackedType>(type).getSimpleBitVector();
|
||||
build(builder, result, type,
|
||||
APInt(sbvt.size, (uint64_t)value, /*isSigned=*/true));
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ LogicalResult ConcatOp::inferReturnTypes(
|
|||
Domain domain = Domain::TwoValued;
|
||||
unsigned size = 0;
|
||||
for (auto operand : operands) {
|
||||
auto type = operand.getType().cast<UnpackedType>().getSimpleBitVector();
|
||||
auto type = cast<UnpackedType>(operand.getType()).getSimpleBitVector();
|
||||
if (type.domain == Domain::FourValued)
|
||||
domain = Domain::FourValued;
|
||||
size += type.size;
|
||||
|
|
|
@ -168,7 +168,7 @@ SimpleBitVectorType UnpackedType::getSimpleBitVectorOrNull() const {
|
|||
.Case<PackedRangeDim>([](auto rangeType) {
|
||||
// Inner type must be an integer.
|
||||
auto innerType =
|
||||
rangeType.getInner().fullyResolved().template dyn_cast<IntType>();
|
||||
llvm::dyn_cast<IntType>(rangeType.getInner().fullyResolved());
|
||||
if (!innerType)
|
||||
return SimpleBitVectorType{};
|
||||
|
||||
|
@ -197,7 +197,7 @@ SimpleBitVectorType UnpackedType::castToSimpleBitVectorOrNull() const {
|
|||
|
||||
// All packed types with a known size (i.e., with no `[]` dimensions) can be
|
||||
// cast to an SBVT.
|
||||
auto packed = fullyResolved().dyn_cast<PackedType>();
|
||||
auto packed = llvm::dyn_cast<PackedType>(fullyResolved());
|
||||
if (!packed)
|
||||
return {};
|
||||
auto bitSize = packed.getBitSize();
|
||||
|
@ -737,7 +737,7 @@ struct RangeDimStorage : DimStorage {
|
|||
} // namespace circt
|
||||
|
||||
PackedType PackedDim::getInner() const {
|
||||
return getImpl()->inner.cast<PackedType>();
|
||||
return llvm::cast<PackedType>(getImpl()->inner);
|
||||
}
|
||||
|
||||
void PackedDim::format(llvm::raw_ostream &os) const {
|
||||
|
@ -745,7 +745,7 @@ void PackedDim::format(llvm::raw_ostream &os) const {
|
|||
dims.push_back(*this);
|
||||
for (;;) {
|
||||
PackedType inner = dims.back().getInner();
|
||||
if (auto dim = inner.dyn_cast<PackedDim>()) {
|
||||
if (auto dim = llvm::dyn_cast<PackedDim>(inner)) {
|
||||
dims.push_back(dim);
|
||||
} else {
|
||||
inner.format(os);
|
||||
|
@ -767,11 +767,11 @@ void PackedDim::formatDim(llvm::raw_ostream &os) const {
|
|||
}
|
||||
|
||||
PackedType PackedDim::resolved() const {
|
||||
return getImpl()->resolved.cast<PackedType>();
|
||||
return llvm::cast<PackedType>(getImpl()->resolved);
|
||||
}
|
||||
|
||||
PackedType PackedDim::fullyResolved() const {
|
||||
return getImpl()->fullyResolved.cast<PackedType>();
|
||||
return llvm::cast<PackedType>(getImpl()->fullyResolved);
|
||||
}
|
||||
|
||||
std::optional<Range> PackedDim::getRange() const {
|
||||
|
@ -853,7 +853,7 @@ void UnpackedDim::format(
|
|||
dims.push_back(*this);
|
||||
for (;;) {
|
||||
UnpackedType inner = dims.back().getInner();
|
||||
if (auto dim = inner.dyn_cast<UnpackedDim>()) {
|
||||
if (auto dim = llvm::dyn_cast<UnpackedDim>(inner)) {
|
||||
dims.push_back(dim);
|
||||
} else {
|
||||
inner.format(os);
|
||||
|
@ -1127,7 +1127,7 @@ PackedStructType PackedStructType::get(StructKind kind,
|
|||
std::optional<Sign> sign) {
|
||||
assert(llvm::all_of(members,
|
||||
[](const StructMember &member) {
|
||||
return member.type.isa<PackedType>();
|
||||
return llvm::isa<PackedType>(member.type);
|
||||
}) &&
|
||||
"packed struct members must be packed");
|
||||
return Base::get(loc.getContext(),
|
||||
|
@ -1294,7 +1294,7 @@ static OptionalParseResult customTypeParser(DialectAsmParser &parser,
|
|||
return failure();
|
||||
return yieldImplied(
|
||||
[&]() {
|
||||
return PackedNamedType::get(inner.cast<PackedType>(), name, loc);
|
||||
return PackedNamedType::get(cast<PackedType>(inner), name, loc);
|
||||
},
|
||||
[&]() { return UnpackedNamedType::get(inner, name, loc); });
|
||||
}
|
||||
|
@ -1306,7 +1306,7 @@ static OptionalParseResult customTypeParser(DialectAsmParser &parser,
|
|||
parser.parseGreater())
|
||||
return failure();
|
||||
return yieldImplied(
|
||||
[&]() { return PackedRefType::get(inner.cast<PackedType>(), loc); },
|
||||
[&]() { return PackedRefType::get(cast<PackedType>(inner), loc); },
|
||||
[&]() { return UnpackedRefType::get(inner, loc); });
|
||||
}
|
||||
|
||||
|
@ -1317,7 +1317,7 @@ static OptionalParseResult customTypeParser(DialectAsmParser &parser,
|
|||
parser.parseGreater())
|
||||
return failure();
|
||||
return yieldImplied(
|
||||
[&]() { return PackedUnsizedDim::get(inner.cast<PackedType>()); },
|
||||
[&]() { return PackedUnsizedDim::get(cast<PackedType>(inner)); },
|
||||
[&]() { return UnpackedUnsizedDim::get(inner); });
|
||||
}
|
||||
if (mnemonic == "range") {
|
||||
|
@ -1330,7 +1330,7 @@ static OptionalParseResult customTypeParser(DialectAsmParser &parser,
|
|||
return failure();
|
||||
return yieldImplied(
|
||||
[&]() {
|
||||
return PackedRangeDim::get(inner.cast<PackedType>(), left, right);
|
||||
return PackedRangeDim::get(cast<PackedType>(inner), left, right);
|
||||
},
|
||||
[&]() { return UnpackedRangeDim::get(inner, left, right); });
|
||||
}
|
||||
|
@ -1437,10 +1437,13 @@ static LogicalResult customTypePrinter(Type type, DialectAsmPrinter &printer,
|
|||
// If we are printing a type that may be both packed or unpacked, emit a
|
||||
// wrapping `packed<...>` or `unpacked<...>` accordingly if not done so
|
||||
// previously, in order to disambiguate between the two.
|
||||
if (type.isa<PackedDim>() || type.isa<UnpackedDim>() ||
|
||||
type.isa<PackedIndirectType>() || type.isa<UnpackedIndirectType>() ||
|
||||
type.isa<PackedStructType>() || type.isa<UnpackedStructType>()) {
|
||||
auto needed = type.isa<PackedType>() ? Subset::Packed : Subset::Unpacked;
|
||||
if (llvm::isa<PackedDim>(type) || llvm::isa<UnpackedDim>(type) ||
|
||||
llvm::isa<PackedIndirectType>(type) ||
|
||||
llvm::isa<UnpackedIndirectType>(type) ||
|
||||
llvm::isa<PackedStructType>(type) ||
|
||||
llvm::isa<UnpackedStructType>(type)) {
|
||||
auto needed =
|
||||
llvm::isa<PackedType>(type) ? Subset::Packed : Subset::Unpacked;
|
||||
if (needed != subset.implied) {
|
||||
printer << (needed == Subset::Packed ? "packed" : "unpacked") << "<";
|
||||
printMooreType(type, printer, {needed, true});
|
||||
|
@ -1550,7 +1553,7 @@ static LogicalResult customTypePrinter(Type type, DialectAsmPrinter &printer,
|
|||
printer << getMnemonicFromStructKind(strukt.kind) << "<";
|
||||
if (strukt.name)
|
||||
printer << strukt.name << ", ";
|
||||
auto packed = type.template dyn_cast<PackedStructType>();
|
||||
auto packed = llvm::dyn_cast<PackedStructType>(type);
|
||||
if (packed && packed.isSignExplicit())
|
||||
printer << packed.getSign() << ", ";
|
||||
printer << "{";
|
||||
|
|
Loading…
Reference in New Issue