Rename isJrRa to isReturn and isJrNotRa to isJumptableJump

This commit is contained in:
angie 2022-12-15 20:33:02 -03:00
parent 363aff8e5d
commit 61ccff4e42
6 changed files with 44 additions and 6 deletions

View File

@ -179,8 +179,15 @@ namespace rabbitizer {
bool isLikelyHandwritten() const;
bool isNop() const;
bool isUnconditionalBranch() const;
bool isReturn() const;
bool isJumptableJump() const;
//! @deprecated
bool isJrRa() const;
//! @deprecated
bool isJrNotRa() const;
bool hasDelaySlot() const;
//! @deprecated

View File

@ -754,12 +754,21 @@ bool InstructionBase::isNop() const {
bool InstructionBase::isUnconditionalBranch() const {
return RabbitizerInstruction_isUnconditionalBranch(&this->instr);
}
bool InstructionBase::isReturn() const {
return RabbitizerInstruction_isReturn(&this->instr);
}
bool InstructionBase::isJumptableJump() const {
return RabbitizerInstruction_isJumptableJump(&this->instr);
}
bool InstructionBase::isJrRa() const {
return RabbitizerInstruction_isJrRa(&this->instr);
}
bool InstructionBase::isJrNotRa() const {
return RabbitizerInstruction_isJrNotRa(&this->instr);
}
bool InstructionBase::hasDelaySlot() const {
return RabbitizerInstruction_hasDelaySlot(&this->instr);
}

View File

@ -192,10 +192,17 @@ NODISCARD NON_NULL(1) PURE
bool RabbitizerInstruction_isNop(const RabbitizerInstruction *self);
NODISCARD NON_NULL(1) PURE
bool RabbitizerInstruction_isUnconditionalBranch(const RabbitizerInstruction *self);
NODISCARD NON_NULL(1) PURE
bool RabbitizerInstruction_isJrRa(const RabbitizerInstruction *self);
bool RabbitizerInstruction_isReturn(const RabbitizerInstruction *self);
NODISCARD NON_NULL(1) PURE
bool RabbitizerInstruction_isJrNotRa(const RabbitizerInstruction *self);
bool RabbitizerInstruction_isJumptableJump(const RabbitizerInstruction *self);
//! @deprecated
#define RabbitizerInstruction_isJrRa RabbitizerInstruction_isReturn
//! @deprecated
#define RabbitizerInstruction_isJrNotRa RabbitizerInstruction_isJumptableJump
NODISCARD NON_NULL(1) PURE
bool RabbitizerInstruction_hasDelaySlot(const RabbitizerInstruction *self);

View File

@ -60,8 +60,13 @@ class Instruction:
def isLikelyHandwritten(self) -> bool: ...
def isNop(self) -> bool: ...
def isUnconditionalBranch(self) -> bool: ...
def isJrRa(self) -> bool: ...
def isJrNotRa(self) -> bool: ...
def isReturn(self) -> bool: ...
def isJumptableJump(self) -> bool: ...
def isJrRa(self) -> bool: ... #! deprecated
def isJrNotRa(self) -> bool: ... #! deprecated
def hasDelaySlot(self) -> bool: ...
def mapInstrToType(self) -> str|None: ... #! deprecated

View File

@ -225,8 +225,13 @@ DEF_METHOD_BOOL(isImplemented)
DEF_METHOD_BOOL(isLikelyHandwritten)
DEF_METHOD_BOOL(isNop)
DEF_METHOD_BOOL(isUnconditionalBranch)
DEF_METHOD_BOOL(isReturn)
DEF_METHOD_BOOL(isJumptableJump)
DEF_METHOD_BOOL(isJrRa)
DEF_METHOD_BOOL(isJrNotRa)
DEF_METHOD_BOOL(hasDelaySlot)
static PyObject *rabbitizer_type_Instruction_mapInstrToType(PyRabbitizerInstruction *self, UNUSED PyObject *closure) {
@ -455,8 +460,13 @@ static PyMethodDef rabbitizer_type_Instruction_methods[] = {
METHOD_NO_ARGS(isLikelyHandwritten, ""),
METHOD_NO_ARGS(isNop, ""),
METHOD_NO_ARGS(isUnconditionalBranch, ""),
METHOD_NO_ARGS(isReturn, ""),
METHOD_NO_ARGS(isJumptableJump, ""),
METHOD_NO_ARGS(isJrRa, ""),
METHOD_NO_ARGS(isJrNotRa, ""),
METHOD_NO_ARGS(hasDelaySlot, ""),
METHOD_NO_ARGS(mapInstrToType, ""),

View File

@ -60,7 +60,7 @@ bool RabbitizerInstruction_isUnconditionalBranch(const RabbitizerInstruction *se
}
}
bool RabbitizerInstruction_isJrRa(const RabbitizerInstruction *self) {
bool RabbitizerInstruction_isReturn(const RabbitizerInstruction *self) {
switch (self->uniqueId) {
case RABBITIZER_INSTR_ID_cpu_jr:
case RABBITIZER_INSTR_ID_rsp_jr:
@ -72,7 +72,7 @@ bool RabbitizerInstruction_isJrRa(const RabbitizerInstruction *self) {
}
}
bool RabbitizerInstruction_isJrNotRa(const RabbitizerInstruction *self) {
bool RabbitizerInstruction_isJumptableJump(const RabbitizerInstruction *self) {
switch (self->uniqueId) {
case RABBITIZER_INSTR_ID_cpu_jr:
case RABBITIZER_INSTR_ID_rsp_jr: