mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Reapply r108794, a fix for the failing test from last time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108813 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -56,7 +56,8 @@ void BugDriver::setNewProgram(Module *M) {
|
||||
/// getPassesString - Turn a list of passes into a string which indicates the
|
||||
/// command line options that must be passed to add the passes.
|
||||
///
|
||||
std::string llvm::getPassesString(const std::vector<const PassInfo*> &Passes) {
|
||||
std::string
|
||||
llvm::getPassesString(const std::vector<const StaticPassInfo*> &Passes) {
|
||||
std::string Result;
|
||||
for (unsigned i = 0, e = Passes.size(); i != e; ++i) {
|
||||
if (i) Result += " ";
|
||||
|
@@ -23,7 +23,7 @@
|
||||
namespace llvm {
|
||||
|
||||
class Value;
|
||||
class PassInfo;
|
||||
class StaticPassInfo;
|
||||
class Module;
|
||||
class GlobalVariable;
|
||||
class Function;
|
||||
@@ -47,7 +47,7 @@ class BugDriver {
|
||||
const char *ToolName; // argv[0] of bugpoint
|
||||
std::string ReferenceOutputFile; // Name of `good' output file
|
||||
Module *Program; // The raw program, linked together
|
||||
std::vector<const PassInfo*> PassesToRun;
|
||||
std::vector<const StaticPassInfo*> PassesToRun;
|
||||
AbstractInterpreter *Interpreter; // How to run the program
|
||||
AbstractInterpreter *SafeInterpreter; // To generate reference output, etc.
|
||||
GCC *gcc;
|
||||
@@ -77,10 +77,10 @@ public:
|
||||
bool addSources(const std::vector<std::string> &FileNames);
|
||||
template<class It>
|
||||
void addPasses(It I, It E) { PassesToRun.insert(PassesToRun.end(), I, E); }
|
||||
void setPassesToRun(const std::vector<const PassInfo*> &PTR) {
|
||||
void setPassesToRun(const std::vector<const StaticPassInfo*> &PTR) {
|
||||
PassesToRun = PTR;
|
||||
}
|
||||
const std::vector<const PassInfo*> &getPassesToRun() const {
|
||||
const std::vector<const StaticPassInfo*> &getPassesToRun() const {
|
||||
return PassesToRun;
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
/// ReferenceOutput contains the filename of the file containing the output we
|
||||
/// are to match.
|
||||
///
|
||||
bool debugPassMiscompilation(const PassInfo *ThePass,
|
||||
bool debugPassMiscompilation(const StaticPassInfo *ThePass,
|
||||
const std::string &ReferenceOutput);
|
||||
|
||||
/// compileSharedObject - This method creates a SharedObject from a given
|
||||
@@ -243,7 +243,8 @@ public:
|
||||
/// failure. If AutoDebugCrashes is set to true, then bugpoint will
|
||||
/// automatically attempt to track down a crashing pass if one exists, and
|
||||
/// this method will never return null.
|
||||
Module *runPassesOn(Module *M, const std::vector<const PassInfo*> &Passes,
|
||||
Module *runPassesOn(Module *M,
|
||||
const std::vector<const StaticPassInfo*> &Passes,
|
||||
bool AutoDebugCrashes = false, unsigned NumExtraArgs = 0,
|
||||
const char * const *ExtraArgs = NULL);
|
||||
|
||||
@@ -256,7 +257,7 @@ public:
|
||||
/// or failed, unless Quiet is set. ExtraArgs specifies additional arguments
|
||||
/// to pass to the child bugpoint instance.
|
||||
///
|
||||
bool runPasses(const std::vector<const PassInfo*> &PassesToRun,
|
||||
bool runPasses(const std::vector<const StaticPassInfo*> &PassesToRun,
|
||||
std::string &OutputFilename, bool DeleteOutput = false,
|
||||
bool Quiet = false, unsigned NumExtraArgs = 0,
|
||||
const char * const *ExtraArgs = NULL) const;
|
||||
@@ -268,7 +269,7 @@ public:
|
||||
/// If the passes did not compile correctly, output the command required to
|
||||
/// recreate the failure. This returns true if a compiler error is found.
|
||||
///
|
||||
bool runManyPasses(const std::vector<const PassInfo*> &AllPasses,
|
||||
bool runManyPasses(const std::vector<const StaticPassInfo*> &AllPasses,
|
||||
std::string &ErrMsg);
|
||||
|
||||
/// writeProgramToFile - This writes the current "Program" to the named
|
||||
@@ -281,14 +282,14 @@ private:
|
||||
/// false indicating whether or not the optimizer crashed on the specified
|
||||
/// input (true = crashed).
|
||||
///
|
||||
bool runPasses(const std::vector<const PassInfo*> &PassesToRun,
|
||||
bool runPasses(const std::vector<const StaticPassInfo*> &PassesToRun,
|
||||
bool DeleteOutput = true) const {
|
||||
std::string Filename;
|
||||
return runPasses(PassesToRun, Filename, DeleteOutput);
|
||||
}
|
||||
|
||||
/// runAsChild - The actual "runPasses" guts that runs in a child process.
|
||||
int runPassesAsChild(const std::vector<const PassInfo*> &PassesToRun);
|
||||
int runPassesAsChild(const std::vector<const StaticPassInfo*> &PassesToRun);
|
||||
|
||||
/// initializeExecutionEnvironment - This method is used to set up the
|
||||
/// environment for executing LLVM programs.
|
||||
@@ -306,7 +307,7 @@ Module *ParseInputFile(const std::string &InputFilename,
|
||||
/// getPassesString - Turn a list of passes into a string which indicates the
|
||||
/// command line options that must be passed to add the passes.
|
||||
///
|
||||
std::string getPassesString(const std::vector<const PassInfo*> &Passes);
|
||||
std::string getPassesString(const std::vector<const StaticPassInfo*> &Passes);
|
||||
|
||||
/// PrintFunctionList - prints out list of problematic functions
|
||||
///
|
||||
|
@@ -43,7 +43,7 @@ namespace {
|
||||
}
|
||||
|
||||
namespace llvm {
|
||||
class ReducePassList : public ListReducer<const PassInfo*> {
|
||||
class ReducePassList : public ListReducer<const StaticPassInfo*> {
|
||||
BugDriver &BD;
|
||||
public:
|
||||
ReducePassList(BugDriver &bd) : BD(bd) {}
|
||||
@@ -52,15 +52,15 @@ namespace llvm {
|
||||
// running the "Kept" passes fail when run on the output of the "removed"
|
||||
// passes. If we return true, we update the current module of bugpoint.
|
||||
//
|
||||
virtual TestResult doTest(std::vector<const PassInfo*> &Removed,
|
||||
std::vector<const PassInfo*> &Kept,
|
||||
virtual TestResult doTest(std::vector<const StaticPassInfo*> &Removed,
|
||||
std::vector<const StaticPassInfo*> &Kept,
|
||||
std::string &Error);
|
||||
};
|
||||
}
|
||||
|
||||
ReducePassList::TestResult
|
||||
ReducePassList::doTest(std::vector<const PassInfo*> &Prefix,
|
||||
std::vector<const PassInfo*> &Suffix,
|
||||
ReducePassList::doTest(std::vector<const StaticPassInfo*> &Prefix,
|
||||
std::vector<const StaticPassInfo*> &Suffix,
|
||||
std::string &Error) {
|
||||
sys::Path PrefixOutput;
|
||||
Module *OrigProgram = 0;
|
||||
|
@@ -99,8 +99,8 @@ Module *BugDriver::deleteInstructionFromProgram(const Instruction *I,
|
||||
return Result;
|
||||
}
|
||||
|
||||
static const PassInfo *getPI(Pass *P) {
|
||||
const PassInfo *PI = P->getPassInfo();
|
||||
static const StaticPassInfo *getPI(Pass *P) {
|
||||
const StaticPassInfo *PI = P->getPassInfo();
|
||||
delete P;
|
||||
return PI;
|
||||
}
|
||||
@@ -114,7 +114,7 @@ Module *BugDriver::performFinalCleanups(Module *M, bool MayModifySemantics) {
|
||||
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
|
||||
I->setLinkage(GlobalValue::ExternalLinkage);
|
||||
|
||||
std::vector<const PassInfo*> CleanupPasses;
|
||||
std::vector<const StaticPassInfo*> CleanupPasses;
|
||||
CleanupPasses.push_back(getPI(createGlobalDCEPass()));
|
||||
|
||||
if (MayModifySemantics)
|
||||
@@ -138,7 +138,7 @@ Module *BugDriver::performFinalCleanups(Module *M, bool MayModifySemantics) {
|
||||
/// function. This returns null if there are no extractable loops in the
|
||||
/// program or if the loop extractor crashes.
|
||||
Module *BugDriver::ExtractLoop(Module *M) {
|
||||
std::vector<const PassInfo*> LoopExtractPasses;
|
||||
std::vector<const StaticPassInfo*> LoopExtractPasses;
|
||||
LoopExtractPasses.push_back(getPI(createSingleLoopExtractorPass()));
|
||||
|
||||
Module *NewM = runPassesOn(M, LoopExtractPasses);
|
||||
@@ -359,7 +359,7 @@ Module *BugDriver::ExtractMappedBlocksFromModule(const
|
||||
std::string uniqueFN = "--extract-blocks-file=" + uniqueFilename.str();
|
||||
const char *ExtraArg = uniqueFN.c_str();
|
||||
|
||||
std::vector<const PassInfo*> PI;
|
||||
std::vector<const StaticPassInfo*> PI;
|
||||
std::vector<BasicBlock *> EmptyBBs; // This parameter is ignored.
|
||||
PI.push_back(getPI(createBlockExtractorPass(EmptyBBs)));
|
||||
Module *Ret = runPassesOn(M, PI, false, 1, &ExtraArg);
|
||||
|
@@ -29,7 +29,8 @@ using namespace llvm;
|
||||
/// If the passes did not compile correctly, output the command required to
|
||||
/// recreate the failure. This returns true if a compiler error is found.
|
||||
///
|
||||
bool BugDriver::runManyPasses(const std::vector<const PassInfo*> &AllPasses,
|
||||
bool
|
||||
BugDriver::runManyPasses(const std::vector<const StaticPassInfo*> &AllPasses,
|
||||
std::string &ErrMsg) {
|
||||
setPassesToRun(AllPasses);
|
||||
outs() << "Starting bug finding procedure...\n\n";
|
||||
|
@@ -43,13 +43,13 @@ namespace {
|
||||
cl::desc("Don't extract blocks when searching for miscompilations"),
|
||||
cl::init(false));
|
||||
|
||||
class ReduceMiscompilingPasses : public ListReducer<const PassInfo*> {
|
||||
class ReduceMiscompilingPasses : public ListReducer<const StaticPassInfo*> {
|
||||
BugDriver &BD;
|
||||
public:
|
||||
ReduceMiscompilingPasses(BugDriver &bd) : BD(bd) {}
|
||||
|
||||
virtual TestResult doTest(std::vector<const PassInfo*> &Prefix,
|
||||
std::vector<const PassInfo*> &Suffix,
|
||||
virtual TestResult doTest(std::vector<const StaticPassInfo*> &Prefix,
|
||||
std::vector<const StaticPassInfo*> &Suffix,
|
||||
std::string &Error);
|
||||
};
|
||||
}
|
||||
@@ -58,8 +58,8 @@ namespace {
|
||||
/// group, see if they still break the program.
|
||||
///
|
||||
ReduceMiscompilingPasses::TestResult
|
||||
ReduceMiscompilingPasses::doTest(std::vector<const PassInfo*> &Prefix,
|
||||
std::vector<const PassInfo*> &Suffix,
|
||||
ReduceMiscompilingPasses::doTest(std::vector<const StaticPassInfo*> &Prefix,
|
||||
std::vector<const StaticPassInfo*> &Suffix,
|
||||
std::string &Error) {
|
||||
// First, run the program with just the Suffix passes. If it is still broken
|
||||
// with JUST the kept passes, discard the prefix passes.
|
||||
|
@@ -83,7 +83,7 @@ void BugDriver::EmitProgressBitcode(const std::string &ID, bool NoFlyer) {
|
||||
outs() << getPassesString(PassesToRun) << "\n";
|
||||
}
|
||||
|
||||
int BugDriver::runPassesAsChild(const std::vector<const PassInfo*> &Passes) {
|
||||
int BugDriver::runPassesAsChild(const std::vector<const StaticPassInfo*> &Passes) {
|
||||
std::string ErrInfo;
|
||||
raw_fd_ostream OutFile(ChildOutput.c_str(), ErrInfo,
|
||||
raw_fd_ostream::F_Binary);
|
||||
@@ -124,7 +124,7 @@ cl::opt<bool> SilencePasses("silence-passes", cl::desc("Suppress output of runni
|
||||
/// outs() a single line message indicating whether compilation was successful
|
||||
/// or failed.
|
||||
///
|
||||
bool BugDriver::runPasses(const std::vector<const PassInfo*> &Passes,
|
||||
bool BugDriver::runPasses(const std::vector<const StaticPassInfo*> &Passes,
|
||||
std::string &OutputFilename, bool DeleteOutput,
|
||||
bool Quiet, unsigned NumExtraArgs,
|
||||
const char * const *ExtraArgs) const {
|
||||
@@ -178,7 +178,7 @@ bool BugDriver::runPasses(const std::vector<const PassInfo*> &Passes,
|
||||
pass_args.push_back( std::string("-load"));
|
||||
pass_args.push_back( PluginLoader::getPlugin(i));
|
||||
}
|
||||
for (std::vector<const PassInfo*>::const_iterator I = Passes.begin(),
|
||||
for (std::vector<const StaticPassInfo*>::const_iterator I = Passes.begin(),
|
||||
E = Passes.end(); I != E; ++I )
|
||||
pass_args.push_back( std::string("-") + (*I)->getPassArgument() );
|
||||
for (std::vector<std::string>::const_iterator I = pass_args.begin(),
|
||||
@@ -235,7 +235,7 @@ bool BugDriver::runPasses(const std::vector<const PassInfo*> &Passes,
|
||||
/// module, returning the transformed module on success, or a null pointer on
|
||||
/// failure.
|
||||
Module *BugDriver::runPassesOn(Module *M,
|
||||
const std::vector<const PassInfo*> &Passes,
|
||||
const std::vector<const StaticPassInfo*> &Passes,
|
||||
bool AutoDebugCrashes, unsigned NumExtraArgs,
|
||||
const char * const *ExtraArgs) {
|
||||
Module *OldProgram = swapProgramIn(M);
|
||||
|
@@ -61,7 +61,7 @@ UseValgrind("enable-valgrind",
|
||||
// The AnalysesList is automatically populated with registered Passes by the
|
||||
// PassNameParser.
|
||||
//
|
||||
static cl::list<const PassInfo*, bool, PassNameParser>
|
||||
static cl::list<const StaticPassInfo*, bool, PassNameParser>
|
||||
PassList(cl::desc("Passes available:"), cl::ZeroOrMore);
|
||||
|
||||
static cl::opt<bool>
|
||||
@@ -90,7 +90,7 @@ namespace {
|
||||
AddToDriver(BugDriver &_D) : D(_D) {}
|
||||
|
||||
virtual void add(Pass *P) {
|
||||
const PassInfo *PI = P->getPassInfo();
|
||||
const StaticPassInfo *PI = P->getPassInfo();
|
||||
D.addPasses(&PI, &PI + 1);
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user