mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-03 09:28:58 +00:00
add bitcode support
llvm-svn: 36849
This commit is contained in:
parent
11ca4f51ed
commit
ec83593e41
@ -19,13 +19,14 @@
|
|||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/Pass.h"
|
#include "llvm/Pass.h"
|
||||||
#include "llvm/Assembly/Parser.h"
|
#include "llvm/Assembly/Parser.h"
|
||||||
|
#include "llvm/Bitcode/ReaderWriter.h"
|
||||||
#include "llvm/Bytecode/Reader.h"
|
#include "llvm/Bytecode/Reader.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/Compressor.h"
|
#include "llvm/Support/Compressor.h"
|
||||||
#include "llvm/Support/FileUtilities.h"
|
#include "llvm/Support/FileUtilities.h"
|
||||||
|
#include "llvm/Support/MemoryBuffer.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
// Anonymous namespace to define command line options for debugging.
|
// Anonymous namespace to define command line options for debugging.
|
||||||
@ -77,6 +78,13 @@ Module *llvm::ParseInputFile(const std::string &InputFilename) {
|
|||||||
ParseError Err;
|
ParseError Err;
|
||||||
Module *Result = ParseBytecodeFile(InputFilename,
|
Module *Result = ParseBytecodeFile(InputFilename,
|
||||||
Compressor::decompressToNewBuffer);
|
Compressor::decompressToNewBuffer);
|
||||||
|
if (!Result) {
|
||||||
|
std::auto_ptr<MemoryBuffer> Buffer(
|
||||||
|
MemoryBuffer::getFileOrSTDIN(&InputFilename[0], InputFilename.size()));
|
||||||
|
if (Buffer.get())
|
||||||
|
Result = ParseBitcodeFile(Buffer.get());
|
||||||
|
}
|
||||||
|
|
||||||
if (!Result && !(Result = ParseAssemblyFile(InputFilename,&Err))) {
|
if (!Result && !(Result = ParseAssemblyFile(InputFilename,&Err))) {
|
||||||
std::cerr << "bugpoint: " << Err.getMessage() << "\n";
|
std::cerr << "bugpoint: " << Err.getMessage() << "\n";
|
||||||
Result = 0;
|
Result = 0;
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
#include "llvm/PassManager.h"
|
#include "llvm/PassManager.h"
|
||||||
#include "llvm/ValueSymbolTable.h"
|
#include "llvm/ValueSymbolTable.h"
|
||||||
#include "llvm/Analysis/Verifier.h"
|
#include "llvm/Analysis/Verifier.h"
|
||||||
#include "llvm/Bytecode/Writer.h"
|
|
||||||
#include "llvm/Support/CFG.h"
|
#include "llvm/Support/CFG.h"
|
||||||
#include "llvm/Transforms/Scalar.h"
|
#include "llvm/Transforms/Scalar.h"
|
||||||
#include "llvm/Transforms/Utils/Cloning.h"
|
#include "llvm/Transforms/Utils/Cloning.h"
|
||||||
|
@ -11,7 +11,7 @@ LEVEL = ../..
|
|||||||
TOOLNAME = bugpoint
|
TOOLNAME = bugpoint
|
||||||
|
|
||||||
LINK_COMPONENTS := bcreader bcwriter asmparser instrumentation scalaropts ipo \
|
LINK_COMPONENTS := bcreader bcwriter asmparser instrumentation scalaropts ipo \
|
||||||
linker
|
linker bitreader bitwriter
|
||||||
REQUIRES_EH := 1
|
REQUIRES_EH := 1
|
||||||
|
|
||||||
include $(LEVEL)/Makefile.common
|
include $(LEVEL)/Makefile.common
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "llvm/PassManager.h"
|
#include "llvm/PassManager.h"
|
||||||
#include "llvm/Analysis/Verifier.h"
|
#include "llvm/Analysis/Verifier.h"
|
||||||
#include "llvm/Bytecode/WriteBytecodePass.h"
|
#include "llvm/Bytecode/WriteBytecodePass.h"
|
||||||
|
#include "llvm/Bitcode/ReaderWriter.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
#include "llvm/Support/FileUtilities.h"
|
#include "llvm/Support/FileUtilities.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
@ -38,6 +39,9 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
using namespace llvm;
|
using namespace llvm;
|
||||||
|
|
||||||
|
static bool Bitcode = false;
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
// ChildOutput - This option captures the name of the child output file that
|
// ChildOutput - This option captures the name of the child output file that
|
||||||
// is set up by the parent bugpoint process
|
// is set up by the parent bugpoint process
|
||||||
@ -110,6 +114,9 @@ int BugDriver::runPassesAsChild(const std::vector<const PassInfo*> &Passes) {
|
|||||||
|
|
||||||
// Write bytecode out to disk as the last step...
|
// Write bytecode out to disk as the last step...
|
||||||
OStream L(OutFile);
|
OStream L(OutFile);
|
||||||
|
if (Bitcode)
|
||||||
|
PM.add(CreateBitcodeWriterPass(OutFile));
|
||||||
|
else
|
||||||
PM.add(new WriteBytecodePass(&L));
|
PM.add(new WriteBytecodePass(&L));
|
||||||
|
|
||||||
// Run all queued passes.
|
// Run all queued passes.
|
||||||
|
Loading…
Reference in New Issue
Block a user