Skip to content

Commit

Permalink
Remove IsaExtension::NONE and use an Option instead
Browse files Browse the repository at this point in the history
  • Loading branch information
AngheloAlf committed Jan 5, 2025
1 parent a61b71a commit 37eff7f
Show file tree
Hide file tree
Showing 99 changed files with 4,429 additions and 3,777 deletions.
2 changes: 1 addition & 1 deletion src/rab-disasmdis/src/bin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ fn main() {
let endian = args.endian;
let mut data = Data::new();
let flags = rabbitizer::instr::InstructionFlags::new()
.with_isa_extension(rabbitizer::isa::IsaExtension::NONE)
.with_isa_extension(None)
.with_all_pseudos(args.pseudos);
let vram = rabbitizer::vram::Vram::new(0x8000_0000);
let display_flags = rabbitizer::display_flags::InstructionDisplayFlags::new_gnu_as();
Expand Down
22 changes: 11 additions & 11 deletions src/rabbitizer/benches/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ use rabbitizer::{
display_flags::InstructionDisplayFlags,
instr::{Instruction, InstructionFlags},
isa::IsaExtension,
vram::Vram,
vram::Vram, IsaVersion,
};

fn decode_none(c: &mut Criterion) {
let vram = Vram::new(0x80000000);
let flags = InstructionFlags::new().with_isa_extension(IsaExtension::NONE);
let flags = InstructionFlags::new().with_isa_extension(None).with_isa_version(IsaVersion::MIPS_III);

c.bench_function("decode NONE: nop", |b| {
b.iter(|| Instruction::new(black_box(0x00000000), vram, flags))
Expand All @@ -32,7 +32,7 @@ fn decode_none(c: &mut Criterion) {

fn display_none(c: &mut Criterion) {
let vram = Vram::new(0x80000000);
let flags = InstructionFlags::new().with_isa_extension(IsaExtension::NONE);
let flags = InstructionFlags::new().with_isa_extension(None).with_isa_version(IsaVersion::MIPS_III);
let display_flags = InstructionDisplayFlags::new_gnu_as();

c.bench_function("display NONE: nop", |b| {
Expand Down Expand Up @@ -74,7 +74,7 @@ fn display_none(c: &mut Criterion) {

fn decode_rsp(c: &mut Criterion) {
let vram = Vram::new(0x80000000);
let flags = InstructionFlags::new().with_isa_extension(IsaExtension::RSP);
let flags = InstructionFlags::new().with_isa_extension(Some(IsaExtension::RSP));

c.bench_function("decode RSP: nop", |b| {
b.iter(|| Instruction::new(black_box(0x00000000), vram, flags))
Expand Down Expand Up @@ -110,7 +110,7 @@ fn decode_rsp(c: &mut Criterion) {

fn display_rsp(c: &mut Criterion) {
let vram = Vram::new(0x80000000);
let flags = InstructionFlags::new().with_isa_extension(IsaExtension::RSP);
let flags = InstructionFlags::new().with_isa_extension(Some(IsaExtension::RSP));
let display_flags = InstructionDisplayFlags::new_gnu_as();

c.bench_function("display RSP: nop", |b| {
Expand Down Expand Up @@ -187,7 +187,7 @@ fn display_rsp(c: &mut Criterion) {

fn decode_r3000gte(c: &mut Criterion) {
let vram = Vram::new(0x80000000);
let flags = InstructionFlags::new().with_isa_extension(IsaExtension::R3000GTE);
let flags = InstructionFlags::new().with_isa_extension(Some(IsaExtension::R3000GTE));

c.bench_function("decode R3000GTE: nop", |b| {
b.iter(|| Instruction::new(black_box(0x00000000), vram, flags))
Expand Down Expand Up @@ -223,7 +223,7 @@ fn decode_r3000gte(c: &mut Criterion) {

fn display_r3000gte(c: &mut Criterion) {
let vram = Vram::new(0x80000000);
let flags = InstructionFlags::new().with_isa_extension(IsaExtension::R3000GTE);
let flags = InstructionFlags::new().with_isa_extension(Some(IsaExtension::R3000GTE));
let display_flags = InstructionDisplayFlags::new_gnu_as();

c.bench_function("display R3000GTE: nop", |b| {
Expand Down Expand Up @@ -300,7 +300,7 @@ fn display_r3000gte(c: &mut Criterion) {

fn decode_r4000allegrex(c: &mut Criterion) {
let vram = Vram::new(0x80000000);
let flags = InstructionFlags::new().with_isa_extension(IsaExtension::R4000ALLEGREX);
let flags = InstructionFlags::new().with_isa_extension(Some(IsaExtension::R4000ALLEGREX));

c.bench_function("decode R4000ALLEGREX: nop", |b| {
b.iter(|| Instruction::new(black_box(0x00000000), vram, flags))
Expand Down Expand Up @@ -336,7 +336,7 @@ fn decode_r4000allegrex(c: &mut Criterion) {

fn display_r4000allegrex(c: &mut Criterion) {
let vram = Vram::new(0x80000000);
let flags = InstructionFlags::new().with_isa_extension(IsaExtension::R4000ALLEGREX);
let flags = InstructionFlags::new().with_isa_extension(Some(IsaExtension::R4000ALLEGREX));
let display_flags = InstructionDisplayFlags::new_gnu_as();

c.bench_function("display R4000ALLEGREX: nop", |b| {
Expand Down Expand Up @@ -413,7 +413,7 @@ fn display_r4000allegrex(c: &mut Criterion) {

fn decode_r5900(c: &mut Criterion) {
let vram = Vram::new(0x80000000);
let flags = InstructionFlags::new().with_isa_extension(IsaExtension::R5900);
let flags = InstructionFlags::new().with_isa_extension(Some(IsaExtension::R5900));

c.bench_function("decode R5900: nop", |b| {
b.iter(|| Instruction::new(black_box(0x00000000), vram, flags))
Expand Down Expand Up @@ -449,7 +449,7 @@ fn decode_r5900(c: &mut Criterion) {

fn display_r5900(c: &mut Criterion) {
let vram = Vram::new(0x80000000);
let flags = InstructionFlags::new().with_isa_extension(IsaExtension::R5900);
let flags = InstructionFlags::new().with_isa_extension(Some(IsaExtension::R5900));
let display_flags = InstructionDisplayFlags::new_gnu_as();

c.bench_function("display R5900: nop", |b| {
Expand Down
Loading

0 comments on commit 37eff7f

Please sign in to comment.