This patch fixes a couple of issues:
1. Instead of using `llvm_unreachable` for those base virtual functions, unknown
value will be returned. The previous method could cause runtime error for those
targets where the image is not compatible but JIT is not implemented.
2. Fixed the type in CMake that causes the `Target` CMake variable is undefined.
Reviewed By: ye-luo
Differential Revision: https://reviews.llvm.org/D140732
# Only enable JIT for those targets that LLVM can support.
string(TOUPPER "${LLVM_TARGETS_TO_BUILD}" TargetsSupported)
foreach(Target ${TargetsSupported})
- target_compile_definitions(PluginInterface PRIVATE "LIBOMPTARGET_JIT_${TARGET}")
+ target_compile_definitions(PluginInterface PRIVATE "LIBOMPTARGET_JIT_${Target}")
endforeach()
# This is required when using LLVM libraries.
}
#endif
if (!JITTargetInitialized) {
- FAILURE_MESSAGE("unsupported JIT target");
+ FAILURE_MESSAGE("unsupported JIT target: %s\n", TT.str().c_str());
abort();
}
/// Get target architecture.
virtual std::string getArch() const {
- llvm_unreachable("device doesn't support JIT");
+ return "unknown";
}
/// Post processing after jit backend. The ownership of \p MB will be taken.
/// Get the target triple of this plugin.
virtual Triple::ArchType getTripleArch() const {
- llvm_unreachable("target doesn't support jit");
+ return Triple::ArchType::UnknownArch;
}
/// Allocate a structure using the internal allocator.