diff options
author | MerryMage <[email protected]> | 2020-04-29 15:33:38 +0100 |
---|---|---|
committer | MerryMage <[email protected]> | 2020-04-29 15:33:38 +0100 |
commit | 8498ac34d5a92ca0581ba8d5241abf41d61fdb9c (patch) | |
tree | 0ebb63786c57ac375adcecc4ca4cb8d22ae59b0b /tests/A64/fuzz_with_unicorn.cpp | |
parent | 24229ab899d48a2cceb475f451f40d3062d8584a (diff) | |
download | dynarmic-8498ac34d5a92ca0581ba8d5241abf41d61fdb9c.tar.gz dynarmic-8498ac34d5a92ca0581ba8d5241abf41d61fdb9c.zip |
fuzz_with_unicorn: Print IR
Diffstat (limited to 'tests/A64/fuzz_with_unicorn.cpp')
-rw-r--r-- | tests/A64/fuzz_with_unicorn.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/A64/fuzz_with_unicorn.cpp b/tests/A64/fuzz_with_unicorn.cpp index cec5d270..7407fe1c 100644 --- a/tests/A64/fuzz_with_unicorn.cpp +++ b/tests/A64/fuzz_with_unicorn.cpp @@ -22,6 +22,7 @@ #include "frontend/ir/basic_block.h" #include "frontend/ir/opcodes.h" #include "fuzz_util.h" +#include "ir_opt/passes.h" #include "rand_int.h" #include "testenv.h" #include "unicorn_emu/a64_unicorn.h" @@ -252,6 +253,19 @@ static void RunTestInstance(Dynarmic::A64::Jit& jit, A64Unicorn& uni, A64TestEnv } fmt::print("\n"); + 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)); + fmt::print("IR:\n"); + fmt::print("{}\n", IR::DumpBlock(ir_block)); + + Optimization::A64GetSetElimination(ir_block); + Optimization::DeadCodeElimination(ir_block); + Optimization::ConstantPropagation(ir_block); + Optimization::DeadCodeElimination(ir_block); + fmt::print("Optimized IR:\n"); + fmt::print("{}\n", IR::DumpBlock(ir_block)); + fmt::print("x86_64:\n"); fmt::print("{}\n", jit.Disassemble()); |