Allow the block extractor take to take a list of basic blocks to not extract

from a file containing Function/BasicBlock pairings. This is not safe against
anonymous or abnormally-named Funcs or BBs.

Make bugpoint use this interface to pass the BBs list to the child bugpoint.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44101 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nick Lewycky
2007-11-14 06:47:06 +00:00
parent 1b12d8855d
commit 6fa98b1320
5 changed files with 121 additions and 12 deletions
+9 -4
View File
@@ -124,7 +124,8 @@ int BugDriver::runPassesAsChild(const std::vector<const PassInfo*> &Passes) {
///
bool BugDriver::runPasses(const std::vector<const PassInfo*> &Passes,
std::string &OutputFilename, bool DeleteOutput,
bool Quiet) const {
bool Quiet, unsigned NumExtraArgs,
const char * const *ExtraArgs) const {
// setup the output file name
cout << std::flush;
sys::Path uniqueFilename("bugpoint-output.bc");
@@ -156,7 +157,7 @@ bool BugDriver::runPasses(const std::vector<const PassInfo*> &Passes,
// setup the child process' arguments
const char** args = (const char**)
alloca(sizeof(const char*) *
(Passes.size()+13+2*PluginLoader::getNumPlugins()));
(Passes.size()+13+2*PluginLoader::getNumPlugins()+NumExtraArgs));
int n = 0;
sys::Path tool = sys::Program::FindProgramByName(ToolName);
if (UseValgrind) {
@@ -182,6 +183,8 @@ bool BugDriver::runPasses(const std::vector<const PassInfo*> &Passes,
E = pass_args.end(); I != E; ++I )
args[n++] = I->c_str();
args[n++] = inputFilename.c_str();
for (unsigned i = 0; i < NumExtraArgs; ++i)
args[n++] = *ExtraArgs;
args[n++] = 0;
sys::Path prog;
@@ -225,10 +228,12 @@ bool BugDriver::runPasses(const std::vector<const PassInfo*> &Passes,
/// failure.
Module *BugDriver::runPassesOn(Module *M,
const std::vector<const PassInfo*> &Passes,
bool AutoDebugCrashes) {
bool AutoDebugCrashes, unsigned NumExtraArgs,
const char * const *ExtraArgs) {
Module *OldProgram = swapProgramIn(M);
std::string BitcodeResult;
if (runPasses(Passes, BitcodeResult, false/*delete*/, true/*quiet*/)) {
if (runPasses(Passes, BitcodeResult, false/*delete*/, true/*quiet*/,
NumExtraArgs, ExtraArgs)) {
if (AutoDebugCrashes) {
cerr << " Error running this sequence of passes"
<< " on the input program!\n";