[CAPI][Moore] Remove signedness

Update the Moore C API to match changes made to the type system. CI
doesn't build the C API currently, which means these breakages often go
unnoticed.
This commit is contained in:
Fabian Schuiki 2024-05-09 10:35:14 -07:00
parent 3008f9cedb
commit 1a311bbc32
No known key found for this signature in database
GPG Key ID: C42F5825FC5275E6
2 changed files with 5 additions and 31 deletions

View File

@ -58,15 +58,6 @@ enum MooreRealKind {
MooreRealTime,
};
enum MooreSign {
/// No sign is explicitly given.
MooreNone,
/// Explicitly marked to be unsigned.
MooreUnsigned,
/// Explicitly marked to be signed.
MooreSigned,
};
/// Create a void type.
MLIR_CAPI_EXPORTED MlirType mooreVoidTypeGet(MlirContext ctx);
/// Create a string type.
@ -77,8 +68,7 @@ MLIR_CAPI_EXPORTED MlirType mooreChandleTypeGet(MlirContext ctx);
MLIR_CAPI_EXPORTED MlirType mooreEventTypeGet(MlirContext ctx);
/// Create an int type.
MLIR_CAPI_EXPORTED MlirType mooreIntTypeGet(MlirContext ctx,
enum MooreIntKind kind,
enum MooreSign sign);
enum MooreIntKind kind);
/// Create a `logic` type.
MLIR_CAPI_EXPORTED MlirType mooreIntTypeGetLogic(MlirContext ctx);
/// Create an `int` type.
@ -119,7 +109,6 @@ mooreUnpackedQueueDimTypeGetWithBound(MlirType inner, unsigned bound);
/// Create a simple bit-vector type.
MLIR_CAPI_EXPORTED MlirType mooreSimpleBitVectorTypeGet(MlirContext ctx,
bool isFourValued,
bool isSigned,
unsigned size);
/// Checks whether the passed UnpackedType is a four-valued type.
MLIR_CAPI_EXPORTED bool mooreIsFourValuedType(MlirType type);

View File

@ -26,18 +26,6 @@ MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(Moore, moore, MooreDialect)
// Types
//===----------------------------------------------------------------------===//
static std::optional<Sign> convertMooreSign(enum MooreSign sign) {
switch (sign) {
case MooreSign::MooreSigned:
return Sign::Signed;
case MooreSign::MooreUnsigned:
return Sign::Unsigned;
case MooreSign::MooreNone:
return {};
}
llvm_unreachable("All cases should be covered.");
}
static IntType::Kind convertMooreIntKind(enum MooreIntKind kind) {
switch (kind) {
case MooreIntKind::MooreBit:
@ -96,10 +84,8 @@ MlirType mooreEventTypeGet(MlirContext ctx) {
}
/// Create an int type.
MlirType mooreIntTypeGet(MlirContext ctx, enum MooreIntKind kind,
enum MooreSign sign) {
return wrap(IntType::get(unwrap(ctx), convertMooreIntKind(kind),
convertMooreSign(sign)));
MlirType mooreIntTypeGet(MlirContext ctx, enum MooreIntKind kind) {
return wrap(IntType::get(unwrap(ctx), convertMooreIntKind(kind)));
}
/// Create a `logic` type.
@ -177,10 +163,9 @@ MlirType mooreUnpackedQueueDimTypeGetWithBound(MlirType inner, unsigned bound) {
/// Create a simple bit-vector type.
MlirType mooreSimpleBitVectorTypeGet(MlirContext ctx, bool isFourValued,
bool isSigned, unsigned size) {
unsigned size) {
Domain domain = isFourValued ? Domain::FourValued : Domain::TwoValued;
Sign sign = isSigned ? Sign::Signed : Sign::Unsigned;
return wrap(SimpleBitVectorType(domain, sign, size).getType(unwrap(ctx)));
return wrap(SimpleBitVectorType(domain, size).getType(unwrap(ctx)));
}
/// Checks whether the passed UnpackedType is a four-valued type.