LLVM: splitting and caching

This commit is contained in:
Nekotekina 2017-02-26 18:56:31 +03:00
parent 4aab8db420
commit 0eb6bf6a67
11 changed files with 362 additions and 148 deletions

View file

@ -31,10 +31,25 @@ class jit_compiler final
// Compiled functions
std::unordered_map<std::string, std::uintptr_t> m_map;
// Linkage cache
std::unordered_map<std::string, std::uintptr_t> m_link;
// Arch
std::string m_cpu;
// Internal
void init();
public:
jit_compiler(std::unique_ptr<llvm::Module>&&, std::unordered_map<std::string, std::uintptr_t>&&);
jit_compiler(std::unordered_map<std::string, std::uintptr_t>);
~jit_compiler();
// Compile module
void make(std::unique_ptr<llvm::Module>, std::string);
// Load object
void load(std::unique_ptr<llvm::Module>, std::unique_ptr<llvm::object::ObjectFile>);
// Get compiled function address
std::uintptr_t get(const std::string& name) const
{
@ -47,6 +62,12 @@ public:
return 0;
}
// Get CPU info
const std::string& cpu() const
{
return m_cpu;
}
};
#endif