14#include "mlir/CAPI/IR.h"
15#include "mlir/CAPI/Registration.h"
16#include "mlir/CAPI/Support.h"
25 return llvm::isa<ClockType>(
unwrap(type));
33 return llvm::isa<ImmutableType>(
unwrap(type));
37 return wrap(ImmutableType::get(
unwrap(innerType)));
41 return wrap(llvm::cast<ImmutableType>(
unwrap(type)).getInnerType());
45 return llvm::isa<HLMemType>(
unwrap(type));
50 llvm::SmallVector<int64_t> shapeVec(shape, shape + rank);
55 return wrap(llvm::cast<HLMemType>(
unwrap(type)).getElementType());
59 return llvm::cast<HLMemType>(
unwrap(type)).getRank();
63 return llvm::cast<HLMemType>(
unwrap(type)).getShape().data();
67 return llvm::isa<FirMemType>(
unwrap(type));
71 const uint32_t *maskWidth) {
72 std::optional<uint32_t> maskOpt;
75 return wrap(FirMemType::get(
unwrap(ctx), depth, width, maskOpt));
79 return llvm::cast<FirMemType>(
unwrap(type)).getDepth();
83 return llvm::cast<FirMemType>(
unwrap(type)).getWidth();
87 return llvm::cast<FirMemType>(
unwrap(type)).getMaskWidth().has_value();
91 return llvm::cast<FirMemType>(
unwrap(type)).getMaskWidth().value_or(0);
return wrap(CMemoryType::get(unwrap(ctx), baseType, numElements))
MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(CHIRRTL, chirrtl, circt::chirrtl::CHIRRTLDialect) MlirType chirrtlTypeGetCMemory(MlirContext ctx
static EvaluatorValuePtr unwrap(OMEvaluatorValue c)
MlirType seqHLMemTypeGet(MlirContext ctx, intptr_t rank, const int64_t *shape, MlirType elementType)
Creates a seq HLMem type.
uint32_t seqFirMemTypeGetWidth(MlirType type)
Gets the width of a FirMem type.
MlirType seqImmutableTypeGet(MlirType innerType)
Creates a seq immutable type.
bool seqFirMemTypeHasMask(MlirType type)
Returns true if the FirMem type has a mask width defined.
MlirType seqImmutableTypeGetInnerType(MlirType type)
Creates a seq immutable type.
uint64_t seqFirMemTypeGetDepth(MlirType type)
Gets the depth of a FirMem type.
bool seqTypeIsAHLMem(MlirType type)
If the type is a HLMemType.
intptr_t seqHLMemTypeGetRank(MlirType type)
Gets the rank of an HLMem type.
const int64_t * seqHLMemTypeGetShape(MlirType type)
Gets a pointer to the shape array of an HLMem type The array length is equal to the rank.
bool seqTypeIsAFirMem(MlirType type)
If the type is a FirMem type.
MlirType seqHLMemTypeGetElementType(MlirType type)
Gets the element type of an HLMem type.
MlirType seqClockTypeGet(MlirContext ctx)
Creates an seq clock type.
bool seqTypeIsAImmutable(MlirType type)
If the type is an immutable type.
MlirType seqFirMemTypeGet(MlirContext ctx, uint64_t depth, uint32_t width, const uint32_t *maskWidth)
Creates a seq FirMem type.
uint32_t seqFirMemTypeGetMaskWidth(MlirType type)
Gets the mask width of a FirMem type Behavior is undefined if seqFirMemTypeHasMask returns false.
bool seqTypeIsAClock(MlirType type)
If the type is an clock type.