aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/lli/lli.cpp')
-rw-r--r--llvm/tools/lli/lli.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp
index 32df0711f2fd..a15b0ddc512b 100644
--- a/llvm/tools/lli/lli.cpp
+++ b/llvm/tools/lli/lli.cpp
@@ -99,7 +99,7 @@ namespace {
cl::opt<JITKind> UseJITKind(
"jit-kind", cl::desc("Choose underlying JIT kind."),
- cl::init(JITKind::MCJIT),
+ cl::init(JITKind::Orc),
cl::values(clEnumValN(JITKind::MCJIT, "mcjit", "MCJIT"),
clEnumValN(JITKind::Orc, "orc", "Orc JIT"),
clEnumValN(JITKind::OrcLazy, "orc-lazy",
@@ -228,7 +228,7 @@ namespace {
cl::desc("Do not resolve lli process symbols in JIT'd code"),
cl::init(false));
- enum class LLJITPlatform { DetectHost, GenericIR, MachO };
+ enum class LLJITPlatform { Inactive, DetectHost, GenericIR, MachO };
cl::opt<LLJITPlatform>
Platform("lljit-platform", cl::desc("Platform to use with LLJIT"),
@@ -238,7 +238,9 @@ namespace {
clEnumValN(LLJITPlatform::GenericIR, "GenericIR",
"Use LLJITGenericIRPlatform"),
clEnumValN(LLJITPlatform::MachO, "MachO",
- "Use LLJITMachOPlatform")),
+ "Use LLJITMachOPlatform"),
+ clEnumValN(LLJITPlatform::Inactive, "Inactive",
+ "Disable platform support explicitly")),
cl::Hidden);
enum class DumpKind {
@@ -327,7 +329,8 @@ public:
return nullptr;
// Load the object from the cache filename
ErrorOr<std::unique_ptr<MemoryBuffer>> IRObjectBuffer =
- MemoryBuffer::getFile(CacheName, -1, false);
+ MemoryBuffer::getFile(CacheName, /*IsText=*/false,
+ /*RequiresNullTerminator=*/false);
// If the file isn't there, that's OK.
if (!IRObjectBuffer)
return nullptr;
@@ -788,7 +791,8 @@ static std::function<void(Module &)> createDebugDumper() {
case DumpKind::DumpModsToDisk:
return [](Module &M) {
std::error_code EC;
- raw_fd_ostream Out(M.getModuleIdentifier() + ".ll", EC, sys::fs::OF_Text);
+ raw_fd_ostream Out(M.getModuleIdentifier() + ".ll", EC,
+ sys::fs::OF_TextWithCRLF);
if (EC) {
errs() << "Couldn't open " << M.getModuleIdentifier()
<< " for dumping.\nError:" << EC.message() << "\n";
@@ -869,6 +873,16 @@ int runOrcJIT(const char *ProgName) {
.setRelocationModel(codegen::getExplicitRelocModel())
.setCodeModel(codegen::getExplicitCodeModel());
+ // FIXME: Setting a dummy call-through manager in non-lazy mode prevents the
+ // JIT builder to instantiate a default (which would fail with an error for
+ // unsupported architectures).
+ if (UseJITKind != JITKind::OrcLazy) {
+ auto ES = std::make_unique<orc::ExecutionSession>();
+ Builder.setLazyCallthroughManager(
+ std::make_unique<orc::LazyCallThroughManager>(*ES, 0, nullptr));
+ Builder.setExecutionSession(std::move(ES));
+ }
+
Builder.setLazyCompileFailureAddr(
pointerToJITTargetAddress(exitOnLazyCallThroughFailure));
Builder.setNumCompileThreads(LazyJITCompileThreads);
@@ -914,6 +928,9 @@ int runOrcJIT(const char *ProgName) {
Builder.setPlatformSetUp(orc::setUpMachOPlatform);
ExitOnErr(orc::enableObjCRegistration("libobjc.dylib"));
break;
+ case LLJITPlatform::Inactive:
+ Builder.setPlatformSetUp(orc::setUpInactivePlatform);
+ break;
default:
llvm_unreachable("Unrecognized platform value");
}