diff options
| author | Dan Gohman <gohman@apple.com> | 2009-09-03 16:00:08 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2009-09-03 16:00:08 +0000 |
| commit | 0054b460ff706139a4ff128cb242a8905b433a4c (patch) | |
| tree | b66fe018e0021b3e452ad86d20c42d1a1ceb838d /llvm/tools | |
| parent | 38c1a7ba1207ecb5631b2da9a16694b0edd42f38 (diff) | |
| download | bcm5719-llvm-0054b460ff706139a4ff128cb242a8905b433a4c.tar.gz bcm5719-llvm-0054b460ff706139a4ff128cb242a8905b433a4c.zip | |
Use IRReader.h in opt, to support reading of LLVM Assembly files directly.
llvm-svn: 80922
Diffstat (limited to 'llvm/tools')
| -rw-r--r-- | llvm/tools/opt/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | llvm/tools/opt/Makefile | 2 | ||||
| -rw-r--r-- | llvm/tools/opt/opt.cpp | 15 |
3 files changed, 6 insertions, 13 deletions
diff --git a/llvm/tools/opt/CMakeLists.txt b/llvm/tools/opt/CMakeLists.txt index efcca80ddfc..b75cda0e128 100644 --- a/llvm/tools/opt/CMakeLists.txt +++ b/llvm/tools/opt/CMakeLists.txt @@ -1,5 +1,5 @@ set(LLVM_REQUIRES_EH 1) -set(LLVM_LINK_COMPONENTS bitreader bitwriter instrumentation scalaropts ipo) +set(LLVM_LINK_COMPONENTS bitreader asmparser bitwriter instrumentation scalaropts ipo) add_llvm_tool(opt AnalysisWrappers.cpp diff --git a/llvm/tools/opt/Makefile b/llvm/tools/opt/Makefile index 0afb0021757..b17be343a45 100644 --- a/llvm/tools/opt/Makefile +++ b/llvm/tools/opt/Makefile @@ -10,6 +10,6 @@ LEVEL = ../.. TOOLNAME = opt REQUIRES_EH := 1 -LINK_COMPONENTS := bitreader bitwriter instrumentation scalaropts ipo +LINK_COMPONENTS := bitreader bitwriter asmparser instrumentation scalaropts ipo include $(LEVEL)/Makefile.common diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp index d8bfd61c232..b1f5c0803a5 100644 --- a/llvm/tools/opt/opt.cpp +++ b/llvm/tools/opt/opt.cpp @@ -26,6 +26,7 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Support/PassNameParser.h" #include "llvm/System/Signals.h" +#include "llvm/Support/IRReader.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/PluginLoader.h" @@ -342,22 +343,14 @@ int main(int argc, char **argv) { // FIXME: The choice of target should be controllable on the command line. std::auto_ptr<TargetMachine> target; - std::string ErrorMessage; + SMDiagnostic Err; // Load the input module... std::auto_ptr<Module> M; - if (MemoryBuffer *Buffer - = MemoryBuffer::getFileOrSTDIN(InputFilename, &ErrorMessage)) { - M.reset(ParseBitcodeFile(Buffer, Context, &ErrorMessage)); - delete Buffer; - } + M.reset(ParseIRFile(InputFilename, Err, Context)); if (M.get() == 0) { - errs() << argv[0] << ": "; - if (ErrorMessage.size()) - errs() << ErrorMessage << "\n"; - else - errs() << "bitcode didn't read correctly.\n"; + Err.Print(argv[0], errs()); return 1; } |

