mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 10:42:36 +01:00
Add proper transform pass management
This commit is contained in:
parent
09ea858dbf
commit
4da30e9eca
@ -403,6 +403,24 @@ void cpu_translator::run_transforms(llvm::Function& f)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cpu_translator::register_transform_pass(std::unique_ptr<translator_pass>& pass)
|
||||||
|
{
|
||||||
|
m_transform_passes.emplace_back(std::move(pass));
|
||||||
|
}
|
||||||
|
|
||||||
|
void cpu_translator::clear_transforms()
|
||||||
|
{
|
||||||
|
m_transform_passes.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void cpu_translator::reset_transforms()
|
||||||
|
{
|
||||||
|
for (auto& pass : m_transform_passes)
|
||||||
|
{
|
||||||
|
pass->reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void cpu_translator::erase_stores(llvm::ArrayRef<llvm::Value*> args)
|
void cpu_translator::erase_stores(llvm::ArrayRef<llvm::Value*> args)
|
||||||
{
|
{
|
||||||
for (auto v : args)
|
for (auto v : args)
|
||||||
|
@ -3094,10 +3094,13 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Register a transformation pass to be run before final compilation by llvm
|
// Register a transformation pass to be run before final compilation by llvm
|
||||||
void register_transform_pass(std::unique_ptr<translator_pass>& pass)
|
void register_transform_pass(std::unique_ptr<translator_pass>& pass);
|
||||||
{
|
|
||||||
m_transform_passes.emplace_back(std::move(pass));
|
// Delete all transform passes
|
||||||
}
|
void clear_transforms();
|
||||||
|
|
||||||
|
// Reset internal state of all passes to evict caches and such. Use when resetting a JIT.
|
||||||
|
void reset_transforms();
|
||||||
|
|
||||||
// Convert a C++ type to an LLVM type (TODO: remove)
|
// Convert a C++ type to an LLVM type (TODO: remove)
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -35,6 +35,8 @@ PPUTranslator::PPUTranslator(LLVMContext& context, Module* _module, const ppu_mo
|
|||||||
cpu_translator::initialize(context, engine);
|
cpu_translator::initialize(context, engine);
|
||||||
|
|
||||||
// Initialize transform passes
|
// Initialize transform passes
|
||||||
|
clear_transforms();
|
||||||
|
|
||||||
#ifdef ARCH_ARM64
|
#ifdef ARCH_ARM64
|
||||||
{
|
{
|
||||||
// Base reg table definition
|
// Base reg table definition
|
||||||
@ -63,6 +65,8 @@ PPUTranslator::PPUTranslator(LLVMContext& context, Module* _module, const ppu_mo
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
reset_transforms();
|
||||||
|
|
||||||
// Thread context struct (TODO: safer member access)
|
// Thread context struct (TODO: safer member access)
|
||||||
const u32 off0 = offset32(&ppu_thread::state);
|
const u32 off0 = offset32(&ppu_thread::state);
|
||||||
const u32 off1 = offset32(&ppu_thread::gpr);
|
const u32 off1 = offset32(&ppu_thread::gpr);
|
||||||
|
@ -1474,6 +1474,7 @@ public:
|
|||||||
m_md_unlikely = llvm::MDTuple::get(m_context, {md_name, md_low, md_high});
|
m_md_unlikely = llvm::MDTuple::get(m_context, {md_name, md_low, md_high});
|
||||||
|
|
||||||
// Initialize transform passes
|
// Initialize transform passes
|
||||||
|
clear_transforms();
|
||||||
#ifdef ARCH_ARM64
|
#ifdef ARCH_ARM64
|
||||||
{
|
{
|
||||||
auto should_exclude_function = [](const std::string& fn_name)
|
auto should_exclude_function = [](const std::string& fn_name)
|
||||||
@ -1498,6 +1499,8 @@ public:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reset_transforms();
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_luts()
|
void init_luts()
|
||||||
|
Loading…
Reference in New Issue
Block a user