Lines Matching refs:object

48 /// reference to its underlying python object.
52 PyObjectRef(T *referrent, nanobind::object object)
53 : referrent(referrent), object(std::move(object)) {
56 assert(this->object && "cannot construct PyObjectRef with null object");
59 : referrent(other.referrent), object(std::move(other.object)) {
61 assert(!other.object);
64 : referrent(other.referrent), object(other.object /* copies */) {}
68 if (!object)
70 return Py_REFCNT(object.ptr());
73 /// Releases the object held by this instance, returning it.
76 nanobind::object releaseObject() {
77 assert(referrent && object);
79 auto stolen = std::move(object);
85 assert(referrent && object);
88 nanobind::object getObject() {
89 assert(referrent && object);
90 return object;
92 operator bool() const { return referrent && object; }
96 nanobind::object object;
115 PyThreadContextEntry(FrameKind frameKind, nanobind::object context,
116 nanobind::object insertionPoint,
117 nanobind::object location)
137 static nanobind::object pushContext(nanobind::object context);
139 static nanobind::object pushInsertionPoint(nanobind::object insertionPoint);
141 static nanobind::object pushLocation(nanobind::object location);
148 static void push(FrameKind frameKind, nanobind::object context,
149 nanobind::object insertionPoint, nanobind::object location);
151 /// An object reference to the PyContext.
152 nanobind::object context;
153 /// An object reference to the current insertion point.
154 nanobind::object insertionPoint;
155 /// An object reference to the current location.
156 nanobind::object location;
172 /// to an nanobind::object. Since the forContext() method acts like a pool,
195 nanobind::object getCapsule();
198 /// Note that PyMlirContext instances are uniqued, so the returned object
199 /// may be a pre-existing object. Ownership of the underlying MlirContext
201 static nanobind::object createFromCapsule(nanobind::object capsule);
241 static nanobind::object contextEnter(nanobind::object context);
242 void contextExit(const nanobind::object &excType,
243 const nanobind::object &excVal,
244 const nanobind::object &excTb);
247 /// registration object (internally a PyDiagnosticHandler).
248 nanobind::object attachDiagnosticHandler(nanobind::object callback);
310 "context object constructed with null context ref");
330 static nanobind::object contextEnter(nanobind::object location);
331 void contextExit(const nanobind::object &excType,
332 const nanobind::object &excVal,
333 const nanobind::object &excTb);
336 nanobind::object getCapsule();
339 /// Note that PyLocation instances are uniqued, so the returned object
340 /// may be a pre-existing object. Ownership of the underlying MlirLocation
342 static PyLocation createFromCapsule(nanobind::object capsule);
399 /// The object may remain live from a Python perspective for an arbitrary time
401 /// is no way to attach an existing handler object).
404 PyDiagnosticHandler(MlirContext context, nanobind::object callback);
413 nanobind::object contextEnter() { return nanobind::cast(this); }
414 void contextExit(const nanobind::object &excType,
415 const nanobind::object &excVal,
416 const nanobind::object &excTb) {
422 nanobind::object callback;
428 /// RAII object that captures any error diagnostics emitted to the provided
455 /// This should be seen as the "low-level" object and `Dialect` as the
456 /// high-level, user facing object.
468 /// User-level object for accessing dialects with dotted syntax such as:
478 /// User-level dialect object. For dialects that have a registered extension,
483 PyDialect(nanobind::object descriptor) : descriptor(std::move(descriptor)) {}
485 nanobind::object getDescriptor() { return descriptor; }
488 nanobind::object descriptor;
511 nanobind::object getCapsule();
512 static PyDialectRegistry createFromCapsule(nanobind::object capsule);
531 /// This is the top-level, user-owned object that contains regions/ops/blocks.
537 /// a pre-existing or new object.
548 return PyModuleRef(this, nanobind::borrow<nanobind::object>(handle));
555 nanobind::object getCapsule();
558 /// Note that PyModule instances are uniqued, so the returned object
559 /// may be a pre-existing object. Ownership of the underlying MlirModule
561 static nanobind::object createFromCapsule(nanobind::object capsule);
579 bool assumeVerified, nanobind::object fileObject, bool binary,
581 void print(PyAsmState &state, nanobind::object fileObject, bool binary);
583 nanobind::object getAsm(bool binary,
590 void writeBytecode(const nanobind::object &fileObject,
626 nanobind::object parentKeepAlive = nanobind::object());
632 nanobind::object parentKeepAlive = nanobind::object());
645 parentKeepAlive = nanobind::object();
656 return PyOperationRef(this, nanobind::borrow<nanobind::object>(handle));
660 void setAttached(const nanobind::object &parent = nanobind::object()) {
679 nanobind::object getCapsule();
684 static nanobind::object createFromCapsule(nanobind::object capsule);
687 static nanobind::object
692 DefaultingPyLocation location, const nanobind::object &ip,
696 nanobind::object createOpView();
706 nanobind::object clone(const nanobind::object &ip);
713 nanobind::object parentKeepAlive);
723 nanobind::object parentKeepAlive;
738 PyOpView(const nanobind::object &operationObject);
741 nanobind::object getOperationObject() { return operationObject; }
743 static nanobind::object
745 nanobind::object operandSegmentSpecObj,
746 nanobind::object resultSegmentSpecObj,
752 const nanobind::object &maybeIp);
761 static nanobind::object constructDerived(const nanobind::object &cls,
762 const nanobind::object &operation);
766 nanobind::object operationObject; // Holds the reference.
839 nanobind::object getCapsule();
867 static nanobind::object contextEnter(nanobind::object insertionPoint);
868 void contextExit(const nanobind::object &excType,
869 const nanobind::object &excVal,
870 const nanobind::object &excTb);
895 nanobind::object getCapsule();
898 /// Note that PyType instances are uniqued, so the returned object
899 /// may be a pre-existing object. Ownership of the underlying MlirType
901 static PyType createFromCapsule(nanobind::object capsule);
921 nanobind::object getCapsule();
924 static PyTypeID createFromCapsule(nanobind::object capsule);
976 "static_typeid", [](nanobind::object & /*class*/) -> MlirTypeID {
1021 nanobind::object getCapsule();
1024 /// Note that PyAttribute instances are uniqued, so the returned object
1025 /// may be a pre-existing object. Ownership of the underlying MlirAttribute
1027 static PyAttribute createFromCapsule(nanobind::object capsule);
1050 // Otherwise, strings that fit within the small object optimization threshold
1051 // will have their memory address change as the containing object is moved,
1109 "static_typeid", [](nanobind::object & /*class*/) -> MlirTypeID {
1168 nanobind::object getCapsule();
1170 nanobind::object maybeDownCast();
1174 static PyValue createFromCapsule(nanobind::object capsule);
1191 nanobind::object getCapsule();
1194 /// Note that PyAffineExpr instances are uniqued, so the returned object
1195 /// may be a pre-existing object. Ownership of the underlying MlirAffineExpr
1197 static PyAffineExpr createFromCapsule(nanobind::object capsule);
1218 nanobind::object getCapsule();
1221 /// Note that PyAffineMap instances are uniqued, so the returned object
1222 /// may be a pre-existing object. Ownership of the underlying MlirAffineMap
1224 static PyAffineMap createFromCapsule(nanobind::object capsule);
1239 nanobind::object getCapsule();
1242 /// Note that PyIntegerSet instances may be uniqued, so the returned object
1243 /// may be a pre-existing object. Integer sets are owned by the context.
1244 static PyIntegerSet createFromCapsule(nanobind::object capsule);
1261 nanobind::object dunderGetItem(const std::string &name);
1291 nanobind::object callback);