148 std::cout << std::flush;
150 Py_TYPE(self)->tp_free((PyObject*)self);
154 static PyObject* Register_getBitSize(PyObject* self, PyObject* noarg) {
159 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
164 static PyObject* Register_getBitvector(PyObject* self, PyObject* noarg) {
169 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
174 static PyObject* Register_getExtendSize(PyObject* self, PyObject* noarg) {
179 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
184 static PyObject* Register_getExtendType(PyObject* self, PyObject* noarg) {
189 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
194 static PyObject* Register_getId(PyObject* self, PyObject* noarg) {
199 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
204 static PyObject* Register_getName(PyObject* self, PyObject* noarg) {
209 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
214 static PyObject* Register_getShiftType(PyObject* self, PyObject* noarg) {
219 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
224 static PyObject* Register_getShiftImmediate(PyObject* self, PyObject* noarg) {
229 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
234 static PyObject* Register_getShiftRegister(PyObject* self, PyObject* noarg) {
239 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
244 static PyObject* Register_getSize(PyObject* self, PyObject* noarg) {
249 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
254 static PyObject* Register_getType(PyObject* self, PyObject* noarg) {
259 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
264 static PyObject* Register_getVASType(PyObject* self, PyObject* noarg) {
269 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
274 static PyObject* Register_isMutable(PyObject* self, PyObject* noarg) {
281 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
286 static PyObject* Register_isOverlapWith(PyObject* self, PyObject* reg2) {
291 return PyErr_Format(PyExc_TypeError,
"Register::isOverlapWith(): Expected a Register as argument.");
299 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
304 #if !defined(IS_PY3_8) || !IS_PY3_8
305 static int Register_print(PyObject* self,
void* io,
int s) {
312 static long Register_hash(PyObject* self) {
317 static PyObject* Register_str(PyObject* self) {
322 return PyErr_Format(PyExc_TypeError,
"%s", e.
what());
327 static PyObject* Register_richcompare(PyObject* self, PyObject* other,
int op) {
328 PyObject* result =
nullptr;
333 result = Py_NotImplemented;
342 result = (id1 < id2) ? Py_True : Py_False;
345 result = (id1 <= id2) ? Py_True : Py_False;
348 result = (id1 == id2) ? Py_True : Py_False;
351 result = (id1 != id2) ? Py_True : Py_False;
354 result = (id1 > id2) ? Py_True : Py_False;
357 result = (id1 >= id2) ? Py_True : Py_False;
369 {
"getBitSize", Register_getBitSize, METH_NOARGS,
""},
370 {
"getBitvector", Register_getBitvector, METH_NOARGS,
""},
371 {
"getExtendSize", Register_getExtendSize, METH_NOARGS,
""},
372 {
"getExtendType", Register_getExtendType, METH_NOARGS,
""},
373 {
"getId", Register_getId, METH_NOARGS,
""},
374 {
"getName", Register_getName, METH_NOARGS,
""},
375 {
"getShiftImmediate", Register_getShiftImmediate, METH_NOARGS,
""},
376 {
"getShiftRegister", Register_getShiftRegister, METH_NOARGS,
""},
377 {
"getShiftType", Register_getShiftType, METH_NOARGS,
""},
378 {
"getSize", Register_getSize, METH_NOARGS,
""},
379 {
"getType", Register_getType, METH_NOARGS,
""},
380 {
"getVASType", Register_getVASType, METH_NOARGS,
""},
381 {
"isMutable", Register_isMutable, METH_NOARGS,
""},
382 {
"isOverlapWith", Register_isOverlapWith, METH_O,
""},
383 {
nullptr,
nullptr, 0,
nullptr}
388 PyVarObject_HEAD_INIT(&PyType_Type, 0)
396 (printfunc)Register_print,
401 (reprfunc)Register_str,
405 (hashfunc)Register_hash,
407 (reprfunc)Register_str,
415 (richcmpfunc)Register_richcompare,
461 return (PyObject*)object;
This class is used when an instruction has a register operand.
TRITON_EXPORT bool isOverlapWith(const Register &other) const
Returns true if other and self overlap.
The root class of all exceptions.
TRITON_EXPORT const char * what() const
Returns the exception message.
PyTypeObject Register_Type
pyRegister type.
PyObject * PyLong_FromUint64(triton::uint64 value)
Returns a pyObject from a triton::uint64.
PyObject * PyRegister(const triton::arch::Register ®)
Creates the Register python class.
PyObject * PyLong_FromUint32(triton::uint32 value)
Returns a pyObject from a triton::uint32.
std::uint32_t uint32
unisgned 32-bits
std::string toString(const T &obj)
Converts an object to a string.
PyMethodDef Register_callbacks[]
Register methods.
void Register_dealloc(PyObject *self)
Register destructor.
#define PyRegister_AsRegister(v)
#define PyRegister_Check(v)