summaryrefslogtreecommitdiff
path: root/tools/lto/lto.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-05-06 09:32:02 +0000
committerChris Lattner <sabre@nondot.org>2007-05-06 09:32:02 +0000
commit744879ea01779a48f898a801c847677b0bfa824a (patch)
tree1602b46ba1a9012436d5bb3b17e1109080394cfd /tools/lto/lto.cpp
parent73a978a753f66003fb8959af40549ca18b612cd1 (diff)
downloadllvm-744879ea01779a48f898a801c847677b0bfa824a.tar.gz
llvm-744879ea01779a48f898a801c847677b0bfa824a.tar.bz2
llvm-744879ea01779a48f898a801c847677b0bfa824a.tar.xz
switch tools to bitcode from bytecode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36872 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lto/lto.cpp')
-rw-r--r--tools/lto/lto.cpp25
1 files changed, 4 insertions, 21 deletions
diff --git a/tools/lto/lto.cpp b/tools/lto/lto.cpp
index f7ea310578..3420cdf67b 100644
--- a/tools/lto/lto.cpp
+++ b/tools/lto/lto.cpp
@@ -17,9 +17,8 @@
#include "llvm/Linker.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
+#include "llvm/ModuleProvider.h"
#include "llvm/Bitcode/ReaderWriter.h"
-#include "llvm/Bytecode/Reader.h"
-#include "llvm/Bytecode/Writer.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileUtilities.h"
#include "llvm/Support/SystemUtils.h"
@@ -40,7 +39,6 @@
#include "llvm/Transforms/Scalar.h"
#include "llvm/Analysis/LoadValueNumbering.h"
#include "llvm/Support/MathExtras.h"
-#include "llvm/Support/Streams.h"
#include "llvm/LinkTimeOptimizer.h"
#include <fstream>
#include <ostream>
@@ -53,8 +51,6 @@ llvm::LinkTimeOptimizer *createLLVMOptimizer()
return l;
}
-static bool Bitcode = false;
-
/// If symbol is not used then make it internal and let optimizer takes
/// care of it.
void LLVMSymbol::mayBeNotUsed() {
@@ -121,16 +117,13 @@ LTO::getModule(const std::string &InputFilename)
NameToModuleMap::iterator pos = allModules.find(InputFilename.c_str());
if (pos != allModules.end())
m = allModules[InputFilename.c_str()];
- else if (Bitcode) {
+ else {
if (MemoryBuffer *Buffer
= MemoryBuffer::getFile(&InputFilename[0], InputFilename.size())) {
m = ParseBitcodeFile(Buffer);
delete Buffer;
}
allModules[InputFilename.c_str()] = m;
- } else {
- m = ParseBytecodeFile(InputFilename);
- allModules[InputFilename.c_str()] = m;
}
return m;
}
@@ -385,12 +378,7 @@ LTO::optimizeModules(const std::string &OutputFilename,
std::string tempFileName(FinalOutputPath.c_str());
tempFileName += "0.bc";
std::ofstream Out(tempFileName.c_str(), io_mode);
- if (Bitcode) {
- WriteBitcodeToFile(bigOne, Out);
- } else {
- OStream L(Out);
- WriteBytecodeToFile(bigOne, L);
- }
+ WriteBitcodeToFile(bigOne, Out);
}
// Strip leading underscore because it was added to match names
@@ -443,12 +431,7 @@ LTO::optimizeModules(const std::string &OutputFilename,
std::string tempFileName(FinalOutputPath.c_str());
tempFileName += "1.bc";
std::ofstream Out(tempFileName.c_str(), io_mode);
- if (Bitcode) {
- WriteBitcodeToFile(bigOne, Out);
- } else {
- OStream L(Out);
- WriteBytecodeToFile(bigOne, L);
- }
+ WriteBitcodeToFile(bigOne, Out);
}
targetTriple = bigOne->getTargetTriple();