mirror of
https://github.com/Decompollaborate/rabbitizer.git
synced 2025-01-30 06:32:43 +00:00
minor cleanups
This commit is contained in:
parent
0c678ab6df
commit
a725e0281a
@ -46,20 +46,26 @@ typedef struct RabbitizerInstruction {
|
||||
#define RAB_INSTR_GET_sa(self) (SHIFTR((self)->word, 6, 5))
|
||||
#define RAB_INSTR_GET_function(self) (SHIFTR((self)->word, 0, 6))
|
||||
|
||||
#define RAB_INSTR_GET_cop0d(self) (SHIFTR((self)->word, 11, 5))
|
||||
|
||||
#define RAB_INSTR_GET_instr_index(self) (SHIFTR((self)->word, 0, 26))
|
||||
#define RAB_INSTR_GET_immediate(self) (SHIFTR((self)->word, 0, 16))
|
||||
|
||||
#define RAB_INSTR_GET_fs(self) (SHIFTR((self)->word, 11, 5))
|
||||
#define RAB_INSTR_GET_ft(self) (SHIFTR((self)->word, 16, 5))
|
||||
#define RAB_INSTR_GET_fd(self) (SHIFTR((self)->word, 6, 5))
|
||||
#define RAB_INSTR_GET_cop1cs(self) (SHIFTR((self)->word, 11, 5))
|
||||
|
||||
#define RAB_INSTR_GET_op(self) (SHIFTR((self)->word, 16, 5))
|
||||
|
||||
#define RAB_INSTR_GET_code(self) (SHIFTR((self)->word, 6, 20))
|
||||
#define RAB_INSTR_GET_code_upper(self) (SHIFTR((self)->word, 16, 10))
|
||||
#define RAB_INSTR_GET_code_lower(self) (SHIFTR((self)->word, 6, 10))
|
||||
|
||||
#define RAB_INSTR_GET_fmt(self) (SHIFTR((self)->word, 21, 5))
|
||||
#define RAB_INSTR_GET_fc(self) (SHIFTR((self)->word, 4, 2))
|
||||
#define RAB_INSTR_GET_cond(self) (SHIFTR((self)->word, 0, 4))
|
||||
|
||||
#define RAB_INSTR_GET_cop0d(self) (SHIFTR((self)->word, 11, 5))
|
||||
|
||||
#define RAB_INSTR_GET_cop2t(self) (SHIFTR((self)->word, 16, 5))
|
||||
|
||||
|
||||
@ -78,6 +84,7 @@ typedef struct RabbitizerInstruction {
|
||||
#define RAB_INSTR_SET_fs(self, value) ((self)->word = BITREPACK((self)->word, value, 11, 5))
|
||||
#define RAB_INSTR_SET_ft(self, value) ((self)->word = BITREPACK((self)->word, value, 16, 5))
|
||||
#define RAB_INSTR_SET_fd(self, value) ((self)->word = BITREPACK((self)->word, value, 6, 5))
|
||||
#define RAB_INSTR_SET_cop1cs(self, value) ((self)->word = BITREPACK((self)->word, value, 11, 5))
|
||||
|
||||
|
||||
void RabbitizerInstruction_init(RabbitizerInstruction *self, uint32_t word);
|
||||
@ -148,6 +155,8 @@ const char *RabbitizerInstruction_mapInstrToType(const RabbitizerInstruction *se
|
||||
bool RabbitizerInstruction_sameOpcode(const RabbitizerInstruction *self, const RabbitizerInstruction *other);
|
||||
bool RabbitizerInstruction_sameOpcodeButDifferentArguments(const RabbitizerInstruction *self, const RabbitizerInstruction *other);
|
||||
|
||||
bool RabbitizerInstruction_hasOperand(const RabbitizerInstruction *self, RabbitizerOperandType operand);
|
||||
|
||||
/* Instruction examination */
|
||||
|
||||
|
||||
|
@ -11,13 +11,14 @@ typedef enum RabbitizerOperandType {
|
||||
RABBITIZER_OPERAND_TYPE_rs,
|
||||
RABBITIZER_OPERAND_TYPE_rt,
|
||||
RABBITIZER_OPERAND_TYPE_rd,
|
||||
RABBITIZER_OPERAND_TYPE_sa,
|
||||
// RABBITIZER_OPERAND_TYPE_function,
|
||||
RABBITIZER_OPERAND_TYPE_cop0d,
|
||||
RABBITIZER_OPERAND_TYPE_fs,
|
||||
RABBITIZER_OPERAND_TYPE_ft,
|
||||
RABBITIZER_OPERAND_TYPE_fd,
|
||||
RABBITIZER_OPERAND_TYPE_cop1cs, // Coprocessor 1 control fs
|
||||
RABBITIZER_OPERAND_TYPE_cop2t,
|
||||
RABBITIZER_OPERAND_TYPE_sa,
|
||||
RABBITIZER_OPERAND_TYPE_op,
|
||||
RABBITIZER_OPERAND_TYPE_code,
|
||||
RABBITIZER_OPERAND_TYPE_LABEL,
|
||||
|
@ -150,7 +150,7 @@ void RabbitizerRegistersTracker_overwriteRegisters(RabbitizerRegistersTracker *s
|
||||
}
|
||||
}
|
||||
|
||||
void RabbitizerRegistersTracker_unsetRegistersAfterFuncCall(RabbitizerRegistersTracker *self, const RabbitizerInstruction *instr, const RabbitizerInstruction *prevInstr) {
|
||||
void RabbitizerRegistersTracker_unsetRegistersAfterFuncCall(RabbitizerRegistersTracker *self, UNUSED const RabbitizerInstruction *instr, const RabbitizerInstruction *prevInstr) {
|
||||
RabbitizerTrackedRegisterState *state = NULL;
|
||||
|
||||
if (!RabbitizerInstrDescriptor_doesLink(prevInstr->descriptor)) {
|
||||
|
@ -107,7 +107,9 @@ int32_t RabbitizerInstruction_getGenericBranchOffset(const RabbitizerInstruction
|
||||
|
||||
|
||||
void RabbitizerInstruction_blankOut(RabbitizerInstruction *self) {
|
||||
for (size_t i = 0; i < ARRAY_COUNT(self->descriptor->operands) && self->descriptor->operands[i] != RABBITIZER_OPERAND_TYPE_INVALID; i++) {
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(self->descriptor->operands) && self->descriptor->operands[i] != RABBITIZER_OPERAND_TYPE_INVALID; i++) {
|
||||
switch (self->descriptor->operands[i]) {
|
||||
case RABBITIZER_OPERAND_TYPE_rs:
|
||||
case RABBITIZER_OPERAND_TYPE_RSP_rs:
|
||||
|
@ -132,8 +132,8 @@ size_t RabbitizerOperandType_processOp(const RabbitizerInstruction *self, char *
|
||||
|
||||
size_t RabbitizerOperandType_processCode(const RabbitizerInstruction *self, char *dst, UNUSED const char *immOverride, UNUSED size_t immOverrideLength) {
|
||||
size_t totalSize = 0;
|
||||
int code = (RAB_INSTR_GET_rs(self) << 5) | (RAB_INSTR_GET_rt(self));
|
||||
int lower = (RAB_INSTR_GET_rd(self) << 5) | (RAB_INSTR_GET_sa(self));
|
||||
int code = RAB_INSTR_GET_code_upper(self);
|
||||
int lower = RAB_INSTR_GET_code_lower(self);
|
||||
|
||||
RABUTILS_BUFFER_SPRINTF(dst, totalSize, "%i", code);
|
||||
if (lower) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user