1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

Don't use PathV1.h in ToolRunner.h.

llvm-svn: 184107
This commit is contained in:
Rafael Espindola 2013-06-17 19:21:38 +00:00
parent dc36acbad8
commit fcae6ace8a
7 changed files with 18 additions and 13 deletions

View File

@ -22,6 +22,7 @@
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileUtilities.h" #include "llvm/Support/FileUtilities.h"
#include "llvm/Support/Host.h" #include "llvm/Support/Host.h"
#include "llvm/Support/PathV1.h"
#include "llvm/Support/SourceMgr.h" #include "llvm/Support/SourceMgr.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
#include <memory> #include <memory>

View File

@ -26,6 +26,7 @@
#include "llvm/Support/CFG.h" #include "llvm/Support/CFG.h"
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileUtilities.h" #include "llvm/Support/FileUtilities.h"
#include "llvm/Support/PathV1.h"
#include "llvm/Transforms/Scalar.h" #include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Utils/Cloning.h" #include "llvm/Transforms/Utils/Cloning.h"
#include <set> #include <set>

View File

@ -17,6 +17,7 @@
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h" #include "llvm/Support/Debug.h"
#include "llvm/Support/FileUtilities.h" #include "llvm/Support/FileUtilities.h"
#include "llvm/Support/PathV1.h"
#include "llvm/Support/SystemUtils.h" #include "llvm/Support/SystemUtils.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
#include <fstream> #include <fstream>
@ -380,7 +381,7 @@ std::string BugDriver::executeProgramSafely(const Module *Program,
std::string BugDriver::compileSharedObject(const std::string &BitcodeFile, std::string BugDriver::compileSharedObject(const std::string &BitcodeFile,
std::string &Error) { std::string &Error) {
assert(Interpreter && "Interpreter should have been created already!"); assert(Interpreter && "Interpreter should have been created already!");
sys::Path OutputFile; std::string OutputFile;
// Using the known-good backend. // Using the known-good backend.
GCC::FileType FT = SafeInterpreter->OutputCode(BitcodeFile, OutputFile, GCC::FileType FT = SafeInterpreter->OutputCode(BitcodeFile, OutputFile,
@ -389,7 +390,7 @@ std::string BugDriver::compileSharedObject(const std::string &BitcodeFile,
return ""; return "";
std::string SharedObjectFile; std::string SharedObjectFile;
bool Failure = gcc->MakeSharedObject(OutputFile.str(), FT, SharedObjectFile, bool Failure = gcc->MakeSharedObject(OutputFile, FT, SharedObjectFile,
AdditionalLinkerArgs, Error); AdditionalLinkerArgs, Error);
if (!Error.empty()) if (!Error.empty())
return ""; return "";
@ -397,7 +398,7 @@ std::string BugDriver::compileSharedObject(const std::string &BitcodeFile,
exit(1); exit(1);
// Remove the intermediate C file // Remove the intermediate C file
OutputFile.eraseFromDisk(); sys::fs::remove(OutputFile);
return "./" + SharedObjectFile; return "./" + SharedObjectFile;
} }

View File

@ -17,6 +17,7 @@
#include "BugDriver.h" #include "BugDriver.h"
#include "ToolRunner.h" #include "ToolRunner.h"
#include "llvm/Pass.h" #include "llvm/Pass.h"
#include "llvm/Support/PathV1.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
#include <algorithm> #include <algorithm>
#include <ctime> #include <ctime>

View File

@ -25,6 +25,7 @@
#include "llvm/Pass.h" #include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileUtilities.h" #include "llvm/Support/FileUtilities.h"
#include "llvm/Support/PathV1.h"
#include "llvm/Transforms/Utils/Cloning.h" #include "llvm/Transforms/Utils/Cloning.h"
using namespace llvm; using namespace llvm;

View File

@ -17,6 +17,7 @@
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h" #include "llvm/Support/Debug.h"
#include "llvm/Support/FileUtilities.h" #include "llvm/Support/FileUtilities.h"
#include "llvm/Support/PathV1.h"
#include "llvm/Support/Program.h" #include "llvm/Support/Program.h"
#include "llvm/Support/raw_ostream.h" #include "llvm/Support/raw_ostream.h"
#include <fstream> #include <fstream>
@ -460,7 +461,7 @@ AbstractInterpreter *AbstractInterpreter::createCustomExecutor(
// LLC Implementation of AbstractIntepreter interface // LLC Implementation of AbstractIntepreter interface
// //
GCC::FileType LLC::OutputCode(const std::string &Bitcode, GCC::FileType LLC::OutputCode(const std::string &Bitcode,
sys::Path &OutputAsmFile, std::string &Error, std::string &OutputAsmFile, std::string &Error,
unsigned Timeout, unsigned MemoryLimit) { unsigned Timeout, unsigned MemoryLimit) {
const char *Suffix = (UseIntegratedAssembler ? ".llc.o" : ".llc.s"); const char *Suffix = (UseIntegratedAssembler ? ".llc.o" : ".llc.s");
sys::Path uniqueFile(Bitcode + Suffix); sys::Path uniqueFile(Bitcode + Suffix);
@ -469,7 +470,7 @@ GCC::FileType LLC::OutputCode(const std::string &Bitcode,
errs() << "Error making unique filename: " << ErrMsg << "\n"; errs() << "Error making unique filename: " << ErrMsg << "\n";
exit(1); exit(1);
} }
OutputAsmFile = uniqueFile; OutputAsmFile = uniqueFile.str();
std::vector<const char *> LLCArgs; std::vector<const char *> LLCArgs;
LLCArgs.push_back(LLCPath.c_str()); LLCArgs.push_back(LLCPath.c_str());
@ -503,9 +504,9 @@ GCC::FileType LLC::OutputCode(const std::string &Bitcode,
void LLC::compileProgram(const std::string &Bitcode, std::string *Error, void LLC::compileProgram(const std::string &Bitcode, std::string *Error,
unsigned Timeout, unsigned MemoryLimit) { unsigned Timeout, unsigned MemoryLimit) {
sys::Path OutputAsmFile; std::string OutputAsmFile;
OutputCode(Bitcode, OutputAsmFile, *Error, Timeout, MemoryLimit); OutputCode(Bitcode, OutputAsmFile, *Error, Timeout, MemoryLimit);
OutputAsmFile.eraseFromDisk(); sys::fs::remove(OutputAsmFile);
} }
int LLC::ExecuteProgram(const std::string &Bitcode, int LLC::ExecuteProgram(const std::string &Bitcode,
@ -518,16 +519,16 @@ int LLC::ExecuteProgram(const std::string &Bitcode,
unsigned Timeout, unsigned Timeout,
unsigned MemoryLimit) { unsigned MemoryLimit) {
sys::Path OutputAsmFile; std::string OutputAsmFile;
GCC::FileType FileKind = OutputCode(Bitcode, OutputAsmFile, *Error, Timeout, GCC::FileType FileKind = OutputCode(Bitcode, OutputAsmFile, *Error, Timeout,
MemoryLimit); MemoryLimit);
FileRemover OutFileRemover(OutputAsmFile.str(), !SaveTemps); FileRemover OutFileRemover(OutputAsmFile, !SaveTemps);
std::vector<std::string> GCCArgs(ArgsForGCC); std::vector<std::string> GCCArgs(ArgsForGCC);
GCCArgs.insert(GCCArgs.end(), SharedLibs.begin(), SharedLibs.end()); GCCArgs.insert(GCCArgs.end(), SharedLibs.begin(), SharedLibs.end());
// Assuming LLC worked, compile the result with GCC and run it. // Assuming LLC worked, compile the result with GCC and run it.
return gcc->ExecuteProgram(OutputAsmFile.str(), Args, FileKind, return gcc->ExecuteProgram(OutputAsmFile, Args, FileKind,
InputFile, OutputFile, Error, GCCArgs, InputFile, OutputFile, Error, GCCArgs,
Timeout, MemoryLimit); Timeout, MemoryLimit);
} }

View File

@ -21,7 +21,6 @@
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Path.h" #include "llvm/Support/Path.h"
#include "llvm/Support/PathV1.h"
#include "llvm/Support/SystemUtils.h" #include "llvm/Support/SystemUtils.h"
#include <exception> #include <exception>
#include <vector> #include <vector>
@ -122,7 +121,7 @@ public:
/// fails, it sets Error, otherwise, this function returns the type of code /// fails, it sets Error, otherwise, this function returns the type of code
/// emitted. /// emitted.
virtual GCC::FileType OutputCode(const std::string &Bitcode, virtual GCC::FileType OutputCode(const std::string &Bitcode,
sys::Path &OutFile, std::string &Error, std::string &OutFile, std::string &Error,
unsigned Timeout = 0, unsigned Timeout = 0,
unsigned MemoryLimit = 0) { unsigned MemoryLimit = 0) {
Error = "OutputCode not supported by this AbstractInterpreter!"; Error = "OutputCode not supported by this AbstractInterpreter!";
@ -189,7 +188,7 @@ public:
/// fails, it sets Error, otherwise, this function returns the type of code /// fails, it sets Error, otherwise, this function returns the type of code
/// emitted. /// emitted.
virtual GCC::FileType OutputCode(const std::string &Bitcode, virtual GCC::FileType OutputCode(const std::string &Bitcode,
sys::Path &OutFile, std::string &Error, std::string &OutFile, std::string &Error,
unsigned Timeout = 0, unsigned Timeout = 0,
unsigned MemoryLimit = 0); unsigned MemoryLimit = 0);
}; };