mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-10 07:14:21 +00:00
SPU LLVM: improve debugging RPCS3
Build cache in reverse order Catch exceptions in instruction loop: print IR
This commit is contained in:
parent
711e0f75ee
commit
14e6577700
@ -33,9 +33,9 @@ spu_cache::~spu_cache()
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<std::vector<u32>> spu_cache::get()
|
||||
std::deque<std::vector<u32>> spu_cache::get()
|
||||
{
|
||||
std::vector<std::vector<u32>> result;
|
||||
std::deque<std::vector<u32>> result;
|
||||
|
||||
if (!m_file)
|
||||
{
|
||||
@ -64,7 +64,7 @@ std::vector<std::vector<u32>> spu_cache::get()
|
||||
break;
|
||||
}
|
||||
|
||||
result.emplace_back(std::move(func));
|
||||
result.emplace_front(std::move(func));
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -2161,6 +2161,11 @@ public:
|
||||
fs::file(m_spurt->m_cache_path + "spu.log", fs::write + fs::append).write(log);
|
||||
}
|
||||
|
||||
if (m_cache && g_cfg.core.spu_cache)
|
||||
{
|
||||
m_cache->add(func);
|
||||
}
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
// Create LLVM module
|
||||
@ -2447,8 +2452,20 @@ public:
|
||||
}
|
||||
|
||||
// Execute recompiler function (TODO)
|
||||
try
|
||||
{
|
||||
(this->*g_decoder.decode(op))({op});
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
std::string dump;
|
||||
raw_string_ostream out(dump);
|
||||
out << *module; // print IR
|
||||
out.flush();
|
||||
LOG_ERROR(SPU, "[0x%x] LLVM dump:\n%s", m_pos, dump);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
// Finalize block with fallthrough if necessary
|
||||
if (!m_ir->GetInsertBlock()->getTerminator())
|
||||
@ -2780,11 +2797,6 @@ public:
|
||||
fs::file(m_spurt->m_cache_path + "spu.log", fs::write + fs::append).write(log);
|
||||
}
|
||||
|
||||
if (m_cache && g_cfg.core.spu_cache)
|
||||
{
|
||||
m_cache->add(func);
|
||||
}
|
||||
|
||||
return fn;
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <bitset>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <deque>
|
||||
|
||||
// Helper class
|
||||
class spu_cache
|
||||
@ -22,7 +23,7 @@ public:
|
||||
return m_file.operator bool();
|
||||
}
|
||||
|
||||
std::vector<std::vector<u32>> get();
|
||||
std::deque<std::vector<u32>> get();
|
||||
|
||||
void add(const std::vector<u32>& func);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user