13#include "mlir/Bindings/Python/NanobindAdaptors.h"
15#include <nanobind/nanobind.h>
20using namespace mlir::python::nanobind_adaptors;
24 m.doc() =
"RTG dialect Python native extension";
29 [](nb::object cls, std::vector<MlirType> &elementTypes,
32 elementTypes.data()));
34 nb::arg(
"self"), nb::arg(
"elementTypes") = std::vector<MlirType>(),
35 nb::arg(
"ctxt") =
nullptr)
36 .def_property_readonly(
39 .def(
"get_element", [](MlirType self,
unsigned i) {
46 [](nb::object cls, MlirContext ctxt) {
49 nb::arg(
"self"), nb::arg(
"ctxt") =
nullptr);
54 [](nb::object cls, MlirContext ctxt) {
57 nb::arg(
"self"), nb::arg(
"ctxt") =
nullptr);
65 nb::arg(
"self"), nb::arg(
"element_type"));
73 nb::arg(
"self"), nb::arg(
"element_type"));
78 [](nb::object cls, MlirContext ctxt,
79 const std::vector<std::pair<MlirAttribute, MlirType>> &entries) {
80 std::vector<MlirAttribute> names;
81 std::vector<MlirType> types;
82 for (
auto entry : entries) {
83 names.push_back(entry.first);
84 types.push_back(entry.second);
89 nb::arg(
"self"), nb::arg(
"ctxt") =
nullptr,
91 std::vector<std::pair<MlirAttribute, MlirType>>());
93 nb::enum_<RTGLabelVisibility>(m,
"LabelVisibility")
99 mlir_attribute_subclass(m,
"LabelVisibilityAttr",
106 nb::arg(
"self"), nb::arg(
"visibility"), nb::arg(
"ctxt") =
nullptr)
107 .def_property_readonly(
"value", [](MlirAttribute self) {
MLIR_CAPI_EXPORTED MlirType rtgLabelTypeGet(MlirContext ctxt)
Creates an RTG mode type in the context.
MLIR_CAPI_EXPORTED RTGLabelVisibility rtgLabelVisibilityAttrGetValue(MlirAttribute attr)
Get the RTG label visibility from the attribute.
@ RTG_LABEL_VISIBILITY_EXTERNAL
@ RTG_LABEL_VISIBILITY_GLOBAL
@ RTG_LABEL_VISIBILITY_LOCAL
MLIR_CAPI_EXPORTED MlirType rtgSequenceTypeGetElement(MlirType type, unsigned i)
The type of of the substitution element at the given index.
MLIR_CAPI_EXPORTED bool rtgAttrIsALabelVisibilityAttr(MlirAttribute attr)
If the attribute is an RTG label visibility.
MLIR_CAPI_EXPORTED MlirAttribute rtgLabelVisibilityAttrGet(MlirContext ctxt, RTGLabelVisibility visibility)
Creates an RTG label visibility attribute in the context.
MLIR_CAPI_EXPORTED bool rtgTypeIsABag(MlirType type)
If the type is an RTG bag.
MLIR_CAPI_EXPORTED MlirType rtgSequenceTypeGet(MlirContext ctxt, intptr_t numElements, MlirType const *elementTypes)
Creates an RTG sequence type in the context.
MLIR_CAPI_EXPORTED unsigned rtgSequenceTypeGetNumElements(MlirType type)
The number of substitution elements of the RTG sequence.
MLIR_CAPI_EXPORTED MlirType rtgSetTypeGet(MlirType elementType)
Creates an RTG set type in the context.
MLIR_CAPI_EXPORTED bool rtgTypeIsASet(MlirType type)
If the type is an RTG set.
MLIR_CAPI_EXPORTED MlirType rtgRandomizedSequenceTypeGet(MlirContext ctxt)
Creates an RTG randomized sequence type in the context.
MLIR_CAPI_EXPORTED bool rtgTypeIsARandomizedSequence(MlirType type)
If the type is an RTG randomized sequence.
MLIR_CAPI_EXPORTED bool rtgTypeIsADict(MlirType type)
If the type is an RTG dict.
MLIR_CAPI_EXPORTED MlirType rtgDictTypeGet(MlirContext ctxt, intptr_t numEntries, MlirAttribute const *entryNames, MlirType const *entryTypes)
Creates an RTG dict type in the context.
MLIR_CAPI_EXPORTED MlirType rtgBagTypeGet(MlirType elementType)
Creates an RTG bag type in the context.
MLIR_CAPI_EXPORTED bool rtgTypeIsASequence(MlirType type)
If the type is an RTG sequence.
MLIR_CAPI_EXPORTED bool rtgTypeIsALabel(MlirType type)
If the type is an RTG label.
void populateDialectRTGSubmodule(nanobind::module_ &m)
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.