mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-05 13:29:22 +00:00
Make tool_output_file's raw_ostream instance a member variable instead
of a base class. This makes it possible to unregister the file from FilesToRemove when the file is done. Also, this eliminates the need for formatted_tool_output_file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112706 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
41154114f6
commit
d4c454317a
@ -19,14 +19,10 @@
|
|||||||
|
|
||||||
namespace llvm
|
namespace llvm
|
||||||
{
|
{
|
||||||
class formatted_tool_output_file;
|
|
||||||
|
|
||||||
/// formatted_raw_ostream - Formatted raw_fd_ostream to handle
|
/// formatted_raw_ostream - Formatted raw_fd_ostream to handle
|
||||||
/// asm-specific constructs.
|
/// asm-specific constructs.
|
||||||
///
|
///
|
||||||
class formatted_raw_ostream : public raw_ostream {
|
class formatted_raw_ostream : public raw_ostream {
|
||||||
friend class formatted_tool_output_file;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// DELETE_STREAM - Tell the destructor to delete the held stream.
|
/// DELETE_STREAM - Tell the destructor to delete the held stream.
|
||||||
///
|
///
|
||||||
@ -140,38 +136,6 @@ namespace llvm
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// formatted_tool_output_file - This is a subclass of formatted_raw_ostream
|
|
||||||
/// for use when the underlying stream is a tool_output_file. It exposes
|
|
||||||
/// keep() and several other member functions.
|
|
||||||
class formatted_tool_output_file : public formatted_raw_ostream {
|
|
||||||
private:
|
|
||||||
tool_output_file &get_tool_output_file() const {
|
|
||||||
return *static_cast<tool_output_file *>(TheStream);
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
formatted_tool_output_file(tool_output_file &Stream, bool Delete = false)
|
|
||||||
: formatted_raw_ostream(Stream, Delete) {}
|
|
||||||
|
|
||||||
formatted_tool_output_file() {}
|
|
||||||
|
|
||||||
~formatted_tool_output_file();
|
|
||||||
|
|
||||||
void setStream(tool_output_file &Stream, bool Delete = false) {
|
|
||||||
return formatted_raw_ostream::setStream(Stream, Delete);
|
|
||||||
}
|
|
||||||
|
|
||||||
void keep() { return get_tool_output_file().keep(); }
|
|
||||||
bool has_error() const { return get_tool_output_file().has_error(); }
|
|
||||||
void clear_error() { return get_tool_output_file().clear_error(); }
|
|
||||||
void close() {
|
|
||||||
// The inner stream is unbuffered; flush the outer stream's buffer.
|
|
||||||
flush();
|
|
||||||
// The inner stream can close its file descriptor now.
|
|
||||||
return get_tool_output_file().close();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/// fouts() - This returns a reference to a formatted_raw_ostream for
|
/// fouts() - This returns a reference to a formatted_raw_ostream for
|
||||||
/// standard output. Use it like: fouts() << "foo" << "bar";
|
/// standard output. Use it like: fouts() << "foo" << "bar";
|
||||||
formatted_raw_ostream &fouts();
|
formatted_raw_ostream &fouts();
|
||||||
|
@ -475,23 +475,43 @@ public:
|
|||||||
~raw_null_ostream();
|
~raw_null_ostream();
|
||||||
};
|
};
|
||||||
|
|
||||||
/// tool_output_file - This class behaves like a raw_fd_ostream but adds a
|
/// tool_output_file - This class contains a raw_fd_ostream and adds a
|
||||||
/// few extra features commonly needed for compiler-like tool output files:
|
/// few extra features commonly needed for compiler-like tool output files:
|
||||||
/// - The file is automatically deleted if the process is killed.
|
/// - The file is automatically deleted if the process is killed.
|
||||||
/// - The file is automatically deleted when the tool_output_file
|
/// - The file is automatically deleted when the tool_output_file
|
||||||
/// object is destroyed unless the client calls keep().
|
/// object is destroyed unless the client calls keep().
|
||||||
class tool_output_file : public raw_fd_ostream {
|
class tool_output_file {
|
||||||
std::string Filename;
|
/// Installer - This class is declared before the raw_fd_ostream so that
|
||||||
bool Keep;
|
/// it is constructed before the raw_fd_ostream is constructed and
|
||||||
|
/// destructed after the raw_fd_ostream is destructed. It installs
|
||||||
|
/// cleanups in its constructor and uninstalls them in its destructor.
|
||||||
|
class CleanupInstaller {
|
||||||
|
/// Filename - The name of the file.
|
||||||
|
std::string Filename;
|
||||||
|
public:
|
||||||
|
/// Keep - The flag which indicates whether we should not delete the file.
|
||||||
|
bool Keep;
|
||||||
|
|
||||||
|
explicit CleanupInstaller(const char *filename);
|
||||||
|
~CleanupInstaller();
|
||||||
|
} Installer;
|
||||||
|
|
||||||
|
/// OS - The contained stream. This is intentionally declared after
|
||||||
|
/// Installer.
|
||||||
|
raw_fd_ostream OS;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
/// tool_output_file - This constructor's arguments are passed to
|
||||||
|
/// to raw_fd_ostream's constructor.
|
||||||
tool_output_file(const char *filename, std::string &ErrorInfo,
|
tool_output_file(const char *filename, std::string &ErrorInfo,
|
||||||
unsigned Flags = 0);
|
unsigned Flags = 0);
|
||||||
|
|
||||||
~tool_output_file();
|
/// os - Return the contained raw_fd_ostream.
|
||||||
|
raw_fd_ostream &os() { return OS; }
|
||||||
|
|
||||||
/// keep - Indicate that the tool's job wrt this output file has been
|
/// keep - Indicate that the tool's job wrt this output file has been
|
||||||
/// successful and the file should not be deleted.
|
/// successful and the file should not be deleted.
|
||||||
void keep() { Keep = true; }
|
void keep() { Installer.Keep = true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end llvm namespace
|
} // end llvm namespace
|
||||||
|
@ -98,6 +98,3 @@ formatted_raw_ostream &llvm::fdbgs() {
|
|||||||
static formatted_raw_ostream S(dbgs());
|
static formatted_raw_ostream S(dbgs());
|
||||||
return S;
|
return S;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ~formatted_tool_output_file - Out-of-line destructor.
|
|
||||||
formatted_tool_output_file::~formatted_tool_output_file() {}
|
|
||||||
|
@ -670,25 +670,29 @@ uint64_t raw_null_ostream::current_pos() const {
|
|||||||
// tool_output_file
|
// tool_output_file
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
/// SetupRemoveOnSignal - This is a helper for tool_output_file's constructor
|
tool_output_file::CleanupInstaller::CleanupInstaller(const char *filename)
|
||||||
/// to allow the signal handlers to be installed before constructing the
|
: Filename(filename), Keep(false) {
|
||||||
/// base class raw_fd_ostream.
|
|
||||||
static const char *SetupRemoveOnSignal(const char *Filename) {
|
|
||||||
// Arrange for the file to be deleted if the process is killed.
|
// Arrange for the file to be deleted if the process is killed.
|
||||||
if (strcmp(Filename, "-") != 0)
|
if (Filename != "-")
|
||||||
sys::RemoveFileOnSignal(sys::Path(Filename));
|
sys::RemoveFileOnSignal(sys::Path(Filename));
|
||||||
return Filename;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tool_output_file::tool_output_file(const char *filename, std::string &ErrorInfo,
|
tool_output_file::CleanupInstaller::~CleanupInstaller() {
|
||||||
unsigned Flags)
|
|
||||||
: raw_fd_ostream(SetupRemoveOnSignal(filename), ErrorInfo, Flags),
|
|
||||||
Filename(filename),
|
|
||||||
Keep(!ErrorInfo.empty() /* If open fails, no cleanup is needed. */) {
|
|
||||||
}
|
|
||||||
|
|
||||||
tool_output_file::~tool_output_file() {
|
|
||||||
// Delete the file if the client hasn't told us not to.
|
// Delete the file if the client hasn't told us not to.
|
||||||
if (!Keep && Filename != "-")
|
if (!Keep && Filename != "-")
|
||||||
sys::Path(Filename).eraseFromDisk();
|
sys::Path(Filename).eraseFromDisk();
|
||||||
|
|
||||||
|
// Ok, the file is successfully written and closed, or deleted. There's no
|
||||||
|
// further need to clean it up on signals.
|
||||||
|
if (Filename != "-")
|
||||||
|
sys::DontRemoveFileOnSignal(sys::Path(Filename));
|
||||||
|
}
|
||||||
|
|
||||||
|
tool_output_file::tool_output_file(const char *filename, std::string &ErrorInfo,
|
||||||
|
unsigned Flags)
|
||||||
|
: Installer(filename),
|
||||||
|
OS(filename, ErrorInfo, Flags) {
|
||||||
|
// If open fails, no cleanup is needed.
|
||||||
|
if (!ErrorInfo.empty())
|
||||||
|
Installer.Keep = true;
|
||||||
}
|
}
|
||||||
|
@ -339,15 +339,15 @@ Module *BugDriver::ExtractMappedBlocksFromModule(const
|
|||||||
// If the BB doesn't have a name, give it one so we have something to key
|
// If the BB doesn't have a name, give it one so we have something to key
|
||||||
// off of.
|
// off of.
|
||||||
if (!BB->hasName()) BB->setName("tmpbb");
|
if (!BB->hasName()) BB->setName("tmpbb");
|
||||||
BlocksToNotExtractFile << BB->getParent()->getNameStr() << " "
|
BlocksToNotExtractFile.os() << BB->getParent()->getNameStr() << " "
|
||||||
<< BB->getName() << "\n";
|
<< BB->getName() << "\n";
|
||||||
}
|
}
|
||||||
BlocksToNotExtractFile.close();
|
BlocksToNotExtractFile.os().close();
|
||||||
if (BlocksToNotExtractFile.has_error()) {
|
if (BlocksToNotExtractFile.os().has_error()) {
|
||||||
errs() << "Error writing list of blocks to not extract: " << ErrorInfo
|
errs() << "Error writing list of blocks to not extract: " << ErrorInfo
|
||||||
<< "\n";
|
<< "\n";
|
||||||
EmitProgressBitcode(M, "basicblockextractfail", true);
|
EmitProgressBitcode(M, "basicblockextractfail", true);
|
||||||
BlocksToNotExtractFile.clear_error();
|
BlocksToNotExtractFile.os().clear_error();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
BlocksToNotExtractFile.keep();
|
BlocksToNotExtractFile.keep();
|
||||||
|
@ -58,14 +58,14 @@ bool BugDriver::writeProgramToFile(const std::string &Filename,
|
|||||||
tool_output_file Out(Filename.c_str(), ErrInfo,
|
tool_output_file Out(Filename.c_str(), ErrInfo,
|
||||||
raw_fd_ostream::F_Binary);
|
raw_fd_ostream::F_Binary);
|
||||||
if (ErrInfo.empty()) {
|
if (ErrInfo.empty()) {
|
||||||
WriteBitcodeToFile(M, Out);
|
WriteBitcodeToFile(M, Out.os());
|
||||||
Out.close();
|
Out.os().close();
|
||||||
if (!Out.has_error()) {
|
if (!Out.os().has_error()) {
|
||||||
Out.keep();
|
Out.keep();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Out.clear_error();
|
Out.os().clear_error();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,11 +140,11 @@ bool BugDriver::runPasses(Module *Program,
|
|||||||
errs() << "Error opening bitcode file: " << inputFilename.str() << "\n";
|
errs() << "Error opening bitcode file: " << inputFilename.str() << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
WriteBitcodeToFile(Program, InFile);
|
WriteBitcodeToFile(Program, InFile.os());
|
||||||
InFile.close();
|
InFile.os().close();
|
||||||
if (InFile.has_error()) {
|
if (InFile.os().has_error()) {
|
||||||
errs() << "Error writing bitcode file: " << inputFilename.str() << "\n";
|
errs() << "Error writing bitcode file: " << inputFilename.str() << "\n";
|
||||||
InFile.clear_error();
|
InFile.os().clear_error();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
InFile.keep();
|
InFile.keep();
|
||||||
|
@ -123,9 +123,9 @@ GetFileNameRoot(const std::string &InputFilename) {
|
|||||||
return outputFilename;
|
return outputFilename;
|
||||||
}
|
}
|
||||||
|
|
||||||
static formatted_tool_output_file *GetOutputStream(const char *TargetName,
|
static tool_output_file *GetOutputStream(const char *TargetName,
|
||||||
Triple::OSType OS,
|
Triple::OSType OS,
|
||||||
const char *ProgName) {
|
const char *ProgName) {
|
||||||
// If we don't yet have an output filename, make one.
|
// If we don't yet have an output filename, make one.
|
||||||
if (OutputFilename.empty()) {
|
if (OutputFilename.empty()) {
|
||||||
if (InputFilename == "-")
|
if (InputFilename == "-")
|
||||||
@ -183,11 +183,7 @@ static formatted_tool_output_file *GetOutputStream(const char *TargetName,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
formatted_tool_output_file *Out =
|
return FDOut;
|
||||||
new formatted_tool_output_file(*FDOut,
|
|
||||||
formatted_raw_ostream::DELETE_STREAM);
|
|
||||||
|
|
||||||
return Out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// main - Entry point for the llc compiler.
|
// main - Entry point for the llc compiler.
|
||||||
@ -278,7 +274,7 @@ int main(int argc, char **argv) {
|
|||||||
TargetMachine &Target = *target.get();
|
TargetMachine &Target = *target.get();
|
||||||
|
|
||||||
// Figure out where we are going to send the output...
|
// Figure out where we are going to send the output...
|
||||||
OwningPtr<formatted_tool_output_file> Out
|
OwningPtr<tool_output_file> Out
|
||||||
(GetOutputStream(TheTarget->getName(), TheTriple.getOS(), argv[0]));
|
(GetOutputStream(TheTarget->getName(), TheTriple.getOS(), argv[0]));
|
||||||
if (!Out) return 1;
|
if (!Out) return 1;
|
||||||
|
|
||||||
@ -314,15 +310,18 @@ int main(int argc, char **argv) {
|
|||||||
Target.setMCRelaxAll(true);
|
Target.setMCRelaxAll(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ask the target to add backend passes as necessary.
|
{
|
||||||
if (Target.addPassesToEmitFile(PM, *Out, FileType, OLvl,
|
formatted_raw_ostream FOS(Out->os());
|
||||||
NoVerify)) {
|
|
||||||
errs() << argv[0] << ": target does not support generation of this"
|
|
||||||
<< " file type!\n";
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
PM.run(mod);
|
// Ask the target to add backend passes as necessary.
|
||||||
|
if (Target.addPassesToEmitFile(PM, FOS, FileType, OLvl, NoVerify)) {
|
||||||
|
errs() << argv[0] << ": target does not support generation of this"
|
||||||
|
<< " file type!\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
PM.run(mod);
|
||||||
|
}
|
||||||
|
|
||||||
// Declare success.
|
// Declare success.
|
||||||
Out->keep();
|
Out->keep();
|
||||||
|
@ -77,8 +77,8 @@ static void WriteOutputFile(const Module *M) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Force || !CheckBitcodeOutputToConsole(*Out, true))
|
if (Force || !CheckBitcodeOutputToConsole(Out->os(), true))
|
||||||
WriteBitcodeToFile(M, *Out);
|
WriteBitcodeToFile(M, Out->os());
|
||||||
|
|
||||||
// Declare success.
|
// Declare success.
|
||||||
Out->keep();
|
Out->keep();
|
||||||
|
@ -98,7 +98,7 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
// All that llvm-dis does is write the assembly to a file.
|
// All that llvm-dis does is write the assembly to a file.
|
||||||
if (!DontPrint)
|
if (!DontPrint)
|
||||||
*Out << *M;
|
Out->os() << *M;
|
||||||
|
|
||||||
// Declare success.
|
// Declare success.
|
||||||
Out->keep();
|
Out->keep();
|
||||||
|
@ -134,9 +134,9 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (OutputAssembly)
|
if (OutputAssembly)
|
||||||
Passes.add(createPrintModulePass(&Out));
|
Passes.add(createPrintModulePass(&Out.os()));
|
||||||
else if (Force || !CheckBitcodeOutputToConsole(Out, true))
|
else if (Force || !CheckBitcodeOutputToConsole(Out.os(), true))
|
||||||
Passes.add(createBitcodeWriterPass(Out));
|
Passes.add(createBitcodeWriterPass(Out.os()));
|
||||||
|
|
||||||
Passes.run(*M.get());
|
Passes.run(*M.get());
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ void GenerateBitcode(Module* M, const std::string& FileName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Write it out
|
// Write it out
|
||||||
WriteBitcodeToFile(M, Out);
|
WriteBitcodeToFile(M, Out.os());
|
||||||
Out.keep();
|
Out.keep();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,10 +432,10 @@ static void EmitShellScript(char **argv, Module *M) {
|
|||||||
if (!ErrorInfo.empty())
|
if (!ErrorInfo.empty())
|
||||||
PrintAndExit(ErrorInfo, M);
|
PrintAndExit(ErrorInfo, M);
|
||||||
|
|
||||||
Out2 << "#!/bin/sh\n";
|
Out2.os() << "#!/bin/sh\n";
|
||||||
// Allow user to setenv LLVMINTERP if lli is not in their PATH.
|
// Allow user to setenv LLVMINTERP if lli is not in their PATH.
|
||||||
Out2 << "lli=${LLVMINTERP-lli}\n";
|
Out2.os() << "lli=${LLVMINTERP-lli}\n";
|
||||||
Out2 << "exec $lli \\\n";
|
Out2.os() << "exec $lli \\\n";
|
||||||
// gcc accepts -l<lib> and implicitly searches /lib and /usr/lib.
|
// gcc accepts -l<lib> and implicitly searches /lib and /usr/lib.
|
||||||
LibPaths.push_back("/lib");
|
LibPaths.push_back("/lib");
|
||||||
LibPaths.push_back("/usr/lib");
|
LibPaths.push_back("/usr/lib");
|
||||||
@ -466,9 +466,9 @@ static void EmitShellScript(char **argv, Module *M) {
|
|||||||
if (FullLibraryPath.isEmpty())
|
if (FullLibraryPath.isEmpty())
|
||||||
FullLibraryPath = sys::Path::FindLibrary(*i);
|
FullLibraryPath = sys::Path::FindLibrary(*i);
|
||||||
if (!FullLibraryPath.isEmpty())
|
if (!FullLibraryPath.isEmpty())
|
||||||
Out2 << " -load=" << FullLibraryPath.str() << " \\\n";
|
Out2.os() << " -load=" << FullLibraryPath.str() << " \\\n";
|
||||||
}
|
}
|
||||||
Out2 << " " << BitcodeOutputFilename << " ${1+\"$@\"}\n";
|
Out2.os() << " " << BitcodeOutputFilename << " ${1+\"$@\"}\n";
|
||||||
Out2.keep();
|
Out2.keep();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,9 +130,9 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
if (Verbose) errs() << "Writing bitcode...\n";
|
if (Verbose) errs() << "Writing bitcode...\n";
|
||||||
if (OutputAssembly) {
|
if (OutputAssembly) {
|
||||||
Out << *Composite;
|
Out.os() << *Composite;
|
||||||
} else if (Force || !CheckBitcodeOutputToConsole(Out, true))
|
} else if (Force || !CheckBitcodeOutputToConsole(Out.os(), true))
|
||||||
WriteBitcodeToFile(Composite.get(), Out);
|
WriteBitcodeToFile(Composite.get(), Out.os());
|
||||||
|
|
||||||
// Declare success.
|
// Declare success.
|
||||||
Out.keep();
|
Out.keep();
|
||||||
|
@ -140,7 +140,7 @@ static const Target *GetTarget(const char *ProgName) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static formatted_tool_output_file *GetOutputStream() {
|
static tool_output_file *GetOutputStream() {
|
||||||
if (OutputFilename == "")
|
if (OutputFilename == "")
|
||||||
OutputFilename = "-";
|
OutputFilename = "-";
|
||||||
|
|
||||||
@ -152,9 +152,8 @@ static formatted_tool_output_file *GetOutputStream() {
|
|||||||
delete Out;
|
delete Out;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new formatted_tool_output_file(*Out,
|
return Out;
|
||||||
formatted_raw_ostream::DELETE_STREAM);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int AsLexInput(const char *ProgName) {
|
static int AsLexInput(const char *ProgName) {
|
||||||
@ -189,7 +188,7 @@ static int AsLexInput(const char *ProgName) {
|
|||||||
AsmLexer Lexer(*MAI);
|
AsmLexer Lexer(*MAI);
|
||||||
Lexer.setBuffer(SrcMgr.getMemoryBuffer(0));
|
Lexer.setBuffer(SrcMgr.getMemoryBuffer(0));
|
||||||
|
|
||||||
OwningPtr<formatted_tool_output_file> Out(GetOutputStream());
|
OwningPtr<tool_output_file> Out(GetOutputStream());
|
||||||
if (!Out)
|
if (!Out)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -204,44 +203,44 @@ static int AsLexInput(const char *ProgName) {
|
|||||||
Error = true; // error already printed.
|
Error = true; // error already printed.
|
||||||
break;
|
break;
|
||||||
case AsmToken::Identifier:
|
case AsmToken::Identifier:
|
||||||
*Out << "identifier: " << Lexer.getTok().getString() << '\n';
|
Out->os() << "identifier: " << Lexer.getTok().getString() << '\n';
|
||||||
break;
|
break;
|
||||||
case AsmToken::String:
|
case AsmToken::String:
|
||||||
*Out << "string: " << Lexer.getTok().getString() << '\n';
|
Out->os() << "string: " << Lexer.getTok().getString() << '\n';
|
||||||
break;
|
break;
|
||||||
case AsmToken::Integer:
|
case AsmToken::Integer:
|
||||||
*Out << "int: " << Lexer.getTok().getString() << '\n';
|
Out->os() << "int: " << Lexer.getTok().getString() << '\n';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AsmToken::Amp: *Out << "Amp\n"; break;
|
case AsmToken::Amp: Out->os() << "Amp\n"; break;
|
||||||
case AsmToken::AmpAmp: *Out << "AmpAmp\n"; break;
|
case AsmToken::AmpAmp: Out->os() << "AmpAmp\n"; break;
|
||||||
case AsmToken::Caret: *Out << "Caret\n"; break;
|
case AsmToken::Caret: Out->os() << "Caret\n"; break;
|
||||||
case AsmToken::Colon: *Out << "Colon\n"; break;
|
case AsmToken::Colon: Out->os() << "Colon\n"; break;
|
||||||
case AsmToken::Comma: *Out << "Comma\n"; break;
|
case AsmToken::Comma: Out->os() << "Comma\n"; break;
|
||||||
case AsmToken::Dollar: *Out << "Dollar\n"; break;
|
case AsmToken::Dollar: Out->os() << "Dollar\n"; break;
|
||||||
case AsmToken::EndOfStatement: *Out << "EndOfStatement\n"; break;
|
case AsmToken::EndOfStatement: Out->os() << "EndOfStatement\n"; break;
|
||||||
case AsmToken::Eof: *Out << "Eof\n"; break;
|
case AsmToken::Eof: Out->os() << "Eof\n"; break;
|
||||||
case AsmToken::Equal: *Out << "Equal\n"; break;
|
case AsmToken::Equal: Out->os() << "Equal\n"; break;
|
||||||
case AsmToken::EqualEqual: *Out << "EqualEqual\n"; break;
|
case AsmToken::EqualEqual: Out->os() << "EqualEqual\n"; break;
|
||||||
case AsmToken::Exclaim: *Out << "Exclaim\n"; break;
|
case AsmToken::Exclaim: Out->os() << "Exclaim\n"; break;
|
||||||
case AsmToken::ExclaimEqual: *Out << "ExclaimEqual\n"; break;
|
case AsmToken::ExclaimEqual: Out->os() << "ExclaimEqual\n"; break;
|
||||||
case AsmToken::Greater: *Out << "Greater\n"; break;
|
case AsmToken::Greater: Out->os() << "Greater\n"; break;
|
||||||
case AsmToken::GreaterEqual: *Out << "GreaterEqual\n"; break;
|
case AsmToken::GreaterEqual: Out->os() << "GreaterEqual\n"; break;
|
||||||
case AsmToken::GreaterGreater: *Out << "GreaterGreater\n"; break;
|
case AsmToken::GreaterGreater: Out->os() << "GreaterGreater\n"; break;
|
||||||
case AsmToken::LParen: *Out << "LParen\n"; break;
|
case AsmToken::LParen: Out->os() << "LParen\n"; break;
|
||||||
case AsmToken::Less: *Out << "Less\n"; break;
|
case AsmToken::Less: Out->os() << "Less\n"; break;
|
||||||
case AsmToken::LessEqual: *Out << "LessEqual\n"; break;
|
case AsmToken::LessEqual: Out->os() << "LessEqual\n"; break;
|
||||||
case AsmToken::LessGreater: *Out << "LessGreater\n"; break;
|
case AsmToken::LessGreater: Out->os() << "LessGreater\n"; break;
|
||||||
case AsmToken::LessLess: *Out << "LessLess\n"; break;
|
case AsmToken::LessLess: Out->os() << "LessLess\n"; break;
|
||||||
case AsmToken::Minus: *Out << "Minus\n"; break;
|
case AsmToken::Minus: Out->os() << "Minus\n"; break;
|
||||||
case AsmToken::Percent: *Out << "Percent\n"; break;
|
case AsmToken::Percent: Out->os() << "Percent\n"; break;
|
||||||
case AsmToken::Pipe: *Out << "Pipe\n"; break;
|
case AsmToken::Pipe: Out->os() << "Pipe\n"; break;
|
||||||
case AsmToken::PipePipe: *Out << "PipePipe\n"; break;
|
case AsmToken::PipePipe: Out->os() << "PipePipe\n"; break;
|
||||||
case AsmToken::Plus: *Out << "Plus\n"; break;
|
case AsmToken::Plus: Out->os() << "Plus\n"; break;
|
||||||
case AsmToken::RParen: *Out << "RParen\n"; break;
|
case AsmToken::RParen: Out->os() << "RParen\n"; break;
|
||||||
case AsmToken::Slash: *Out << "Slash\n"; break;
|
case AsmToken::Slash: Out->os() << "Slash\n"; break;
|
||||||
case AsmToken::Star: *Out << "Star\n"; break;
|
case AsmToken::Star: Out->os() << "Star\n"; break;
|
||||||
case AsmToken::Tilde: *Out << "Tilde\n"; break;
|
case AsmToken::Tilde: Out->os() << "Tilde\n"; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,10 +290,11 @@ static int AssembleInput(const char *ProgName) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
OwningPtr<formatted_tool_output_file> Out(GetOutputStream());
|
OwningPtr<tool_output_file> Out(GetOutputStream());
|
||||||
if (!Out)
|
if (!Out)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
formatted_raw_ostream FOS(Out->os());
|
||||||
OwningPtr<MCStreamer> Str;
|
OwningPtr<MCStreamer> Str;
|
||||||
|
|
||||||
if (FileType == OFT_AssemblyFile) {
|
if (FileType == OFT_AssemblyFile) {
|
||||||
@ -303,7 +303,7 @@ static int AssembleInput(const char *ProgName) {
|
|||||||
MCCodeEmitter *CE = 0;
|
MCCodeEmitter *CE = 0;
|
||||||
if (ShowEncoding)
|
if (ShowEncoding)
|
||||||
CE = TheTarget->createCodeEmitter(*TM, Ctx);
|
CE = TheTarget->createCodeEmitter(*TM, Ctx);
|
||||||
Str.reset(createAsmStreamer(Ctx, *Out,
|
Str.reset(createAsmStreamer(Ctx, FOS,
|
||||||
TM->getTargetData()->isLittleEndian(),
|
TM->getTargetData()->isLittleEndian(),
|
||||||
/*asmverbose*/true, IP, CE, ShowInst));
|
/*asmverbose*/true, IP, CE, ShowInst));
|
||||||
} else if (FileType == OFT_Null) {
|
} else if (FileType == OFT_Null) {
|
||||||
@ -313,7 +313,7 @@ static int AssembleInput(const char *ProgName) {
|
|||||||
MCCodeEmitter *CE = TheTarget->createCodeEmitter(*TM, Ctx);
|
MCCodeEmitter *CE = TheTarget->createCodeEmitter(*TM, Ctx);
|
||||||
TargetAsmBackend *TAB = TheTarget->createAsmBackend(TripleName);
|
TargetAsmBackend *TAB = TheTarget->createAsmBackend(TripleName);
|
||||||
Str.reset(TheTarget->createObjectStreamer(TripleName, Ctx, *TAB,
|
Str.reset(TheTarget->createObjectStreamer(TripleName, Ctx, *TAB,
|
||||||
*Out, CE, RelaxAll));
|
FOS, CE, RelaxAll));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EnableLogging) {
|
if (EnableLogging) {
|
||||||
@ -359,15 +359,15 @@ static int DisassembleInput(const char *ProgName, bool Enhanced) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
OwningPtr<formatted_tool_output_file> Out(GetOutputStream());
|
OwningPtr<tool_output_file> Out(GetOutputStream());
|
||||||
if (!Out)
|
if (!Out)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
int Res;
|
int Res;
|
||||||
if (Enhanced)
|
if (Enhanced)
|
||||||
Res = Disassembler::disassembleEnhanced(TripleName, *Buffer, *Out);
|
Res = Disassembler::disassembleEnhanced(TripleName, *Buffer, Out->os());
|
||||||
else
|
else
|
||||||
Res = Disassembler::disassemble(*TheTarget, TripleName, *Buffer, *Out);
|
Res = Disassembler::disassemble(*TheTarget, TripleName, *Buffer, Out->os());
|
||||||
|
|
||||||
// Keep output if no errors.
|
// Keep output if no errors.
|
||||||
if (Res == 0) Out->keep();
|
if (Res == 0) Out->keep();
|
||||||
|
@ -164,13 +164,13 @@ bool LTOCodeGenerator::writeMergedModules(const char *path,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// write bitcode to it
|
// write bitcode to it
|
||||||
WriteBitcodeToFile(_linker.getModule(), Out);
|
WriteBitcodeToFile(_linker.getModule(), Out.os());
|
||||||
Out.close();
|
Out.os().close();
|
||||||
|
|
||||||
if (Out.has_error()) {
|
if (Out.os().has_error()) {
|
||||||
errMsg = "could not write bitcode file: ";
|
errMsg = "could not write bitcode file: ";
|
||||||
errMsg += path;
|
errMsg += path;
|
||||||
Out.clear_error();
|
Out.os().clear_error();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,14 +190,13 @@ const void* LTOCodeGenerator::compile(size_t* length, std::string& errMsg)
|
|||||||
// generate assembly code
|
// generate assembly code
|
||||||
bool genResult = false;
|
bool genResult = false;
|
||||||
{
|
{
|
||||||
tool_output_file asmFD(uniqueAsmPath.c_str(), errMsg);
|
tool_output_file asmFile(uniqueAsmPath.c_str(), errMsg);
|
||||||
formatted_tool_output_file asmFile(asmFD);
|
|
||||||
if (!errMsg.empty())
|
if (!errMsg.empty())
|
||||||
return NULL;
|
return NULL;
|
||||||
genResult = this->generateAssemblyCode(asmFile, errMsg);
|
genResult = this->generateAssemblyCode(asmFile.os(), errMsg);
|
||||||
asmFile.close();
|
asmFile.os().close();
|
||||||
if (asmFile.has_error()) {
|
if (asmFile.os().has_error()) {
|
||||||
asmFile.clear_error();
|
asmFile.os().clear_error();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
asmFile.keep();
|
asmFile.keep();
|
||||||
@ -368,7 +367,7 @@ void LTOCodeGenerator::applyScopeRestrictions() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Optimize merged modules using various IPO passes
|
/// Optimize merged modules using various IPO passes
|
||||||
bool LTOCodeGenerator::generateAssemblyCode(formatted_raw_ostream& out,
|
bool LTOCodeGenerator::generateAssemblyCode(raw_ostream& out,
|
||||||
std::string& errMsg)
|
std::string& errMsg)
|
||||||
{
|
{
|
||||||
if ( this->determineTarget(errMsg) )
|
if ( this->determineTarget(errMsg) )
|
||||||
@ -403,7 +402,9 @@ bool LTOCodeGenerator::generateAssemblyCode(formatted_raw_ostream& out,
|
|||||||
|
|
||||||
codeGenPasses->add(new TargetData(*_target->getTargetData()));
|
codeGenPasses->add(new TargetData(*_target->getTargetData()));
|
||||||
|
|
||||||
if (_target->addPassesToEmitFile(*codeGenPasses, out,
|
formatted_raw_ostream Out(out);
|
||||||
|
|
||||||
|
if (_target->addPassesToEmitFile(*codeGenPasses, Out,
|
||||||
TargetMachine::CGFT_AssemblyFile,
|
TargetMachine::CGFT_AssemblyFile,
|
||||||
CodeGenOpt::Aggressive)) {
|
CodeGenOpt::Aggressive)) {
|
||||||
errMsg = "target file type not supported";
|
errMsg = "target file type not supported";
|
||||||
|
@ -45,7 +45,7 @@ struct LTOCodeGenerator {
|
|||||||
const void* compile(size_t* length, std::string& errMsg);
|
const void* compile(size_t* length, std::string& errMsg);
|
||||||
void setCodeGenDebugOptions(const char *opts);
|
void setCodeGenDebugOptions(const char *opts);
|
||||||
private:
|
private:
|
||||||
bool generateAssemblyCode(llvm::formatted_raw_ostream& out,
|
bool generateAssemblyCode(llvm::raw_ostream& out,
|
||||||
std::string& errMsg);
|
std::string& errMsg);
|
||||||
bool assemble(const std::string& asmPath,
|
bool assemble(const std::string& asmPath,
|
||||||
const std::string& objPath, std::string& errMsg);
|
const std::string& objPath, std::string& errMsg);
|
||||||
|
@ -31,16 +31,16 @@ static void WriteGraphToFile(raw_ostream &O, const std::string &GraphName,
|
|||||||
tool_output_file F(Filename.c_str(), ErrInfo);
|
tool_output_file F(Filename.c_str(), ErrInfo);
|
||||||
|
|
||||||
if (ErrInfo.empty()) {
|
if (ErrInfo.empty()) {
|
||||||
WriteGraph(F, GT);
|
WriteGraph(F.os(), GT);
|
||||||
F.close();
|
F.os().close();
|
||||||
if (!F.has_error()) {
|
if (!F.os().has_error()) {
|
||||||
O << "\n";
|
O << "\n";
|
||||||
F.keep();
|
F.keep();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
F.clear_error();
|
|
||||||
O << " error opening file for writing!\n";
|
O << " error opening file for writing!\n";
|
||||||
|
F.os().clear_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -359,6 +359,11 @@ void AddStandardLinkPasses(PassManagerBase &PM) {
|
|||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
sys::PrintStackTraceOnErrorSignal();
|
sys::PrintStackTraceOnErrorSignal();
|
||||||
llvm::PrettyStackTraceProgram X(argc, argv);
|
llvm::PrettyStackTraceProgram X(argc, argv);
|
||||||
|
|
||||||
|
if (AnalyzeOnly && NoOutput) {
|
||||||
|
errs() << argv[0] << ": analyze mode conflicts with no-output mode.\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// Enable debug stream buffering.
|
// Enable debug stream buffering.
|
||||||
EnableDebugBuffering = true;
|
EnableDebugBuffering = true;
|
||||||
@ -408,7 +413,7 @@ int main(int argc, char **argv) {
|
|||||||
// console, print out a warning message and refuse to do it. We don't
|
// console, print out a warning message and refuse to do it. We don't
|
||||||
// impress anyone by spewing tons of binary goo to a terminal.
|
// impress anyone by spewing tons of binary goo to a terminal.
|
||||||
if (!Force && !NoOutput && !AnalyzeOnly && !OutputAssembly)
|
if (!Force && !NoOutput && !AnalyzeOnly && !OutputAssembly)
|
||||||
if (CheckBitcodeOutputToConsole(*Out, !Quiet))
|
if (CheckBitcodeOutputToConsole(Out->os(), !Quiet))
|
||||||
NoOutput = true;
|
NoOutput = true;
|
||||||
|
|
||||||
// Create a PassManager to hold and optimize the collection of passes we are
|
// Create a PassManager to hold and optimize the collection of passes we are
|
||||||
@ -484,19 +489,19 @@ int main(int argc, char **argv) {
|
|||||||
if (AnalyzeOnly) {
|
if (AnalyzeOnly) {
|
||||||
switch (Kind) {
|
switch (Kind) {
|
||||||
case PT_BasicBlock:
|
case PT_BasicBlock:
|
||||||
Passes.add(new BasicBlockPassPrinter(PassInf, *Out));
|
Passes.add(new BasicBlockPassPrinter(PassInf, Out->os()));
|
||||||
break;
|
break;
|
||||||
case PT_Loop:
|
case PT_Loop:
|
||||||
Passes.add(new LoopPassPrinter(PassInf, *Out));
|
Passes.add(new LoopPassPrinter(PassInf, Out->os()));
|
||||||
break;
|
break;
|
||||||
case PT_Function:
|
case PT_Function:
|
||||||
Passes.add(new FunctionPassPrinter(PassInf, *Out));
|
Passes.add(new FunctionPassPrinter(PassInf, Out->os()));
|
||||||
break;
|
break;
|
||||||
case PT_CallGraphSCC:
|
case PT_CallGraphSCC:
|
||||||
Passes.add(new CallGraphSCCPassPrinter(PassInf, *Out));
|
Passes.add(new CallGraphSCCPassPrinter(PassInf, Out->os()));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Passes.add(new ModulePassPrinter(PassInf, *Out));
|
Passes.add(new ModulePassPrinter(PassInf, Out->os()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -536,9 +541,9 @@ int main(int argc, char **argv) {
|
|||||||
// Write bitcode or assembly to the output as the last step...
|
// Write bitcode or assembly to the output as the last step...
|
||||||
if (!NoOutput && !AnalyzeOnly) {
|
if (!NoOutput && !AnalyzeOnly) {
|
||||||
if (OutputAssembly)
|
if (OutputAssembly)
|
||||||
Passes.add(createPrintModulePass(Out.get()));
|
Passes.add(createPrintModulePass(&Out->os()));
|
||||||
else
|
else
|
||||||
Passes.add(createBitcodeWriterPass(*Out));
|
Passes.add(createBitcodeWriterPass(Out->os()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now that we have all of the passes ready, run them.
|
// Now that we have all of the passes ready, run them.
|
||||||
|
@ -78,7 +78,7 @@ int main(int argc, char **argv) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
OutStream.write(In->getBufferStart(), In->getBufferSize());
|
OutStream.os().write(In->getBufferStart(), In->getBufferSize());
|
||||||
|
|
||||||
// Declare success.
|
// Declare success.
|
||||||
OutStream.keep();
|
OutStream.keep();
|
||||||
|
@ -226,109 +226,109 @@ int main(int argc, char **argv) {
|
|||||||
try {
|
try {
|
||||||
switch (Action) {
|
switch (Action) {
|
||||||
case PrintRecords:
|
case PrintRecords:
|
||||||
Out << Records; // No argument, dump all contents
|
Out.os() << Records; // No argument, dump all contents
|
||||||
break;
|
break;
|
||||||
case GenEmitter:
|
case GenEmitter:
|
||||||
CodeEmitterGen(Records).run(Out);
|
CodeEmitterGen(Records).run(Out.os());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GenRegisterEnums:
|
case GenRegisterEnums:
|
||||||
RegisterInfoEmitter(Records).runEnums(Out);
|
RegisterInfoEmitter(Records).runEnums(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenRegister:
|
case GenRegister:
|
||||||
RegisterInfoEmitter(Records).run(Out);
|
RegisterInfoEmitter(Records).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenRegisterHeader:
|
case GenRegisterHeader:
|
||||||
RegisterInfoEmitter(Records).runHeader(Out);
|
RegisterInfoEmitter(Records).runHeader(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenInstrEnums:
|
case GenInstrEnums:
|
||||||
InstrEnumEmitter(Records).run(Out);
|
InstrEnumEmitter(Records).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenInstrs:
|
case GenInstrs:
|
||||||
InstrInfoEmitter(Records).run(Out);
|
InstrInfoEmitter(Records).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenCallingConv:
|
case GenCallingConv:
|
||||||
CallingConvEmitter(Records).run(Out);
|
CallingConvEmitter(Records).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenAsmWriter:
|
case GenAsmWriter:
|
||||||
AsmWriterEmitter(Records).run(Out);
|
AsmWriterEmitter(Records).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenARMDecoder:
|
case GenARMDecoder:
|
||||||
ARMDecoderEmitter(Records).run(Out);
|
ARMDecoderEmitter(Records).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenAsmMatcher:
|
case GenAsmMatcher:
|
||||||
AsmMatcherEmitter(Records).run(Out);
|
AsmMatcherEmitter(Records).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenClangAttrClasses:
|
case GenClangAttrClasses:
|
||||||
ClangAttrClassEmitter(Records).run(Out);
|
ClangAttrClassEmitter(Records).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenClangAttrImpl:
|
case GenClangAttrImpl:
|
||||||
ClangAttrImplEmitter(Records).run(Out);
|
ClangAttrImplEmitter(Records).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenClangAttrList:
|
case GenClangAttrList:
|
||||||
ClangAttrListEmitter(Records).run(Out);
|
ClangAttrListEmitter(Records).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenClangAttrPCHRead:
|
case GenClangAttrPCHRead:
|
||||||
ClangAttrPCHReadEmitter(Records).run(Out);
|
ClangAttrPCHReadEmitter(Records).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenClangAttrPCHWrite:
|
case GenClangAttrPCHWrite:
|
||||||
ClangAttrPCHWriteEmitter(Records).run(Out);
|
ClangAttrPCHWriteEmitter(Records).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenClangDiagsDefs:
|
case GenClangDiagsDefs:
|
||||||
ClangDiagsDefsEmitter(Records, ClangComponent).run(Out);
|
ClangDiagsDefsEmitter(Records, ClangComponent).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenClangDiagGroups:
|
case GenClangDiagGroups:
|
||||||
ClangDiagGroupsEmitter(Records).run(Out);
|
ClangDiagGroupsEmitter(Records).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenClangDeclNodes:
|
case GenClangDeclNodes:
|
||||||
ClangASTNodesEmitter(Records, "Decl", "Decl").run(Out);
|
ClangASTNodesEmitter(Records, "Decl", "Decl").run(Out.os());
|
||||||
ClangDeclContextEmitter(Records).run(Out);
|
ClangDeclContextEmitter(Records).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenClangStmtNodes:
|
case GenClangStmtNodes:
|
||||||
ClangASTNodesEmitter(Records, "Stmt", "").run(Out);
|
ClangASTNodesEmitter(Records, "Stmt", "").run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenDisassembler:
|
case GenDisassembler:
|
||||||
DisassemblerEmitter(Records).run(Out);
|
DisassemblerEmitter(Records).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenOptParserDefs:
|
case GenOptParserDefs:
|
||||||
OptParserEmitter(Records, true).run(Out);
|
OptParserEmitter(Records, true).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenOptParserImpl:
|
case GenOptParserImpl:
|
||||||
OptParserEmitter(Records, false).run(Out);
|
OptParserEmitter(Records, false).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenDAGISel:
|
case GenDAGISel:
|
||||||
DAGISelEmitter(Records).run(Out);
|
DAGISelEmitter(Records).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenFastISel:
|
case GenFastISel:
|
||||||
FastISelEmitter(Records).run(Out);
|
FastISelEmitter(Records).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenSubtarget:
|
case GenSubtarget:
|
||||||
SubtargetEmitter(Records).run(Out);
|
SubtargetEmitter(Records).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenIntrinsic:
|
case GenIntrinsic:
|
||||||
IntrinsicEmitter(Records).run(Out);
|
IntrinsicEmitter(Records).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenTgtIntrinsic:
|
case GenTgtIntrinsic:
|
||||||
IntrinsicEmitter(Records, true).run(Out);
|
IntrinsicEmitter(Records, true).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenLLVMCConf:
|
case GenLLVMCConf:
|
||||||
LLVMCConfigurationEmitter(Records).run(Out);
|
LLVMCConfigurationEmitter(Records).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenEDInfo:
|
case GenEDInfo:
|
||||||
EDEmitter(Records).run(Out);
|
EDEmitter(Records).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenArmNeon:
|
case GenArmNeon:
|
||||||
NeonEmitter(Records).run(Out);
|
NeonEmitter(Records).run(Out.os());
|
||||||
break;
|
break;
|
||||||
case GenArmNeonSema:
|
case GenArmNeonSema:
|
||||||
NeonEmitter(Records).runHeader(Out);
|
NeonEmitter(Records).runHeader(Out.os());
|
||||||
break;
|
break;
|
||||||
case PrintEnums:
|
case PrintEnums:
|
||||||
{
|
{
|
||||||
std::vector<Record*> Recs = Records.getAllDerivedDefinitions(Class);
|
std::vector<Record*> Recs = Records.getAllDerivedDefinitions(Class);
|
||||||
for (unsigned i = 0, e = Recs.size(); i != e; ++i)
|
for (unsigned i = 0, e = Recs.size(); i != e; ++i)
|
||||||
Out << Recs[i]->getName() << ", ";
|
Out.os() << Recs[i]->getName() << ", ";
|
||||||
Out << "\n";
|
Out.os() << "\n";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user