[llvm-commits] [llvm] r80922 - in /llvm/trunk/tools/opt: CMakeLists.txt Makefile opt.cpp
Dan Gohman
gohman at apple.com
Thu Sep 3 09:00:08 PDT 2009
Author: djg
Date: Thu Sep 3 11:00:08 2009
New Revision: 80922
URL: http://llvm.org/viewvc/llvm-project?rev=80922&view=rev
Log:
Use IRReader.h in opt, to support reading of LLVM Assembly files directly.
Modified:
llvm/trunk/tools/opt/CMakeLists.txt
llvm/trunk/tools/opt/Makefile
llvm/trunk/tools/opt/opt.cpp
Modified: llvm/trunk/tools/opt/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/CMakeLists.txt?rev=80922&r1=80921&r2=80922&view=diff
==============================================================================
--- llvm/trunk/tools/opt/CMakeLists.txt (original)
+++ llvm/trunk/tools/opt/CMakeLists.txt Thu Sep 3 11:00:08 2009
@@ -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
Modified: llvm/trunk/tools/opt/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/Makefile?rev=80922&r1=80921&r2=80922&view=diff
==============================================================================
--- llvm/trunk/tools/opt/Makefile (original)
+++ llvm/trunk/tools/opt/Makefile Thu Sep 3 11:00:08 2009
@@ -10,6 +10,6 @@
TOOLNAME = opt
REQUIRES_EH := 1
-LINK_COMPONENTS := bitreader bitwriter instrumentation scalaropts ipo
+LINK_COMPONENTS := bitreader bitwriter asmparser instrumentation scalaropts ipo
include $(LEVEL)/Makefile.common
Modified: llvm/trunk/tools/opt/opt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/opt.cpp?rev=80922&r1=80921&r2=80922&view=diff
==============================================================================
--- llvm/trunk/tools/opt/opt.cpp (original)
+++ llvm/trunk/tools/opt/opt.cpp Thu Sep 3 11:00:08 2009
@@ -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 @@
// 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;
}
More information about the llvm-commits
mailing list