From 778b06bbcecbe52125dddcb06e898806b1e2b3c7 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 2 Sep 2009 19:35:19 +0000 Subject: Switch llc from ParseBitcodeFile to ParseIRFile. This lets llc transparently read either LLVM Assembly or LLVM Bitcode files. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80829 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llc/Makefile | 2 +- tools/llc/llc.cpp | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/tools/llc/Makefile b/tools/llc/Makefile index 8514040cf2..7319aada48 100644 --- a/tools/llc/Makefile +++ b/tools/llc/Makefile @@ -15,7 +15,7 @@ TOOLNAME = llc # early so we can set up LINK_COMPONENTS before including Makefile.rules include $(LEVEL)/Makefile.config -LINK_COMPONENTS := $(TARGETS_TO_BUILD) bitreader +LINK_COMPONENTS := $(TARGETS_TO_BUILD) bitreader asmparser include $(LLVM_SRC_ROOT)/Makefile.rules diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp index 6ff97f3f5b..8de49c08a7 100644 --- a/tools/llc/llc.cpp +++ b/tools/llc/llc.cpp @@ -20,7 +20,7 @@ #include "llvm/Pass.h" #include "llvm/ADT/Triple.h" #include "llvm/Analysis/Verifier.h" -#include "llvm/Bitcode/ReaderWriter.h" +#include "llvm/Support/IRReader.h" #include "llvm/CodeGen/FileWriters.h" #include "llvm/CodeGen/LinkAllAsmWriterComponents.h" #include "llvm/CodeGen/LinkAllCodegenComponents.h" @@ -218,16 +218,12 @@ int main(int argc, char **argv) { cl::ParseCommandLineOptions(argc, argv, "llvm system compiler\n"); // Load the module to be compiled... - std::string ErrorMessage; + SMDiagnostic Err; std::auto_ptr M; - std::auto_ptr Buffer( - MemoryBuffer::getFileOrSTDIN(InputFilename, &ErrorMessage)); - if (Buffer.get()) - M.reset(ParseBitcodeFile(Buffer.get(), Context, &ErrorMessage)); + M.reset(ParseIRFile(InputFilename, Err, Context)); if (M.get() == 0) { - errs() << argv[0] << ": bitcode didn't read correctly.\n"; - errs() << "Reason: " << ErrorMessage << "\n"; + Err.Print(argv[0], errs()); return 1; } Module &mod = *M.get(); -- cgit v1.2.3