From 8e9ec015348c5419b905c2ca6e39534429eda073 Mon Sep 17 00:00:00 2001 From: Andrew Kaylor Date: Tue, 1 Oct 2013 01:47:35 +0000 Subject: Adding multiple module support for MCJIT. Tests to follow. PIC with small code model and EH frame handling will not work with multiple modules. There are also some rough edges to be smoothed out for remote target support. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191722 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/lli/lli.cpp | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'tools/lli/lli.cpp') diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp index 8d74b2326d..ba9cb99d5a 100644 --- a/tools/lli/lli.cpp +++ b/tools/lli/lli.cpp @@ -460,18 +460,18 @@ int main(int argc, char **argv, char * const *envp) { // // Run static constructors. if (!RemoteMCJIT) { - if (UseMCJIT && !ForceInterpreter) { - // Give MCJIT a chance to apply relocations and set page permissions. - EE->finalizeObject(); - } - EE->runStaticConstructorsDestructors(false); - } + if (UseMCJIT && !ForceInterpreter) { + // Give MCJIT a chance to apply relocations and set page permissions. + EE->finalizeObject(); + } + EE->runStaticConstructorsDestructors(false); - if (NoLazyCompilation) { - for (Module::iterator I = Mod->begin(), E = Mod->end(); I != E; ++I) { - Function *Fn = &*I; - if (Fn != EntryFn && !Fn->isDeclaration()) - EE->getPointerToFunction(Fn); + if (!UseMCJIT && NoLazyCompilation) { + for (Module::iterator I = Mod->begin(), E = Mod->end(); I != E; ++I) { + Function *Fn = &*I; + if (Fn != EntryFn && !Fn->isDeclaration()) + EE->getPointerToFunction(Fn); + } } } @@ -484,12 +484,10 @@ int main(int argc, char **argv, char * const *envp) { RemoteTarget Target; Target.create(); - // Ask for a pointer to the entry function. This triggers the actual - // compilation. - (void)EE->getPointerToFunction(EntryFn); + // Trigger compilation. + EE->generateCodeForModule(Mod); - // Enough has been compiled to execute the entry function now, so - // layout the target memory. + // Layout the target memory. layoutRemoteTargetMemory(&Target, MM); // Since we're executing in a (at least simulated) remote address space, -- cgit v1.2.3