Add fallback CPU detection when llvm is not aware of the CPU model

This commit is contained in:
kd-11 2024-08-03 04:54:37 +03:00 committed by kd-11
parent 8f51b0907a
commit 3e7c1e207d
3 changed files with 61 additions and 1 deletions

View file

@ -90,7 +90,13 @@ void cpu_translator::initialize(llvm::LLVMContext& context, llvm::ExecutionEngin
m_context = context;
m_engine = &engine;
const auto cpu = m_engine->getTargetMachine()->getTargetCPU();
auto cpu = m_engine->getTargetMachine()->getTargetCPU();
if (cpu == "generic")
{
// Detection failed, try to guess
cpu = fallback_cpu_detection();
}
// Test SSSE3 feature (TODO)
if (cpu == "generic" ||