Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ enum-map = "*"
num_enum = "0.5.7"
num-traits = "*"
parse_int = "0.6.0"
# rabbitizer = { git = "https://github.com/encounter/rabbitizer-rs", rev = "10c279b2ef251c62885b1dcdcfe740b0db8e9956" }
rabbitizer = { path = "../rabbitizer-rs" }
rabbitizer = "1.5.8"
argh = "0.1.9"
rayon = "1.6.1"
strum = "0.24"
Expand Down
30 changes: 15 additions & 15 deletions src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ pub fn b_vs_j(
let mut b_count = 0;

for chunk in rom_bytes[region.rom_start()..region.rom_end()].chunks_exact(INSTRUCTION_SIZE) {
let instr = MyInstruction::new(read_be_word(chunk));
match instr.0.instr_id() {
let instr = new_instruction_cpu(read_be_word(chunk));
match instr.unique_id {
rabbitizer::InstrId::cpu_b => {
b_count += 1;
}
Expand Down Expand Up @@ -97,25 +97,25 @@ pub fn float_load_pattern(
let mut isolated_mtc1_count = 0;

for chunk in rom_bytes[region.rom_start()..region.rom_end()].chunks_exact(INSTRUCTION_SIZE) {
let instr = MyInstruction::new(read_be_word(chunk));
let instr = new_instruction_cpu(read_be_word(chunk));

match instr.0.instr_id() {
match instr.unique_id {
rabbitizer::InstrId::cpu_lui => {
if instr.rt() == MipsGpr::at {
if instr.get_rt_o32() == rabbitizer::registers::GprO32::at {
last_was_lui_at = true;
continue;
}
}
rabbitizer::InstrId::cpu_mtc1 => {
if last_was_lui_at && instr.rt() == MipsGpr::at {
if last_was_lui_at && instr.get_rt_o32() == rabbitizer::registers::GprO32::at {
float_load_pattern_count += 1;
} else {
isolated_mtc1_count += 1;
}
}
rabbitizer::InstrId::cpu_ori => {
// ignore an intermediate ori $at, $at
if instr.rs() == MipsGpr::at && instr.rt() == MipsGpr::at {
if instr.get_rs_o32() == rabbitizer::registers::GprO32::at && instr.get_rt_o32() == rabbitizer::registers::GprO32::at {
continue;
}
}
Expand Down Expand Up @@ -151,10 +151,10 @@ pub fn break_6_7_pattern(
let mut other_break_7_count = 0;

for chunk in rom_bytes[region.rom_start()..region.rom_end()].chunks_exact(INSTRUCTION_SIZE) {
let instr = MyInstruction::new(read_be_word(chunk));
let instr = new_instruction_cpu(read_be_word(chunk));

if last_was_break_6 {
match instr.0.instr_id() {
match instr.unique_id {
rabbitizer::InstrId::cpu_mfhi | rabbitizer::InstrId::cpu_mflo => {
break_6_pattern_count += 1;
}
Expand All @@ -163,14 +163,14 @@ pub fn break_6_7_pattern(
}
}
} else if last_was_break_7 {
match instr.0.instr_id() {
match instr.unique_id {
rabbitizer::InstrId::cpu_mfhi | rabbitizer::InstrId::cpu_mflo => {
break_7_pattern_count += 1;
}
rabbitizer::InstrId::cpu_addiu => {
if instr.rs() == MipsGpr::at
&& instr.rt() == MipsGpr::zero
&& instr.0.processed_immediate() == -1
if instr.get_rs_o32() == rabbitizer::registers::GprO32::at
&& instr.get_rt_o32() == rabbitizer::registers::GprO32::zero
&& instr.processed_immediate() == -1
{
break_7_pattern_count += 1;
} else {
Expand All @@ -182,9 +182,9 @@ pub fn break_6_7_pattern(
}
}
} else {
match instr.0.instr_id() {
match instr.unique_id {
rabbitizer::InstrId::cpu_break => {
match instr.code_upper() {
match instr.get_code_upper() {
6 => {
last_was_break_6 = true;
}
Expand Down
Loading