1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

Switch llc from ParseBitcodeFile to ParseIRFile. This lets llc

transparently read either LLVM Assembly or LLVM Bitcode files.

llvm-svn: 80829
This commit is contained in:
Dan Gohman 2009-09-02 19:35:19 +00:00
parent 55db099330
commit 6ebdbf7f07
2 changed files with 5 additions and 9 deletions

View File

@ -15,7 +15,7 @@ TOOLNAME = llc
# early so we can set up LINK_COMPONENTS before including Makefile.rules # early so we can set up LINK_COMPONENTS before including Makefile.rules
include $(LEVEL)/Makefile.config include $(LEVEL)/Makefile.config
LINK_COMPONENTS := $(TARGETS_TO_BUILD) bitreader LINK_COMPONENTS := $(TARGETS_TO_BUILD) bitreader asmparser
include $(LLVM_SRC_ROOT)/Makefile.rules include $(LLVM_SRC_ROOT)/Makefile.rules

View File

@ -20,7 +20,7 @@
#include "llvm/Pass.h" #include "llvm/Pass.h"
#include "llvm/ADT/Triple.h" #include "llvm/ADT/Triple.h"
#include "llvm/Analysis/Verifier.h" #include "llvm/Analysis/Verifier.h"
#include "llvm/Bitcode/ReaderWriter.h" #include "llvm/Support/IRReader.h"
#include "llvm/CodeGen/FileWriters.h" #include "llvm/CodeGen/FileWriters.h"
#include "llvm/CodeGen/LinkAllAsmWriterComponents.h" #include "llvm/CodeGen/LinkAllAsmWriterComponents.h"
#include "llvm/CodeGen/LinkAllCodegenComponents.h" #include "llvm/CodeGen/LinkAllCodegenComponents.h"
@ -218,16 +218,12 @@ int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, "llvm system compiler\n"); cl::ParseCommandLineOptions(argc, argv, "llvm system compiler\n");
// Load the module to be compiled... // Load the module to be compiled...
std::string ErrorMessage; SMDiagnostic Err;
std::auto_ptr<Module> M; std::auto_ptr<Module> M;
std::auto_ptr<MemoryBuffer> Buffer( M.reset(ParseIRFile(InputFilename, Err, Context));
MemoryBuffer::getFileOrSTDIN(InputFilename, &ErrorMessage));
if (Buffer.get())
M.reset(ParseBitcodeFile(Buffer.get(), Context, &ErrorMessage));
if (M.get() == 0) { if (M.get() == 0) {
errs() << argv[0] << ": bitcode didn't read correctly.\n"; Err.Print(argv[0], errs());
errs() << "Reason: " << ErrorMessage << "\n";
return 1; return 1;
} }
Module &mod = *M.get(); Module &mod = *M.get();