aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorMerry <[email protected]>2023-01-31 15:10:51 +0000
committerMerry <[email protected]>2023-02-04 11:30:01 +0000
commitd796d8e93d3d9ef555bf0ae40b0d7728d319c553 (patch)
tree3679a73ed418fffa156e27fd06e06ca4cb1a1e77 /tests
parent60030a76d77aafec41dc974b8dfe2e534541a814 (diff)
downloaddynarmic-d796d8e93d3d9ef555bf0ae40b0d7728d319c553.tar.gz
dynarmic-d796d8e93d3d9ef555bf0ae40b0d7728d319c553.zip
reg_alloc: Fix cast-qual issue
Diffstat (limited to 'tests')
-rw-r--r--tests/A32/fuzz_thumb.cpp1
-rw-r--r--tests/A64/fuzz_with_unicorn.cpp3
-rw-r--r--tests/print_info.cpp63
3 files changed, 40 insertions, 27 deletions
diff --git a/tests/A32/fuzz_thumb.cpp b/tests/A32/fuzz_thumb.cpp
index 3733dbb3..f13c5ee0 100644
--- a/tests/A32/fuzz_thumb.cpp
+++ b/tests/A32/fuzz_thumb.cpp
@@ -176,6 +176,7 @@ static void RunInstance(size_t run_number, ThumbTestEnv& test_env, A32Unicorn<Th
while (num_insts < instructions_to_execute_count) {
A32::LocationDescriptor descriptor = {u32(num_insts * 4), cpsr, A32::FPSCR{}};
IR::Block ir_block = A32::Translate(descriptor, &test_env, {});
+ Optimization::NamingPass(ir_block);
Optimization::A32GetSetElimination(ir_block, {.convert_nz_to_nzc = true});
Optimization::DeadCodeElimination(ir_block);
Optimization::A32ConstantMemoryReads(ir_block, &test_env);
diff --git a/tests/A64/fuzz_with_unicorn.cpp b/tests/A64/fuzz_with_unicorn.cpp
index 7343f87e..1a56a982 100644
--- a/tests/A64/fuzz_with_unicorn.cpp
+++ b/tests/A64/fuzz_with_unicorn.cpp
@@ -265,6 +265,8 @@ static void RunTestInstance(Dynarmic::A64::Jit& jit, A64Unicorn& uni, A64TestEnv
const auto get_code = [&jit_env](u64 vaddr) { return jit_env.MemoryReadCode(vaddr); };
IR::Block ir_block = A64::Translate({instructions_start, FP::FPCR{fpcr}}, get_code, {});
Optimization::A64CallbackConfigPass(ir_block, GetUserConfig(jit_env));
+ Optimization::NamingPass(ir_block);
+
fmt::print("IR:\n");
fmt::print("{}\n", IR::DumpBlock(ir_block));
@@ -272,6 +274,7 @@ static void RunTestInstance(Dynarmic::A64::Jit& jit, A64Unicorn& uni, A64TestEnv
Optimization::DeadCodeElimination(ir_block);
Optimization::ConstantPropagation(ir_block);
Optimization::DeadCodeElimination(ir_block);
+
fmt::print("Optimized IR:\n");
fmt::print("{}\n", IR::DumpBlock(ir_block));
diff --git a/tests/print_info.cpp b/tests/print_info.cpp
index a388e3fc..a8580b7b 100644
--- a/tests/print_info.cpp
+++ b/tests/print_info.cpp
@@ -58,20 +58,23 @@ void PrintA32Instruction(u32 instruction) {
fmt::print("Name: {}\n", GetNameOfA32Instruction(instruction));
const A32::LocationDescriptor location{0, {}, {}};
- IR::Block block{location};
- const bool should_continue = A32::TranslateSingleInstruction(block, location, instruction);
+ IR::Block ir_block{location};
+ const bool should_continue = A32::TranslateSingleInstruction(ir_block, location, instruction);
fmt::print("should_continue: {}\n\n", should_continue);
+
+ Optimization::NamingPass(ir_block);
+
fmt::print("IR:\n");
- fmt::print("{}\n", IR::DumpBlock(block));
+ fmt::print("{}\n", IR::DumpBlock(ir_block));
- Optimization::A32GetSetElimination(block, {});
- Optimization::DeadCodeElimination(block);
- Optimization::ConstantPropagation(block);
- Optimization::DeadCodeElimination(block);
- Optimization::IdentityRemovalPass(block);
+ Optimization::A32GetSetElimination(ir_block, {});
+ Optimization::DeadCodeElimination(ir_block);
+ Optimization::ConstantPropagation(ir_block);
+ Optimization::DeadCodeElimination(ir_block);
+ Optimization::IdentityRemovalPass(ir_block);
fmt::print("Optimized IR:\n");
- fmt::print("{}\n", IR::DumpBlock(block));
+ fmt::print("{}\n", IR::DumpBlock(ir_block));
}
void PrintA64Instruction(u32 instruction) {
@@ -79,20 +82,23 @@ void PrintA64Instruction(u32 instruction) {
fmt::print("Name: {}\n", GetNameOfA64Instruction(instruction));
const A64::LocationDescriptor location{0, {}};
- IR::Block block{location};
- const bool should_continue = A64::TranslateSingleInstruction(block, location, instruction);
+ IR::Block ir_block{location};
+ const bool should_continue = A64::TranslateSingleInstruction(ir_block, location, instruction);
fmt::print("should_continue: {}\n\n", should_continue);
+
+ Optimization::NamingPass(ir_block);
+
fmt::print("IR:\n");
- fmt::print("{}\n", IR::DumpBlock(block));
+ fmt::print("{}\n", IR::DumpBlock(ir_block));
- Optimization::A64GetSetElimination(block);
- Optimization::DeadCodeElimination(block);
- Optimization::ConstantPropagation(block);
- Optimization::DeadCodeElimination(block);
- Optimization::IdentityRemovalPass(block);
+ Optimization::A64GetSetElimination(ir_block);
+ Optimization::DeadCodeElimination(ir_block);
+ Optimization::ConstantPropagation(ir_block);
+ Optimization::DeadCodeElimination(ir_block);
+ Optimization::IdentityRemovalPass(ir_block);
fmt::print("Optimized IR:\n");
- fmt::print("{}\n", IR::DumpBlock(block));
+ fmt::print("{}\n", IR::DumpBlock(ir_block));
}
void PrintThumbInstruction(u32 instruction) {
@@ -103,20 +109,23 @@ void PrintThumbInstruction(u32 instruction) {
fmt::print("{:08x} {}\n", instruction, Common::DisassembleAArch32(true, 0, (u8*)&instruction, inst_size));
const A32::LocationDescriptor location{0, A32::PSR{0x1F0}, {}};
- IR::Block block{location};
- const bool should_continue = A32::TranslateSingleInstruction(block, location, instruction);
+ IR::Block ir_block{location};
+ const bool should_continue = A32::TranslateSingleInstruction(ir_block, location, instruction);
fmt::print("should_continue: {}\n\n", should_continue);
+
+ Optimization::NamingPass(ir_block);
+
fmt::print("IR:\n");
- fmt::print("{}\n", IR::DumpBlock(block));
+ fmt::print("{}\n", IR::DumpBlock(ir_block));
- Optimization::A32GetSetElimination(block, {});
- Optimization::DeadCodeElimination(block);
- Optimization::ConstantPropagation(block);
- Optimization::DeadCodeElimination(block);
- Optimization::IdentityRemovalPass(block);
+ Optimization::A32GetSetElimination(ir_block, {});
+ Optimization::DeadCodeElimination(ir_block);
+ Optimization::ConstantPropagation(ir_block);
+ Optimization::DeadCodeElimination(ir_block);
+ Optimization::IdentityRemovalPass(ir_block);
fmt::print("Optimized IR:\n");
- fmt::print("{}\n", IR::DumpBlock(block));
+ fmt::print("{}\n", IR::DumpBlock(ir_block));
}
class ExecEnv final : public Dynarmic::A32::UserCallbacks {