13#include "mlir/CAPI/Registration.h"
32 return isa<SequenceType>(
unwrap(type));
36 MlirType
const *elementTypes) {
37 SmallVector<Type> types;
39 types.emplace_back(
unwrap(elementTypes[i]));
40 return wrap(SequenceType::get(
unwrap(ctxt), types));
44 return cast<SequenceType>(
unwrap(type)).getElementTypes().size();
48 return wrap(cast<SequenceType>(
unwrap(type)).getElementTypes()[i]);
55 return isa<RandomizedSequenceType>(
unwrap(type));
59 return wrap(RandomizedSequenceType::get(
unwrap(ctxt)));
78 return wrap(SetType::get(ty.getContext(), ty));
88 return wrap(BagType::get(ty.getContext(), ty));
97 MlirAttribute
const *entryNames,
98 MlirType
const *entryTypes) {
99 SmallVector<DictEntry> entries;
100 for (
unsigned i = 0; i < numEntries; ++i) {
102 entry.
name = cast<StringAttr>(
unwrap(entryNames[i]));
104 entries.emplace_back(entry);
106 return wrap(DictType::get(
unwrap(ctxt), entries));
114 return isa<LabelVisibilityAttr>(
unwrap(attr));
118 auto convert = [](LabelVisibility visibility) {
119 switch (visibility) {
120 case LabelVisibility::local:
122 case LabelVisibility::global:
124 case LabelVisibility::external:
128 return convert(cast<LabelVisibilityAttr>(
unwrap(attr)).getValue());
134 switch (visibility) {
136 return LabelVisibility::local;
138 return LabelVisibility::global;
140 return LabelVisibility::external;
143 return wrap(LabelVisibilityAttr::get(
unwrap(ctxt), convert(visibility)));
return wrap(CMemoryType::get(unwrap(ctx), baseType, numElements))
MlirType uint64_t numElements
MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(CHIRRTL, chirrtl, circt::chirrtl::CHIRRTLDialect) MlirType chirrtlTypeGetCMemory(MlirContext ctx
static EvaluatorValuePtr unwrap(OMEvaluatorValue c)
bool rtgTypeIsABag(MlirType type)
If the type is an RTG bag.
MlirType rtgSequenceTypeGetElement(MlirType type, unsigned i)
The type of of the substitution element at the given index.
bool rtgTypeIsARandomizedSequence(MlirType type)
If the type is an RTG randomized sequence.
RTGLabelVisibility rtgLabelVisibilityAttrGetValue(MlirAttribute attr)
Get the RTG label visibility from the attribute.
MlirType rtgSetTypeGet(MlirType elementType)
Creates an RTG set type in the context.
MlirAttribute rtgLabelVisibilityAttrGet(MlirContext ctxt, RTGLabelVisibility visibility)
Creates an RTG label visibility attribute in the context.
bool rtgAttrIsALabelVisibilityAttr(MlirAttribute attr)
If the attribute is an RTG label visibility.
MlirType rtgSequenceTypeGet(MlirContext ctxt, intptr_t numElements, MlirType const *elementTypes)
Creates an RTG sequence type in the context.
bool rtgTypeIsASet(MlirType type)
If the type is an RTG set.
bool rtgTypeIsADict(MlirType type)
If the type is an RTG dict.
unsigned rtgSequenceTypeGetNumElements(MlirType type)
The number of substitution elements of the RTG sequence.
MlirType rtgRandomizedSequenceTypeGet(MlirContext ctxt)
Creates an RTG randomized sequence type in the context.
bool rtgTypeIsALabel(MlirType type)
If the type is an RTG label.
MlirType rtgDictTypeGet(MlirContext ctxt, intptr_t numEntries, MlirAttribute const *entryNames, MlirType const *entryTypes)
Creates an RTG dict type in the context.
bool rtgTypeIsASequence(MlirType type)
If the type is an RTG sequence.
MlirType rtgBagTypeGet(MlirType elementType)
Creates an RTG bag type in the context.
MlirType rtgLabelTypeGet(MlirContext ctxt)
Creates an RTG mode type in the context.
@ RTG_LABEL_VISIBILITY_EXTERNAL
@ RTG_LABEL_VISIBILITY_GLOBAL
@ RTG_LABEL_VISIBILITY_LOCAL
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Defines an entry in an !rtg.dict.