40 lines
1,007 B
C++
40 lines
1,007 B
C++
#include <pslang/jit/compiler.hpp>
|
|
#include <pslang/jit/arch/macos_aarch64/compiler.hpp>
|
|
#include <pslang/jit/arch/linux_x86_64/compiler.hpp>
|
|
|
|
#include <stdexcept>
|
|
|
|
namespace pslang::jit
|
|
{
|
|
|
|
compiled_module compile(ir::compiled_module const & module_in, abi abi)
|
|
{
|
|
switch (abi.platform)
|
|
{
|
|
case platform::linux:
|
|
switch (abi.isa)
|
|
{
|
|
case isa::x86_64:
|
|
return linux_x86_64::compile(module_in);
|
|
case isa::aarch64:
|
|
throw std::runtime_error("Linux aarch64 JIT compilation not supported");
|
|
}
|
|
break;
|
|
throw std::runtime_error("Linux JIT compilation not supported");
|
|
case platform::windows:
|
|
throw std::runtime_error("Windows JIT compilation not supported");
|
|
case platform::macos:
|
|
switch (abi.isa)
|
|
{
|
|
case isa::x86_64:
|
|
throw std::runtime_error("macOS x86_64 JIT compilation not supported");
|
|
case isa::aarch64:
|
|
return macos_aarch64::compile(module_in);
|
|
}
|
|
break;
|
|
}
|
|
|
|
throw std::runtime_error("Internal error: unknown isa+platform combination");
|
|
}
|
|
|
|
}
|