mirror of
https://github.com/Decompollaborate/rabbitizer.git
synced 2025-01-29 21:32:45 +00:00
Remove signedness from access type and move it to doesUnsignedMemoryAccess
This commit is contained in:
parent
af1d62b8bc
commit
6d49bb4abf
@ -241,6 +241,7 @@ namespace rabbitizer {
|
||||
bool isPseudo() const;
|
||||
|
||||
AccessType getAccessType() const;
|
||||
bool doesUnsignedMemoryAccess() const;
|
||||
|
||||
/* Instruction descriptor */
|
||||
|
||||
|
@ -893,6 +893,10 @@ AccessType InstructionBase::getAccessType() const {
|
||||
return static_cast<AccessType>(RabbitizerInstrDescriptor_getAccessType(this->instr.descriptor));
|
||||
}
|
||||
|
||||
bool InstructionBase::doesUnsignedMemoryAccess() const {
|
||||
return RabbitizerInstrDescriptor_doesUnsignedMemoryAccess(this->instr.descriptor);
|
||||
}
|
||||
|
||||
/* Instruction descriptor */
|
||||
|
||||
/* Disassembly */
|
||||
|
@ -3,13 +3,9 @@
|
||||
|
||||
RAB_DEF_ACCESSTYPE(INVALID)
|
||||
|
||||
RAB_DEF_ACCESSTYPE(BYTE_SIGNED)
|
||||
RAB_DEF_ACCESSTYPE(BYTE_UNSIGNED)
|
||||
RAB_DEF_ACCESSTYPE(SHORT_SIGNED)
|
||||
RAB_DEF_ACCESSTYPE(SHORT_UNSIGNED)
|
||||
RAB_DEF_ACCESSTYPE(WORD_SIGNED)
|
||||
RAB_DEF_ACCESSTYPE(WORD_UNSIGNED)
|
||||
RAB_DEF_ACCESSTYPE(DOUBLEWORD_SIGNED)
|
||||
RAB_DEF_ACCESSTYPE(DOUBLEWORD_UNSIGNED)
|
||||
RAB_DEF_ACCESSTYPE(FLOAT_SIGNED)
|
||||
RAB_DEF_ACCESSTYPE(DOUBLEFLOAT_SIGNED)
|
||||
RAB_DEF_ACCESSTYPE(BYTE)
|
||||
RAB_DEF_ACCESSTYPE(SHORT)
|
||||
RAB_DEF_ACCESSTYPE(WORD)
|
||||
RAB_DEF_ACCESSTYPE(DOUBLEWORD)
|
||||
RAB_DEF_ACCESSTYPE(FLOAT)
|
||||
RAB_DEF_ACCESSTYPE(DOUBLEFLOAT)
|
||||
|
@ -124,6 +124,7 @@ typedef struct RabbitizerInstrDescriptor {
|
||||
bool isPseudo;
|
||||
|
||||
RabbitizerAccessType accessType;
|
||||
bool doesUnsignedMemoryAccess;
|
||||
} RabbitizerInstrDescriptor;
|
||||
|
||||
// TODO: less redundant name
|
||||
@ -200,6 +201,8 @@ bool RabbitizerInstrDescriptor_isPseudo(const RabbitizerInstrDescriptor *self);
|
||||
|
||||
NODISCARD NON_NULL(1) PURE
|
||||
RabbitizerAccessType RabbitizerInstrDescriptor_getAccessType(const RabbitizerInstrDescriptor *self);
|
||||
NODISCARD NON_NULL(1) PURE
|
||||
bool RabbitizerInstrDescriptor_doesUnsignedMemoryAccess(const RabbitizerInstrDescriptor *self);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -176,7 +176,7 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesLoad=true,
|
||||
.accessType=RAB_ACCESSTYPE_BYTE_SIGNED
|
||||
.accessType=RAB_ACCESSTYPE_BYTE
|
||||
) // Load Byte
|
||||
RABBITIZER_DEF_INSTR_ID(
|
||||
cpu, 0x21, lh,
|
||||
@ -186,7 +186,7 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesLoad=true,
|
||||
.accessType=RAB_ACCESSTYPE_SHORT_SIGNED
|
||||
.accessType=RAB_ACCESSTYPE_SHORT
|
||||
) // Load Halfword
|
||||
RABBITIZER_DEF_INSTR_ID(
|
||||
cpu, 0x22, lwl,
|
||||
@ -205,7 +205,7 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesLoad=true,
|
||||
.accessType=RAB_ACCESSTYPE_WORD_SIGNED
|
||||
.accessType=RAB_ACCESSTYPE_WORD
|
||||
) // Load Word
|
||||
RABBITIZER_DEF_INSTR_ID(
|
||||
cpu, 0x24, lbu,
|
||||
@ -215,7 +215,8 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesLoad=true,
|
||||
.accessType=RAB_ACCESSTYPE_BYTE_UNSIGNED
|
||||
.accessType=RAB_ACCESSTYPE_BYTE,
|
||||
.doesUnsignedMemoryAccess=true
|
||||
) // Load Byte Insigned
|
||||
RABBITIZER_DEF_INSTR_ID(
|
||||
cpu, 0x25, lhu,
|
||||
@ -225,7 +226,8 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesLoad=true,
|
||||
.accessType=RAB_ACCESSTYPE_SHORT_UNSIGNED
|
||||
.accessType=RAB_ACCESSTYPE_SHORT,
|
||||
.doesUnsignedMemoryAccess=true
|
||||
) // Load Halfword Unsigned
|
||||
RABBITIZER_DEF_INSTR_ID(
|
||||
cpu, 0x26, lwr,
|
||||
@ -244,7 +246,8 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesLoad=true,
|
||||
.accessType=RAB_ACCESSTYPE_WORD_UNSIGNED
|
||||
.accessType=RAB_ACCESSTYPE_WORD,
|
||||
.doesUnsignedMemoryAccess=true
|
||||
) // Load Word Unsigned
|
||||
RABBITIZER_DEF_INSTR_ID(
|
||||
cpu, 0x28, sb,
|
||||
@ -253,7 +256,7 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesStore=true,
|
||||
.accessType=RAB_ACCESSTYPE_BYTE_SIGNED
|
||||
.accessType=RAB_ACCESSTYPE_BYTE
|
||||
) // Store Byte
|
||||
RABBITIZER_DEF_INSTR_ID(
|
||||
cpu, 0x29, sh,
|
||||
@ -262,7 +265,7 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesStore=true,
|
||||
.accessType=RAB_ACCESSTYPE_SHORT_SIGNED
|
||||
.accessType=RAB_ACCESSTYPE_SHORT
|
||||
) // Store Halfword
|
||||
RABBITIZER_DEF_INSTR_ID(
|
||||
cpu, 0x2A, swl,
|
||||
@ -279,7 +282,7 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesStore=true,
|
||||
.accessType=RAB_ACCESSTYPE_WORD_SIGNED
|
||||
.accessType=RAB_ACCESSTYPE_WORD
|
||||
) // Store Word
|
||||
RABBITIZER_DEF_INSTR_ID(
|
||||
cpu, 0x2C, sdl,
|
||||
@ -339,7 +342,7 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesLoad=true,
|
||||
.accessType=RAB_ACCESSTYPE_DOUBLEWORD_SIGNED
|
||||
.accessType=RAB_ACCESSTYPE_DOUBLEWORD
|
||||
) // Load Doubleword
|
||||
RABBITIZER_DEF_INSTR_ID(
|
||||
cpu, 0x38, sc,
|
||||
@ -364,7 +367,7 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesStore=true,
|
||||
.accessType=RAB_ACCESSTYPE_DOUBLEWORD_SIGNED
|
||||
.accessType=RAB_ACCESSTYPE_DOUBLEWORD
|
||||
) // Store Doubleword
|
||||
|
||||
// OP op, IMM(base)
|
||||
@ -384,7 +387,7 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesLoad=true,
|
||||
.accessType=RAB_ACCESSTYPE_FLOAT_SIGNED
|
||||
.accessType=RAB_ACCESSTYPE_FLOAT
|
||||
) // Load Word to Coprocessor z
|
||||
RABBITIZER_DEF_INSTR_ID(
|
||||
cpu, 0x35, ldc1,
|
||||
@ -395,7 +398,7 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesLoad=true,
|
||||
.accessType=RAB_ACCESSTYPE_DOUBLEFLOAT_SIGNED
|
||||
.accessType=RAB_ACCESSTYPE_DOUBLEFLOAT
|
||||
) // Load Doubleword to Coprocessor z
|
||||
RABBITIZER_DEF_INSTR_ID(
|
||||
cpu, 0x39, swc1,
|
||||
@ -405,7 +408,7 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesStore=true,
|
||||
.accessType=RAB_ACCESSTYPE_FLOAT_SIGNED
|
||||
.accessType=RAB_ACCESSTYPE_FLOAT
|
||||
) // Store Word from Coprocessor z
|
||||
RABBITIZER_DEF_INSTR_ID(
|
||||
cpu, 0x3D, sdc1,
|
||||
@ -416,7 +419,7 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesStore=true,
|
||||
.accessType=RAB_ACCESSTYPE_DOUBLEFLOAT_SIGNED
|
||||
.accessType=RAB_ACCESSTYPE_DOUBLEFLOAT
|
||||
) // Store Doubleword from Coprocessor z
|
||||
|
||||
// OP cop2t, IMM(base)
|
||||
|
@ -116,7 +116,7 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesLoad=true,
|
||||
.accessType=RAB_ACCESSTYPE_BYTE_SIGNED
|
||||
.accessType=RAB_ACCESSTYPE_BYTE
|
||||
) // Load Byte
|
||||
RABBITIZER_DEF_INSTR_ID(
|
||||
rsp, 0x21, lh,
|
||||
@ -126,7 +126,7 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesLoad=true,
|
||||
.accessType=RAB_ACCESSTYPE_SHORT_SIGNED
|
||||
.accessType=RAB_ACCESSTYPE_SHORT
|
||||
) // Load Halfword
|
||||
RABBITIZER_DEF_INSTR_ID(
|
||||
rsp, 0x23, lw,
|
||||
@ -136,7 +136,7 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesLoad=true,
|
||||
.accessType=RAB_ACCESSTYPE_WORD_SIGNED
|
||||
.accessType=RAB_ACCESSTYPE_WORD
|
||||
) // Load Word
|
||||
RABBITIZER_DEF_INSTR_ID(
|
||||
rsp, 0x24, lbu,
|
||||
@ -146,7 +146,8 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesLoad=true,
|
||||
.accessType=RAB_ACCESSTYPE_BYTE_UNSIGNED
|
||||
.accessType=RAB_ACCESSTYPE_BYTE,
|
||||
.doesUnsignedMemoryAccess=true
|
||||
) // Load Byte Insigned
|
||||
RABBITIZER_DEF_INSTR_ID(
|
||||
rsp, 0x25, lhu,
|
||||
@ -156,7 +157,8 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesLoad=true,
|
||||
.accessType=RAB_ACCESSTYPE_SHORT_UNSIGNED
|
||||
.accessType=RAB_ACCESSTYPE_SHORT,
|
||||
.doesUnsignedMemoryAccess=true
|
||||
) // Load Halfword Unsigned
|
||||
RABBITIZER_DEF_INSTR_ID(
|
||||
rsp, 0x28, sb,
|
||||
@ -165,7 +167,7 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesStore=true,
|
||||
.accessType=RAB_ACCESSTYPE_BYTE_SIGNED
|
||||
.accessType=RAB_ACCESSTYPE_BYTE
|
||||
) // Store Byte
|
||||
RABBITIZER_DEF_INSTR_ID(
|
||||
rsp, 0x29, sh,
|
||||
@ -174,7 +176,7 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesStore=true,
|
||||
.accessType=RAB_ACCESSTYPE_SHORT_SIGNED
|
||||
.accessType=RAB_ACCESSTYPE_SHORT
|
||||
) // Store Halfword
|
||||
RABBITIZER_DEF_INSTR_ID(
|
||||
rsp, 0x2B, sw,
|
||||
@ -183,7 +185,7 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesStore=true,
|
||||
.accessType=RAB_ACCESSTYPE_WORD_SIGNED
|
||||
.accessType=RAB_ACCESSTYPE_WORD
|
||||
) // Store Word
|
||||
RABBITIZER_DEF_INSTR_ID(
|
||||
rsp, 0x33, pref,
|
||||
@ -210,7 +212,7 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesLoad=true,
|
||||
.accessType=RAB_ACCESSTYPE_FLOAT_SIGNED
|
||||
.accessType=RAB_ACCESSTYPE_FLOAT
|
||||
) // Load Word to Coprocessor z
|
||||
RABBITIZER_DEF_INSTR_ID(
|
||||
rsp, 0x39, swc1,
|
||||
@ -220,7 +222,7 @@ RABBITIZER_DEF_INSTR_ID(
|
||||
.canBeLo=true,
|
||||
.doesDereference=true,
|
||||
.doesStore=true,
|
||||
.accessType=RAB_ACCESSTYPE_FLOAT_SIGNED
|
||||
.accessType=RAB_ACCESSTYPE_FLOAT
|
||||
) // Store Word from Coprocessor z
|
||||
|
||||
|
||||
|
@ -11,15 +11,11 @@ from .Enum import Enum
|
||||
class AccessType:
|
||||
INVALID: Enum
|
||||
|
||||
BYTE_SIGNED: Enum
|
||||
BYTE_UNSIGNED: Enum
|
||||
SHORT_SIGNED: Enum
|
||||
SHORT_UNSIGNED: Enum
|
||||
WORD_SIGNED: Enum
|
||||
WORD_UNSIGNED: Enum
|
||||
DOUBLEWORD_SIGNED: Enum
|
||||
DOUBLEWORD_UNSIGNED: Enum
|
||||
FLOAT_SIGNED: Enum
|
||||
DOUBLEFLOAT_SIGNED: Enum
|
||||
BYTE: Enum
|
||||
SHORT: Enum
|
||||
WORD: Enum
|
||||
DOUBLEWORD: Enum
|
||||
FLOAT: Enum
|
||||
DOUBLEFLOAT: Enum
|
||||
|
||||
MAX: Enum
|
||||
|
@ -108,6 +108,7 @@ class Instruction:
|
||||
def maybeIsMove(self) -> bool: ...
|
||||
def isPseudo(self) -> bool: ...
|
||||
def getAccessType(self) -> Enum: ...
|
||||
def doesUnsignedMemoryAccess(self) -> bool: ...
|
||||
|
||||
def disassemble(self, immOverride: str|None=None, extraLJust: int=0) -> str: ...
|
||||
|
||||
|
@ -377,6 +377,8 @@ static PyObject *rabbitizer_type_Instruction_getAccessType(PyRabbitizerInstructi
|
||||
return enumInstance;
|
||||
}
|
||||
|
||||
DEF_DESCRIPTOR_METHOD_BOOL(doesUnsignedMemoryAccess)
|
||||
|
||||
|
||||
static PyObject *rabbitizer_type_Instruction_disassemble(PyRabbitizerInstruction *self, PyObject *args, PyObject *kwds) {
|
||||
static char *kwlist[] = {"immOverride", "extraLJust", NULL};
|
||||
@ -492,6 +494,7 @@ static PyMethodDef rabbitizer_type_Instruction_methods[] = {
|
||||
METHOD_NO_ARGS(maybeIsMove, ""),
|
||||
METHOD_NO_ARGS(isPseudo, ""),
|
||||
METHOD_NO_ARGS(getAccessType, ""),
|
||||
METHOD_NO_ARGS(doesUnsignedMemoryAccess, ""),
|
||||
|
||||
METHOD_ARGS(disassemble, "description"),
|
||||
|
||||
|
@ -118,3 +118,7 @@ bool RabbitizerInstrDescriptor_isPseudo(const RabbitizerInstrDescriptor *self) {
|
||||
RabbitizerAccessType RabbitizerInstrDescriptor_getAccessType(const RabbitizerInstrDescriptor *self) {
|
||||
return self->accessType;
|
||||
}
|
||||
|
||||
bool RabbitizerInstrDescriptor_doesUnsignedMemoryAccess(const RabbitizerInstrDescriptor *self) {
|
||||
return self->doesUnsignedMemoryAccess;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user