Skip to content

Commit

Permalink
[Moore] Move array types into ODS (#7088)
Browse files Browse the repository at this point in the history
Move the definitions of all array types from C++ land into
`MooreTypes.td`. This removes a significant amount of redundant code and
simplifies the dialect's type system.

Replace packed and unpacked ranges (`T [4:3]` or `T [2:4]`) with a new
type that discards the directionality and offset of the range. This
information is no longer needed at the IR level. Any meaning that the
offsets have can be encoded in the corresponding ops. Both ranges are
now represented as `array<2 x T>` and `array<3 x T>`, respectively.

Combine unpacked ranges (`T foo [6:2]`) and unpacked arrays
(`T foo [42]`) into a single `uarray<N x T>` type.
  • Loading branch information
fabianschuiki committed May 26, 2024
1 parent 021c3c2 commit a778922
Show file tree
Hide file tree
Showing 13 changed files with 357 additions and 857 deletions.
42 changes: 16 additions & 26 deletions include/circt-c/Dialect/Moore.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,32 +40,22 @@ MLIR_CAPI_EXPORTED MlirType mooreIntTypeGetLogic(MlirContext ctx,
unsigned width);
/// Create a real type.
MLIR_CAPI_EXPORTED MlirType mooreRealTypeGet(MlirContext ctx);
/// Create a packed unsized dimension type.
MLIR_CAPI_EXPORTED MlirType moorePackedUnsizedDimTypeGet(MlirType inner);
/// Create a packed range dimension type.
MLIR_CAPI_EXPORTED MlirType moorePackedRangeDimTypeGet(MlirType inner,
unsigned size,
bool upDir, int offset);
/// Create a unpacked unsized dimension type.
MLIR_CAPI_EXPORTED MlirType mooreUnpackedUnsizedDimTypeGet(MlirType inner);
/// Create a unpacked array dimension type.
MLIR_CAPI_EXPORTED MlirType mooreUnpackedArrayDimTypeGet(MlirType inner,
unsigned size);
/// Create a unpacked range dimension type.
MLIR_CAPI_EXPORTED MlirType mooreUnpackedRangeDimTypeGet(MlirType inner,
unsigned size,
bool upDir,
int offset);
/// Create a unpacked assoc dimension type without index.
MLIR_CAPI_EXPORTED MlirType mooreUnpackedAssocDimTypeGet(MlirType inner);
/// Create a unpacked assoc dimension type width index.
MLIR_CAPI_EXPORTED MlirType
mooreUnpackedAssocDimTypeGetWithIndex(MlirType inner, MlirType indexType);
/// Create a unpacked queue dimension type without bound.
MLIR_CAPI_EXPORTED MlirType mooreUnpackedQueueDimTypeGet(MlirType inner);
/// Create a unpacked queue dimension type with bound.
MLIR_CAPI_EXPORTED MlirType
mooreUnpackedQueueDimTypeGetWithBound(MlirType inner, unsigned bound);
/// Create a packed open array type.
MLIR_CAPI_EXPORTED MlirType mooreOpenArrayTypeGet(MlirType elementType);
/// Create a packed array type.
MLIR_CAPI_EXPORTED MlirType mooreArrayTypeGet(unsigned size,
MlirType elementType);
/// Create an unpacked open array type.
MLIR_CAPI_EXPORTED MlirType mooreOpenUnpackedArrayTypeGet(MlirType elementType);
/// Create an unpacked array type.
MLIR_CAPI_EXPORTED MlirType mooreUnpackedArrayTypeGet(unsigned size,
MlirType elementType);
/// Create an unpacked associative array type.
MLIR_CAPI_EXPORTED MlirType mooreAssocArrayTypeGet(MlirType elementType,
MlirType indexType);
/// Create an unpacked queue type.
MLIR_CAPI_EXPORTED MlirType mooreQueueTypeGet(MlirType elementType,
unsigned bound);
/// Checks whether the passed UnpackedType is a two-valued type.
MLIR_CAPI_EXPORTED bool mooreIsTwoValuedType(MlirType type);
/// Checks whether the passed UnpackedType is a four-valued type.
Expand Down
Loading

0 comments on commit a778922

Please sign in to comment.