diff options
author | Chris Lattner <sabre@nondot.org> | 2006-03-08 18:43:36 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-03-08 18:43:36 +0000 |
commit | 42d0b455ec221fa8049944a3e6427a503859eae2 (patch) | |
tree | b5510694806bcfd1412c763f7d2408ba116cd36e /tools/lli | |
parent | 9ca6cdaee91fddcd3ea57dedcd624c14c7a40f65 (diff) | |
download | llvm-42d0b455ec221fa8049944a3e6427a503859eae2.tar.gz llvm-42d0b455ec221fa8049944a3e6427a503859eae2.tar.bz2 llvm-42d0b455ec221fa8049944a3e6427a503859eae2.tar.xz |
Fit to 80 columns.
Add support for running static ctor/dtors that aren't handled by __main.
This fixes programs with the JIT and the new CFE, such as HBD.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26620 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lli')
-rw-r--r-- | tools/lli/lli.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp index 73dfa11e5d..6eec2647d2 100644 --- a/tools/lli/lli.cpp +++ b/tools/lli/lli.cpp @@ -60,7 +60,8 @@ int main(int argc, char **argv, char * const *envp) { try { MP = getBytecodeModuleProvider(InputFile); } catch (std::string &err) { - std::cerr << "Error loading program '" << InputFile << "': " << err << "\n"; + std::cerr << "Error loading program '" << InputFile << "': " + << err << "\n"; exit(1); } @@ -69,10 +70,10 @@ int main(int argc, char **argv, char * const *envp) { MP->getModule()->setTargetTriple(TargetTriple); ExecutionEngine *EE = ExecutionEngine::create(MP, ForceInterpreter); - assert(EE && "Couldn't create an ExecutionEngine, not even an interpreter?"); + assert(EE &&"Couldn't create an ExecutionEngine, not even an interpreter?"); - // If the user specifically requested an argv[0] to pass into the program, do - // it now. + // If the user specifically requested an argv[0] to pass into the program, + // do it now. if (!FakeArgv0.empty()) { InputFile = FakeArgv0; } else { @@ -96,11 +97,17 @@ int main(int argc, char **argv, char * const *envp) { return -1; } - // Run main... + // Run static constructors. + EE->runStaticConstructorsDestructors(false); + + // Run main. int Result = EE->runFunctionAsMain(Fn, InputArgv, envp); - // If the program didn't explicitly call exit, call exit now, for the program. - // This ensures that any atexit handlers get called correctly. + // Run static destructors. + EE->runStaticConstructorsDestructors(true); + + // If the program didn't explicitly call exit, call exit now, for the + // program. This ensures that any atexit handlers get called correctly. Function *Exit = MP->getModule()->getOrInsertFunction("exit", Type::VoidTy, Type::IntTy, (Type *)0); |