mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-28 22:24:28 +00:00
Use IRReader.h in opt, to support reading of LLVM Assembly files directly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80922 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
set(LLVM_REQUIRES_EH 1)
|
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
|
add_llvm_tool(opt
|
||||||
AnalysisWrappers.cpp
|
AnalysisWrappers.cpp
|
||||||
|
@ -10,6 +10,6 @@ LEVEL = ../..
|
|||||||
TOOLNAME = opt
|
TOOLNAME = opt
|
||||||
REQUIRES_EH := 1
|
REQUIRES_EH := 1
|
||||||
|
|
||||||
LINK_COMPONENTS := bitreader bitwriter instrumentation scalaropts ipo
|
LINK_COMPONENTS := bitreader bitwriter asmparser instrumentation scalaropts ipo
|
||||||
|
|
||||||
include $(LEVEL)/Makefile.common
|
include $(LEVEL)/Makefile.common
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "llvm/Target/TargetMachine.h"
|
#include "llvm/Target/TargetMachine.h"
|
||||||
#include "llvm/Support/PassNameParser.h"
|
#include "llvm/Support/PassNameParser.h"
|
||||||
#include "llvm/System/Signals.h"
|
#include "llvm/System/Signals.h"
|
||||||
|
#include "llvm/Support/IRReader.h"
|
||||||
#include "llvm/Support/ManagedStatic.h"
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Support/MemoryBuffer.h"
|
#include "llvm/Support/MemoryBuffer.h"
|
||||||
#include "llvm/Support/PluginLoader.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.
|
// FIXME: The choice of target should be controllable on the command line.
|
||||||
std::auto_ptr<TargetMachine> target;
|
std::auto_ptr<TargetMachine> target;
|
||||||
|
|
||||||
std::string ErrorMessage;
|
SMDiagnostic Err;
|
||||||
|
|
||||||
// Load the input module...
|
// Load the input module...
|
||||||
std::auto_ptr<Module> M;
|
std::auto_ptr<Module> M;
|
||||||
if (MemoryBuffer *Buffer
|
M.reset(ParseIRFile(InputFilename, Err, Context));
|
||||||
= MemoryBuffer::getFileOrSTDIN(InputFilename, &ErrorMessage)) {
|
|
||||||
M.reset(ParseBitcodeFile(Buffer, Context, &ErrorMessage));
|
|
||||||
delete Buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (M.get() == 0) {
|
if (M.get() == 0) {
|
||||||
errs() << argv[0] << ": ";
|
Err.Print(argv[0], errs());
|
||||||
if (ErrorMessage.size())
|
|
||||||
errs() << ErrorMessage << "\n";
|
|
||||||
else
|
|
||||||
errs() << "bitcode didn't read correctly.\n";
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user