#include "llvm/Pass.h"
#include "llvm/Assembly/Parser.h"
#include "llvm/Bitcode/ReaderWriter.h"
-#include "llvm/Bytecode/Reader.h"
#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/Compressor.h"
#include "llvm/Support/FileUtilities.h"
#include "llvm/Support/MemoryBuffer.h"
#include <iostream>
/// return it, or return null if not possible.
///
Module *llvm::ParseInputFile(const std::string &InputFilename) {
- ParseError Err;
- Module *Result = ParseBytecodeFile(InputFilename,
- Compressor::decompressToNewBuffer);
- if (!Result) {
- std::auto_ptr<MemoryBuffer> Buffer(
- MemoryBuffer::getFileOrSTDIN(&InputFilename[0], InputFilename.size()));
- if (Buffer.get())
- Result = ParseBitcodeFile(Buffer.get());
- }
+ std::auto_ptr<MemoryBuffer> Buffer(
+ MemoryBuffer::getFileOrSTDIN(&InputFilename[0], InputFilename.size()));
+ Module *Result = 0;
+ if (Buffer.get())
+ Result = ParseBitcodeFile(Buffer.get());
+ ParseError Err;
if (!Result && !(Result = ParseAssemblyFile(InputFilename,&Err))) {
std::cerr << "bugpoint: " << Err.getMessage() << "\n";
Result = 0;
TOOLNAME = bugpoint
-LINK_COMPONENTS := bcreader bcwriter asmparser instrumentation scalaropts ipo \
+LINK_COMPONENTS := asmparser instrumentation scalaropts ipo \
linker bitreader bitwriter
REQUIRES_EH := 1
#include "llvm/Module.h"
#include "llvm/PassManager.h"
#include "llvm/Analysis/Verifier.h"
-#include "llvm/Bytecode/WriteBytecodePass.h"
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Support/FileUtilities.h"
#include <fstream>
using namespace llvm;
-static bool Bitcode = false;
-
namespace {
// ChildOutput - This option captures the name of the child output file that
std::ios::binary;
std::ofstream Out(Filename.c_str(), io_mode);
if (!Out.good()) return true;
- try {
- OStream L(Out);
- WriteBytecodeToFile(M ? M : Program, L, /*compression=*/false);
- } catch (...) {
- return true;
- }
+
+ WriteBitcodeToFile(M, Out);
return false;
}
PM.add(createVerifierPass());
// Write bytecode out to disk as the last step...
- OStream L(OutFile);
- if (Bitcode)
- PM.add(CreateBitcodeWriterPass(OutFile));
- else
- PM.add(new WriteBytecodePass(&L));
+ PM.add(CreateBitcodeWriterPass(OutFile));
// Run all queued passes.
PM.run(*Program);
cerr << "Error opening bytecode file: " << inputFilename << "\n";
return(1);
}
- OStream L(InFile);
- WriteBytecodeToFile(Program,L,false);
+ WriteBitcodeToFile(Program, InFile);
InFile.close();
// setup the child process' arguments
# early so we can set up LINK_COMPONENTS before including Makefile.rules
include $(LEVEL)/Makefile.config
-LINK_COMPONENTS := $(TARGETS_TO_BUILD) bcreader bitreader
+LINK_COMPONENTS := $(TARGETS_TO_BUILD) bitreader
include $(LLVM_SRC_ROOT)/Makefile.rules
//===----------------------------------------------------------------------===//
#include "llvm/Bitcode/ReaderWriter.h"
-#include "llvm/Bytecode/Reader.h"
#include "llvm/CodeGen/FileWriters.h"
#include "llvm/CodeGen/LinkAllCodegenComponents.h"
#include "llvm/Target/SubtargetFeature.h"
#include "llvm/Target/TargetMachineRegistry.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Module.h"
+#include "llvm/ModuleProvider.h"
#include "llvm/PassManager.h"
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/Compressor.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/PluginLoader.h"
#include <memory>
using namespace llvm;
-cl::opt<bool> Bitcode("bitcode");
-
-
// General options for llc. Other pass-specific options are specified
// within the corresponding llc passes, and target-specific options
// and back-end code generation options are specified with the target machine.
std::string ErrorMessage;
std::auto_ptr<Module> M;
- if (Bitcode) {
- std::auto_ptr<MemoryBuffer> Buffer(
- MemoryBuffer::getFileOrSTDIN(&InputFilename[0], InputFilename.size()));
- if (Buffer.get())
- M.reset(ParseBitcodeFile(Buffer.get(), &ErrorMessage));
- else
- ErrorMessage = "Error reading file '" + InputFilename + "'";
- } else {
- M.reset(ParseBytecodeFile(InputFilename,
- Compressor::decompressToNewBuffer,
- &ErrorMessage));
+ {
+ std::auto_ptr<MemoryBuffer> Buffer(
+ MemoryBuffer::getFileOrSTDIN(&InputFilename[0], InputFilename.size()));
+ if (Buffer.get())
+ M.reset(ParseBitcodeFile(Buffer.get(), &ErrorMessage));
+ else
+ ErrorMessage = "Error reading file '" + InputFilename + "'";
}
if (M.get() == 0) {
std::cerr << argv[0] << ": bytecode didn't read correctly.\n";
LEVEL := ../..
TOOLNAME := lli
-LINK_COMPONENTS := jit interpreter native bcreader bitreader selectiondag
+LINK_COMPONENTS := jit interpreter native bitreader selectiondag
# Enable JIT support
include $(LEVEL)/Makefile.common
#include "llvm/ModuleProvider.h"
#include "llvm/Type.h"
#include "llvm/Bitcode/ReaderWriter.h"
-#include "llvm/Bytecode/Reader.h"
#include "llvm/CodeGen/LinkAllCodegenComponents.h"
#include "llvm/ExecutionEngine/JIT.h"
#include "llvm/ExecutionEngine/Interpreter.h"
#include "llvm/ExecutionEngine/GenericValue.h"
#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/Compressor.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/PluginLoader.h"
using namespace llvm;
namespace {
- cl::opt<bool> Bitcode("bitcode");
-
cl::opt<std::string>
InputFile(cl::desc("<input bytecode>"), cl::Positional, cl::init("-"));
// Load the bytecode...
std::string ErrorMsg;
ModuleProvider *MP = 0;
- if (Bitcode) {
- MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(&InputFile[0],
- InputFile.size());
- if (Buffer == 0)
- ErrorMsg = "Error reading file '" + InputFile + "'";
- else {
- MP = getBitcodeModuleProvider(Buffer, &ErrorMsg);
- if (!MP) delete Buffer;
- }
- } else {
- MP = getBytecodeModuleProvider(InputFile,
- Compressor::decompressToNewBuffer,
- &ErrorMsg);
+ MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(&InputFile[0],
+ InputFile.size());
+ if (Buffer == 0)
+ ErrorMsg = "Error reading file '" + InputFile + "'";
+ else {
+ MP = getBitcodeModuleProvider(Buffer, &ErrorMsg);
+ if (!MP) delete Buffer;
}
if (!MP) {
BUILD_ARCHIVE = 1
endif
-LINK_COMPONENTS := $(TARGETS_TO_BUILD) ipo scalaropts linker bcreader bcwriter bitreader bitwriter
+LINK_COMPONENTS := $(TARGETS_TO_BUILD) ipo scalaropts linker bitreader bitwriter
include $(LEVEL)/Makefile.common
#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"
#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>
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() {
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;
}
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
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();
TOOLNAME = opt
REQUIRES_EH := 1
-LINK_COMPONENTS := bcreader bcwriter bitreader bitwriter instrumentation scalaropts ipo
+LINK_COMPONENTS := bitreader bitwriter instrumentation scalaropts ipo
include $(LEVEL)/Makefile.common
#include "llvm/Module.h"
#include "llvm/PassManager.h"
-#include "llvm/Bytecode/Reader.h"
-#include "llvm/Bytecode/WriteBytecodePass.h"
#include "llvm/Bitcode/ReaderWriter.h"
#include "llvm/Assembly/PrintModulePass.h"
#include "llvm/Analysis/Verifier.h"
#include <algorithm>
using namespace llvm;
-static cl::opt<bool> Bitcode("bitcode");
-
// The OptimizationList is automatically populated with registered Passes by the
// PassNameParser.
//
static cl::list<const PassInfo*, bool, PassNameParser>
PassList(cl::desc("Optimizations available:"));
-static cl::opt<bool> NoCompress("disable-compression", cl::init(true),
- cl::desc("Don't compress the generated bytecode"));
-
// Other command line options...
//
static cl::opt<std::string>
// Load the input module...
std::auto_ptr<Module> M;
- if (Bitcode) {
- MemoryBuffer *Buffer
- = MemoryBuffer::getFileOrSTDIN(&InputFilename[0], InputFilename.size());
-
- if (Buffer == 0)
- ErrorMessage = "Error reading file '" + InputFilename + "'";
- else
- M.reset(ParseBitcodeFile(Buffer, &ErrorMessage));
-
- delete Buffer;
- } else {
- M.reset(ParseBytecodeFile(InputFilename,
- Compressor::decompressToNewBuffer,
- &ErrorMessage));
- }
+ MemoryBuffer *Buffer
+ = MemoryBuffer::getFileOrSTDIN(&InputFilename[0], InputFilename.size());
+
+ if (Buffer == 0)
+ ErrorMessage = "Error reading file '" + InputFilename + "'";
+ else
+ M.reset(ParseBitcodeFile(Buffer, &ErrorMessage));
+
+ delete Buffer;
if (M.get() == 0) {
cerr << argv[0] << ": ";
if (ErrorMessage.size())
Passes.add(createVerifierPass());
// Write bytecode out to disk or cout as the last step...
- OStream L(*Out);
- if (!NoOutput && !AnalyzeOnly) {
- if (Bitcode)
- Passes.add(CreateBitcodeWriterPass(*Out));
- else
- Passes.add(new WriteBytecodePass(&L, false, !NoCompress));
- }
+ if (!NoOutput && !AnalyzeOnly)
+ Passes.add(CreateBitcodeWriterPass(*Out));
// Now that we have all of the passes ready, run them.
Passes.run(*M.get());