mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-16 12:24:03 +00:00
This reverts commit r234460 and r234461.
Revert "Add classof implementations to the raw_ostream classes." Revert "Use the cast machinery to remove dummy uses of formatted_raw_ostream." The underlying issue can be fixed without classof. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234495 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -140,12 +140,8 @@ public:
|
|||||||
uint64_t current_pos() const override { return Count; }
|
uint64_t current_pos() const override { return Count; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
raw_counting_ostream() : raw_ostream(SK_COUNTING), Count(0) {}
|
raw_counting_ostream() : Count(0) {}
|
||||||
~raw_counting_ostream() { flush(); }
|
~raw_counting_ostream() { flush(); }
|
||||||
|
|
||||||
static bool classof(const raw_ostream *OS) {
|
|
||||||
return OS->getKind() == SK_COUNTING;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
raw_counting_ostream OutStream;
|
raw_counting_ostream OutStream;
|
||||||
|
@ -85,20 +85,14 @@ public:
|
|||||||
/// underneath it.
|
/// underneath it.
|
||||||
///
|
///
|
||||||
formatted_raw_ostream(raw_ostream &Stream, bool Delete = false)
|
formatted_raw_ostream(raw_ostream &Stream, bool Delete = false)
|
||||||
: raw_ostream(SK_FORMATTED), TheStream(nullptr), DeleteStream(false),
|
: raw_ostream(), TheStream(nullptr), DeleteStream(false), Position(0, 0) {
|
||||||
Position(0, 0) {
|
|
||||||
setStream(Stream, Delete);
|
setStream(Stream, Delete);
|
||||||
}
|
}
|
||||||
explicit formatted_raw_ostream()
|
explicit formatted_raw_ostream()
|
||||||
: raw_ostream(SK_FORMATTED), TheStream(nullptr), DeleteStream(false),
|
: raw_ostream(), TheStream(nullptr), DeleteStream(false), Position(0, 0) {
|
||||||
Position(0, 0) {
|
|
||||||
Scanned = nullptr;
|
Scanned = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool classof(const raw_ostream *OS) {
|
|
||||||
return OS->getKind() == SK_FORMATTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
~formatted_raw_ostream() {
|
~formatted_raw_ostream() {
|
||||||
flush();
|
flush();
|
||||||
releaseStream();
|
releaseStream();
|
||||||
|
@ -108,9 +108,13 @@ namespace llvm
|
|||||||
///
|
///
|
||||||
circular_raw_ostream(raw_ostream &Stream, const char *Header,
|
circular_raw_ostream(raw_ostream &Stream, const char *Header,
|
||||||
size_t BuffSize = 0, bool Owns = REFERENCE_ONLY)
|
size_t BuffSize = 0, bool Owns = REFERENCE_ONLY)
|
||||||
: raw_ostream(SK_CIRCULAR, /*unbuffered*/ true), TheStream(nullptr),
|
: raw_ostream(/*unbuffered*/true),
|
||||||
OwnsStream(Owns), BufferSize(BuffSize), BufferArray(nullptr),
|
TheStream(nullptr),
|
||||||
Filled(false), Banner(Header) {
|
OwnsStream(Owns),
|
||||||
|
BufferSize(BuffSize),
|
||||||
|
BufferArray(nullptr),
|
||||||
|
Filled(false),
|
||||||
|
Banner(Header) {
|
||||||
if (BufferSize != 0)
|
if (BufferSize != 0)
|
||||||
BufferArray = new char[BufferSize];
|
BufferArray = new char[BufferSize];
|
||||||
Cur = BufferArray;
|
Cur = BufferArray;
|
||||||
@ -140,10 +144,6 @@ namespace llvm
|
|||||||
///
|
///
|
||||||
void flushBufferWithBanner();
|
void flushBufferWithBanner();
|
||||||
|
|
||||||
static bool classof(const raw_ostream *OS) {
|
|
||||||
return OS->getKind() == SK_CIRCULAR;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// releaseStream - Delete the held stream if needed. Otherwise,
|
/// releaseStream - Delete the held stream if needed. Otherwise,
|
||||||
/// transfer the buffer settings from this circular_raw_ostream
|
/// transfer the buffer settings from this circular_raw_ostream
|
||||||
|
@ -33,11 +33,8 @@ class raw_os_ostream : public raw_ostream {
|
|||||||
uint64_t current_pos() const override;
|
uint64_t current_pos() const override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
raw_os_ostream(std::ostream &O) : raw_ostream(SK_STD_OS), OS(O) {}
|
raw_os_ostream(std::ostream &O) : OS(O) {}
|
||||||
~raw_os_ostream();
|
~raw_os_ostream();
|
||||||
static bool classof(const raw_ostream *OS) {
|
|
||||||
return OS->getKind() == SK_STD_OS;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end llvm namespace
|
} // end llvm namespace
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
#include "llvm/ADT/SmallVector.h"
|
#include "llvm/ADT/SmallVector.h"
|
||||||
#include "llvm/ADT/StringRef.h"
|
#include "llvm/ADT/StringRef.h"
|
||||||
#include "llvm/Support/Casting.h"
|
|
||||||
#include "llvm/Support/DataTypes.h"
|
#include "llvm/Support/DataTypes.h"
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
|
|
||||||
@ -68,17 +67,6 @@ private:
|
|||||||
} BufferMode;
|
} BufferMode;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum StreamKind {
|
|
||||||
SK_FD,
|
|
||||||
SK_STRING,
|
|
||||||
SK_SVECTOR,
|
|
||||||
SK_NULL,
|
|
||||||
SK_STD_OS,
|
|
||||||
SK_CIRCULAR,
|
|
||||||
SK_FORMATTED,
|
|
||||||
SK_COUNTING
|
|
||||||
};
|
|
||||||
|
|
||||||
// color order matches ANSI escape sequence, don't change
|
// color order matches ANSI escape sequence, don't change
|
||||||
enum Colors {
|
enum Colors {
|
||||||
BLACK=0,
|
BLACK=0,
|
||||||
@ -92,8 +80,8 @@ public:
|
|||||||
SAVEDCOLOR
|
SAVEDCOLOR
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit raw_ostream(StreamKind Kind, bool unbuffered = false)
|
explicit raw_ostream(bool unbuffered=false)
|
||||||
: BufferMode(unbuffered ? Unbuffered : InternalBuffer), Kind(Kind) {
|
: BufferMode(unbuffered ? Unbuffered : InternalBuffer) {
|
||||||
// Start out ready to flush.
|
// Start out ready to flush.
|
||||||
OutBufStart = OutBufEnd = OutBufCur = nullptr;
|
OutBufStart = OutBufEnd = OutBufCur = nullptr;
|
||||||
}
|
}
|
||||||
@ -271,10 +259,7 @@ public:
|
|||||||
// Subclass Interface
|
// Subclass Interface
|
||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
|
|
||||||
StreamKind getKind() const { return Kind; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
StreamKind Kind;
|
|
||||||
/// The is the piece of the class that is implemented by subclasses. This
|
/// The is the piece of the class that is implemented by subclasses. This
|
||||||
/// writes the \p Size bytes starting at
|
/// writes the \p Size bytes starting at
|
||||||
/// \p Ptr to the underlying stream.
|
/// \p Ptr to the underlying stream.
|
||||||
@ -379,8 +364,6 @@ public:
|
|||||||
/// this closes the file when the stream is destroyed.
|
/// this closes the file when the stream is destroyed.
|
||||||
raw_fd_ostream(int fd, bool shouldClose, bool unbuffered=false);
|
raw_fd_ostream(int fd, bool shouldClose, bool unbuffered=false);
|
||||||
|
|
||||||
static bool classof(const raw_ostream *OS) { return OS->getKind() == SK_FD; }
|
|
||||||
|
|
||||||
~raw_fd_ostream();
|
~raw_fd_ostream();
|
||||||
|
|
||||||
/// Manually flush the stream and close the file. Note that this does not call
|
/// Manually flush the stream and close the file. Note that this does not call
|
||||||
@ -460,13 +443,9 @@ class raw_string_ostream : public raw_ostream {
|
|||||||
/// currently in the buffer.
|
/// currently in the buffer.
|
||||||
uint64_t current_pos() const override { return OS.size(); }
|
uint64_t current_pos() const override { return OS.size(); }
|
||||||
public:
|
public:
|
||||||
explicit raw_string_ostream(std::string &O) : raw_ostream(SK_STRING), OS(O) {}
|
explicit raw_string_ostream(std::string &O) : OS(O) {}
|
||||||
~raw_string_ostream();
|
~raw_string_ostream();
|
||||||
|
|
||||||
static bool classof(const raw_ostream *OS) {
|
|
||||||
return OS->getKind() == SK_STRING;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Flushes the stream contents to the target string and returns the string's
|
/// Flushes the stream contents to the target string and returns the string's
|
||||||
/// reference.
|
/// reference.
|
||||||
std::string& str() {
|
std::string& str() {
|
||||||
@ -494,10 +473,6 @@ public:
|
|||||||
explicit raw_svector_ostream(SmallVectorImpl<char> &O);
|
explicit raw_svector_ostream(SmallVectorImpl<char> &O);
|
||||||
~raw_svector_ostream();
|
~raw_svector_ostream();
|
||||||
|
|
||||||
static bool classof(const raw_ostream *OS) {
|
|
||||||
return OS->getKind() == SK_SVECTOR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// This is called when the SmallVector we're appending to is changed outside
|
/// This is called when the SmallVector we're appending to is changed outside
|
||||||
/// of the raw_svector_ostream's control. It is only safe to do this if the
|
/// of the raw_svector_ostream's control. It is only safe to do this if the
|
||||||
/// raw_svector_ostream has previously been flushed.
|
/// raw_svector_ostream has previously been flushed.
|
||||||
@ -518,11 +493,8 @@ class raw_null_ostream : public raw_ostream {
|
|||||||
uint64_t current_pos() const override;
|
uint64_t current_pos() const override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit raw_null_ostream() : raw_ostream(SK_NULL) {}
|
explicit raw_null_ostream() {}
|
||||||
~raw_null_ostream();
|
~raw_null_ostream();
|
||||||
static bool classof(const raw_ostream *OS) {
|
|
||||||
return OS->getKind() == SK_NULL;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end llvm namespace
|
} // end llvm namespace
|
||||||
|
@ -207,9 +207,8 @@ public:
|
|||||||
/// emitted. Typically this will involve several steps of code generation.
|
/// emitted. Typically this will involve several steps of code generation.
|
||||||
/// This method should return true if emission of this file type is not
|
/// This method should return true if emission of this file type is not
|
||||||
/// supported, or false on success.
|
/// supported, or false on success.
|
||||||
/// If producing assembly, the stream must be a formatted_raw_ostream.
|
virtual bool addPassesToEmitFile(PassManagerBase &,
|
||||||
/// For other formats any raw_ostream will do.
|
formatted_raw_ostream &,
|
||||||
virtual bool addPassesToEmitFile(PassManagerBase &, raw_ostream &,
|
|
||||||
CodeGenFileType,
|
CodeGenFileType,
|
||||||
bool /*DisableVerify*/ = true,
|
bool /*DisableVerify*/ = true,
|
||||||
AnalysisID /*StartAfter*/ = nullptr,
|
AnalysisID /*StartAfter*/ = nullptr,
|
||||||
@ -256,7 +255,9 @@ public:
|
|||||||
/// for generating a pipeline of CodeGen passes.
|
/// for generating a pipeline of CodeGen passes.
|
||||||
virtual TargetPassConfig *createPassConfig(PassManagerBase &PM);
|
virtual TargetPassConfig *createPassConfig(PassManagerBase &PM);
|
||||||
|
|
||||||
bool addPassesToEmitFile(PassManagerBase &PM, raw_ostream &Out,
|
/// Add passes to the specified pass manager to get the specified file
|
||||||
|
/// emitted. Typically this will involve several steps of code generation.
|
||||||
|
bool addPassesToEmitFile(PassManagerBase &PM, formatted_raw_ostream &Out,
|
||||||
CodeGenFileType FileType, bool DisableVerify = true,
|
CodeGenFileType FileType, bool DisableVerify = true,
|
||||||
AnalysisID StartAfter = nullptr,
|
AnalysisID StartAfter = nullptr,
|
||||||
AnalysisID StopAfter = nullptr) override;
|
AnalysisID StopAfter = nullptr) override;
|
||||||
|
@ -140,9 +140,12 @@ static MCContext *addPassesToGenerateCode(LLVMTargetMachine *TM,
|
|||||||
return &MMI->getContext();
|
return &MMI->getContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LLVMTargetMachine::addPassesToEmitFile(
|
bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
|
||||||
PassManagerBase &PM, raw_ostream &Out, CodeGenFileType FileType,
|
formatted_raw_ostream &Out,
|
||||||
bool DisableVerify, AnalysisID StartAfter, AnalysisID StopAfter) {
|
CodeGenFileType FileType,
|
||||||
|
bool DisableVerify,
|
||||||
|
AnalysisID StartAfter,
|
||||||
|
AnalysisID StopAfter) {
|
||||||
// Add common CodeGen passes.
|
// Add common CodeGen passes.
|
||||||
MCContext *Context = addPassesToGenerateCode(this, PM, DisableVerify,
|
MCContext *Context = addPassesToGenerateCode(this, PM, DisableVerify,
|
||||||
StartAfter, StopAfter);
|
StartAfter, StopAfter);
|
||||||
@ -182,9 +185,9 @@ bool LLVMTargetMachine::addPassesToEmitFile(
|
|||||||
MCAsmBackend *MAB = getTarget().createMCAsmBackend(MRI, getTargetTriple(),
|
MCAsmBackend *MAB = getTarget().createMCAsmBackend(MRI, getTargetTriple(),
|
||||||
TargetCPU);
|
TargetCPU);
|
||||||
MCStreamer *S = getTarget().createAsmStreamer(
|
MCStreamer *S = getTarget().createAsmStreamer(
|
||||||
*Context, cast<formatted_raw_ostream>(Out),
|
*Context, Out, Options.MCOptions.AsmVerbose,
|
||||||
Options.MCOptions.AsmVerbose, Options.MCOptions.MCUseDwarfDirectory,
|
Options.MCOptions.MCUseDwarfDirectory, InstPrinter, MCE, MAB,
|
||||||
InstPrinter, MCE, MAB, Options.MCOptions.ShowMCInst);
|
Options.MCOptions.ShowMCInst);
|
||||||
AsmStreamer.reset(S);
|
AsmStreamer.reset(S);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "llvm/MC/SubtargetFeature.h"
|
#include "llvm/MC/SubtargetFeature.h"
|
||||||
#include "llvm/Support/CommandLine.h"
|
#include "llvm/Support/CommandLine.h"
|
||||||
#include "llvm/Support/FileSystem.h"
|
#include "llvm/Support/FileSystem.h"
|
||||||
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#include "llvm/Support/Host.h"
|
#include "llvm/Support/Host.h"
|
||||||
#include "llvm/Support/MemoryBuffer.h"
|
#include "llvm/Support/MemoryBuffer.h"
|
||||||
#include "llvm/Support/Signals.h"
|
#include "llvm/Support/Signals.h"
|
||||||
@ -573,11 +574,13 @@ bool LTOCodeGenerator::compileOptimized(raw_ostream &out, std::string &errMsg) {
|
|||||||
|
|
||||||
legacy::PassManager codeGenPasses;
|
legacy::PassManager codeGenPasses;
|
||||||
|
|
||||||
|
formatted_raw_ostream Out(out);
|
||||||
|
|
||||||
// If the bitcode files contain ARC code and were compiled with optimization,
|
// If the bitcode files contain ARC code and were compiled with optimization,
|
||||||
// the ObjCARCContractPass must be run, so do it unconditionally here.
|
// the ObjCARCContractPass must be run, so do it unconditionally here.
|
||||||
codeGenPasses.add(createObjCARCContractPass());
|
codeGenPasses.add(createObjCARCContractPass());
|
||||||
|
|
||||||
if (TargetMach->addPassesToEmitFile(codeGenPasses, out,
|
if (TargetMach->addPassesToEmitFile(codeGenPasses, Out,
|
||||||
TargetMachine::CGFT_ObjectFile)) {
|
TargetMachine::CGFT_ObjectFile)) {
|
||||||
errMsg = "target file type not supported";
|
errMsg = "target file type not supported";
|
||||||
return false;
|
return false;
|
||||||
|
@ -114,8 +114,9 @@ static void debug_user_sig_handler(void *Cookie) {
|
|||||||
// know that debug mode is enabled and dbgs() really is a
|
// know that debug mode is enabled and dbgs() really is a
|
||||||
// circular_raw_ostream. If NDEBUG is defined, then dbgs() ==
|
// circular_raw_ostream. If NDEBUG is defined, then dbgs() ==
|
||||||
// errs() but this will never be invoked.
|
// errs() but this will never be invoked.
|
||||||
llvm::circular_raw_ostream &dbgout = cast<circular_raw_ostream>(llvm::dbgs());
|
llvm::circular_raw_ostream *dbgout =
|
||||||
dbgout.flushBufferWithBanner();
|
static_cast<llvm::circular_raw_ostream *>(&llvm::dbgs());
|
||||||
|
dbgout->flushBufferWithBanner();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// dbgs - Return a circular-buffered debug stream.
|
/// dbgs - Return a circular-buffered debug stream.
|
||||||
|
@ -489,7 +489,7 @@ void format_object_base::home() {
|
|||||||
|
|
||||||
raw_fd_ostream::raw_fd_ostream(StringRef Filename, std::error_code &EC,
|
raw_fd_ostream::raw_fd_ostream(StringRef Filename, std::error_code &EC,
|
||||||
sys::fs::OpenFlags Flags)
|
sys::fs::OpenFlags Flags)
|
||||||
: raw_ostream(SK_FD), Error(false), UseAtomicWrites(false), pos(0) {
|
: Error(false), UseAtomicWrites(false), pos(0) {
|
||||||
EC = std::error_code();
|
EC = std::error_code();
|
||||||
// Handle "-" as stdout. Note that when we do this, we consider ourself
|
// Handle "-" as stdout. Note that when we do this, we consider ourself
|
||||||
// the owner of stdout. This means that we can do things like close the
|
// the owner of stdout. This means that we can do things like close the
|
||||||
@ -519,8 +519,8 @@ raw_fd_ostream::raw_fd_ostream(StringRef Filename, std::error_code &EC,
|
|||||||
/// raw_fd_ostream ctor - FD is the file descriptor that this writes to. If
|
/// raw_fd_ostream ctor - FD is the file descriptor that this writes to. If
|
||||||
/// ShouldClose is true, this closes the file when the stream is destroyed.
|
/// ShouldClose is true, this closes the file when the stream is destroyed.
|
||||||
raw_fd_ostream::raw_fd_ostream(int fd, bool shouldClose, bool unbuffered)
|
raw_fd_ostream::raw_fd_ostream(int fd, bool shouldClose, bool unbuffered)
|
||||||
: raw_ostream(SK_FD, unbuffered), FD(fd), ShouldClose(shouldClose),
|
: raw_ostream(unbuffered), FD(fd),
|
||||||
Error(false), UseAtomicWrites(false) {
|
ShouldClose(shouldClose), Error(false), UseAtomicWrites(false) {
|
||||||
#ifdef O_BINARY
|
#ifdef O_BINARY
|
||||||
// Setting STDOUT to binary mode is necessary in Win32
|
// Setting STDOUT to binary mode is necessary in Win32
|
||||||
// to avoid undesirable linefeed conversion.
|
// to avoid undesirable linefeed conversion.
|
||||||
@ -749,8 +749,7 @@ void raw_string_ostream::write_impl(const char *Ptr, size_t Size) {
|
|||||||
// capacity. This allows raw_ostream to write directly into the correct place,
|
// capacity. This allows raw_ostream to write directly into the correct place,
|
||||||
// and we only need to set the vector size when the data is flushed.
|
// and we only need to set the vector size when the data is flushed.
|
||||||
|
|
||||||
raw_svector_ostream::raw_svector_ostream(SmallVectorImpl<char> &O)
|
raw_svector_ostream::raw_svector_ostream(SmallVectorImpl<char> &O) : OS(O) {
|
||||||
: raw_ostream(SK_SVECTOR), OS(O) {
|
|
||||||
// Set up the initial external buffer. We make sure that the buffer has at
|
// Set up the initial external buffer. We make sure that the buffer has at
|
||||||
// least 128 bytes free; raw_ostream itself only requires 64, but we want to
|
// least 128 bytes free; raw_ostream itself only requires 64, but we want to
|
||||||
// make sure that we don't grow the buffer unnecessarily on destruction (when
|
// make sure that we don't grow the buffer unnecessarily on destruction (when
|
||||||
|
@ -2146,13 +2146,13 @@ char CppWriter::ID = 0;
|
|||||||
// External Interface declaration
|
// External Interface declaration
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
bool CPPTargetMachine::addPassesToEmitFile(PassManagerBase &PM, raw_ostream &o,
|
bool CPPTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
|
||||||
|
formatted_raw_ostream &o,
|
||||||
CodeGenFileType FileType,
|
CodeGenFileType FileType,
|
||||||
bool DisableVerify,
|
bool DisableVerify,
|
||||||
AnalysisID StartAfter,
|
AnalysisID StartAfter,
|
||||||
AnalysisID StopAfter) {
|
AnalysisID StopAfter) {
|
||||||
if (FileType != TargetMachine::CGFT_AssemblyFile)
|
if (FileType != TargetMachine::CGFT_AssemblyFile) return true;
|
||||||
return true;
|
PM.add(new CppWriter(o));
|
||||||
PM.add(new CppWriter(cast<formatted_raw_ostream>(o)));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ struct CPPTargetMachine : public TargetMachine {
|
|||||||
: TargetMachine(T, "", TT, CPU, FS, Options) {}
|
: TargetMachine(T, "", TT, CPU, FS, Options) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool addPassesToEmitFile(PassManagerBase &PM, raw_ostream &Out,
|
bool addPassesToEmitFile(PassManagerBase &PM, formatted_raw_ostream &Out,
|
||||||
CodeGenFileType FileType, bool DisableVerify,
|
CodeGenFileType FileType, bool DisableVerify,
|
||||||
AnalysisID StartAfter,
|
AnalysisID StartAfter,
|
||||||
AnalysisID StopAfter) override;
|
AnalysisID StopAfter) override;
|
||||||
|
@ -183,9 +183,7 @@ void LLVMSetTargetMachineAsmVerbosity(LLVMTargetMachineRef T,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static LLVMBool LLVMTargetMachineEmit(LLVMTargetMachineRef T, LLVMModuleRef M,
|
static LLVMBool LLVMTargetMachineEmit(LLVMTargetMachineRef T, LLVMModuleRef M,
|
||||||
raw_ostream &OS,
|
formatted_raw_ostream &OS, LLVMCodeGenFileType codegen, char **ErrorMessage) {
|
||||||
LLVMCodeGenFileType codegen,
|
|
||||||
char **ErrorMessage) {
|
|
||||||
TargetMachine* TM = unwrap(T);
|
TargetMachine* TM = unwrap(T);
|
||||||
Module* Mod = unwrap(M);
|
Module* Mod = unwrap(M);
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#include "llvm/Linker/Linker.h"
|
#include "llvm/Linker/Linker.h"
|
||||||
#include "llvm/MC/SubtargetFeature.h"
|
#include "llvm/MC/SubtargetFeature.h"
|
||||||
#include "llvm/Object/IRObjectFile.h"
|
#include "llvm/Object/IRObjectFile.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/FormattedStream.h"
|
||||||
#include "llvm/Support/Host.h"
|
#include "llvm/Support/Host.h"
|
||||||
#include "llvm/Support/ManagedStatic.h"
|
#include "llvm/Support/ManagedStatic.h"
|
||||||
#include "llvm/Support/MemoryBuffer.h"
|
#include "llvm/Support/MemoryBuffer.h"
|
||||||
@ -804,8 +804,9 @@ static void codegen(Module &M) {
|
|||||||
|
|
||||||
{
|
{
|
||||||
raw_fd_ostream OS(FD, true);
|
raw_fd_ostream OS(FD, true);
|
||||||
|
formatted_raw_ostream FOS(OS);
|
||||||
|
|
||||||
if (TM->addPassesToEmitFile(CodeGenPasses, OS,
|
if (TM->addPassesToEmitFile(CodeGenPasses, FOS,
|
||||||
TargetMachine::CGFT_ObjectFile))
|
TargetMachine::CGFT_ObjectFile))
|
||||||
message(LDPL_FATAL, "Failed to setup codegen");
|
message(LDPL_FATAL, "Failed to setup codegen");
|
||||||
CodeGenPasses.run(M);
|
CodeGenPasses.run(M);
|
||||||
|
Reference in New Issue
Block a user