python: getOpcodeName

This commit is contained in:
angie 2022-07-06 12:01:41 -04:00
parent 55de30256a
commit c4e2922681
2 changed files with 6 additions and 0 deletions

View File

@ -28,6 +28,7 @@ class Instruction:
def getInstrIndexAsVram(self) -> int: ...
def getBranchOffset(self) -> int: ...
def getGenericBranchOffset(self, currentVram: int) -> int: ...
def getOpcodeName(self) -> str: ...
def blankOut(self) -> None: ...

View File

@ -145,6 +145,10 @@ DEF_METHOD_GET_UINT(getImmediate)
DEF_METHOD_GET_UINT(getInstrIndexAsVram)
DEF_METHOD_GET_INT(getBranchOffset)
static PyObject *rabbitizer_type_Instruction_getOpcodeName(PyRabbitizerInstruction *self, UNUSED PyObject *closure) {
return PyUnicode_FromString(RabbitizerInstrId_getOpcodeName(self->instr.uniqueId));
}
static PyObject *rabbitizer_type_Instruction_getGenericBranchOffset(PyRabbitizerInstruction *self, PyObject *args, PyObject *kwds) {
static char *kwlist[] = { "currentVram", NULL };
uint32_t currentVram;
@ -294,6 +298,7 @@ static PyMethodDef Instr_methods[] = {
METHOD_NO_ARGS(getInstrIndexAsVram, ""),
METHOD_NO_ARGS(getBranchOffset, ""),
METHOD_ARGS(getGenericBranchOffset, ""),
METHOD_NO_ARGS(getOpcodeName, ""),
METHOD_NO_ARGS(blankOut, ""),