From 46a27169104ac4cded2bd91e7f872efa80e08446 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Sat, 13 Nov 2010 00:28:01 +0000 Subject: lli: Switch to using ParseIRFile, for consistency with other LLVM tools. - Also, switch tests to not using llvm-as. They run 20% faster now, not that it matters. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118952 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/lli/Makefile | 2 +- tools/lli/lli.cpp | 16 ++++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) (limited to 'tools/lli') diff --git a/tools/lli/Makefile b/tools/lli/Makefile index 8f6eeed..3217d23 100644 --- a/tools/lli/Makefile +++ b/tools/lli/Makefile @@ -9,7 +9,7 @@ LEVEL := ../.. TOOLNAME := lli -LINK_COMPONENTS := jit interpreter nativecodegen bitreader selectiondag +LINK_COMPONENTS := jit interpreter nativecodegen bitreader asmparser selectiondag # Enable JIT support include $(LEVEL)/Makefile.common diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp index adc6e90..fa2de76 100644 --- a/tools/lli/lli.cpp +++ b/tools/lli/lli.cpp @@ -24,6 +24,7 @@ #include "llvm/ExecutionEngine/JIT.h" #include "llvm/ExecutionEngine/JITEventListener.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/IRReader.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/PluginLoader.h" @@ -136,20 +137,15 @@ int main(int argc, char **argv, char * const *envp) { sys::Process::PreventCoreFiles(); // Load the bitcode... - std::string ErrorMsg; - Module *Mod = NULL; - if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(InputFile,&ErrorMsg)){ - Mod = getLazyBitcodeModule(Buffer, Context, &ErrorMsg); - if (!Mod) delete Buffer; - } - + SMDiagnostic Err; + Module *Mod = ParseIRFile(InputFile, Err, Context); if (!Mod) { - errs() << argv[0] << ": error loading program '" << InputFile << "': " - << ErrorMsg << "\n"; - exit(1); + Err.Print(argv[0], errs()); + return 1; } // If not jitting lazily, load the whole bitcode file eagerly too. + std::string ErrorMsg; if (NoLazyCompilation) { if (Mod->MaterializeAllPermanently(&ErrorMsg)) { errs() << argv[0] << ": bitcode didn't read correctly.\n"; -- cgit v1.1