llvm.org GIT mirror llvm / 03b6963
add bitcode support git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36849 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 13 years ago
4 changed file(s) with 18 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
1818 #include "llvm/Module.h"
1919 #include "llvm/Pass.h"
2020 #include "llvm/Assembly/Parser.h"
21 #include "llvm/Bitcode/ReaderWriter.h"
2122 #include "llvm/Bytecode/Reader.h"
2223 #include "llvm/Support/CommandLine.h"
2324 #include "llvm/Support/Compressor.h"
2425 #include "llvm/Support/FileUtilities.h"
26 #include "llvm/Support/MemoryBuffer.h"
2527 #include
2628 #include
27
2829 using namespace llvm;
2930
3031 // Anonymous namespace to define command line options for debugging.
7677 ParseError Err;
7778 Module *Result = ParseBytecodeFile(InputFilename,
7879 Compressor::decompressToNewBuffer);
80 if (!Result) {
81 std::auto_ptr Buffer(
82 MemoryBuffer::getFileOrSTDIN(&InputFilename[0], InputFilename.size()));
83 if (Buffer.get())
84 Result = ParseBitcodeFile(Buffer.get());
85 }
86
7987 if (!Result && !(Result = ParseAssemblyFile(InputFilename,&Err))) {
8088 std::cerr << "bugpoint: " << Err.getMessage() << "\n";
8189 Result = 0;
2121 #include "llvm/PassManager.h"
2222 #include "llvm/ValueSymbolTable.h"
2323 #include "llvm/Analysis/Verifier.h"
24 #include "llvm/Bytecode/Writer.h"
2524 #include "llvm/Support/CFG.h"
2625 #include "llvm/Transforms/Scalar.h"
2726 #include "llvm/Transforms/Utils/Cloning.h"
1010 TOOLNAME = bugpoint
1111
1212 LINK_COMPONENTS := bcreader bcwriter asmparser instrumentation scalaropts ipo \
13 linker
13 linker bitreader bitwriter
1414 REQUIRES_EH := 1
1515
1616 include $(LEVEL)/Makefile.common
2323 #include "llvm/PassManager.h"
2424 #include "llvm/Analysis/Verifier.h"
2525 #include "llvm/Bytecode/WriteBytecodePass.h"
26 #include "llvm/Bitcode/ReaderWriter.h"
2627 #include "llvm/Target/TargetData.h"
2728 #include "llvm/Support/FileUtilities.h"
2829 #include "llvm/Support/CommandLine.h"
3637
3738 #include
3839 using namespace llvm;
40
41 static bool Bitcode = false;
42
3943
4044 namespace {
4145 // ChildOutput - This option captures the name of the child output file that
109113
110114 // Write bytecode out to disk as the last step...
111115 OStream L(OutFile);
112 PM.add(new WriteBytecodePass(&L));
116 if (Bitcode)
117 PM.add(CreateBitcodeWriterPass(OutFile));
118 else
119 PM.add(new WriteBytecodePass(&L));
113120
114121 // Run all queued passes.
115122 PM.run(*Program);