1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 03:53:04 +02:00

Clarify the logic: the flag is renamed to `deleteFn' to signify it will delete

the function instead of isolating it. This also means the condition is reversed.

llvm-svn: 13112
This commit is contained in:
Misha Brukman 2004-04-22 23:00:51 +00:00
parent ddace6ecbe
commit 1dc8e19185
2 changed files with 15 additions and 15 deletions

View File

@ -66,11 +66,11 @@ Pass *createGlobalDCEPass();
//===----------------------------------------------------------------------===//
/// createFunctionExtractionPass - If isolateFn is true, this pass deletes as
/// much of the module as possible, except for the function specified.
/// Otherwise, it deletes the given function, leaving everything else intact.
/// createFunctionExtractionPass - If deleteFn is true, this pass deletes as
/// the specified function. Otherwise, it deletes as much of the module as
/// possible, except for the function specified.
///
Pass *createFunctionExtractionPass(Function *F, bool isolateFn = true);
Pass *createFunctionExtractionPass(Function *F, bool deleteFn = false);
//===----------------------------------------------------------------------===//

View File

@ -19,14 +19,14 @@ using namespace llvm;
namespace {
class FunctionExtractorPass : public Pass {
Function *Named;
bool isolateFunc;
bool deleteFunc;
public:
/// FunctionExtractorPass - ctor for the pass. If isolateFn is true, then
/// the named function is the only thing left in the Module (default
/// behavior), otherwise the function is the thing deleted.
/// FunctionExtractorPass - If deleteFn is true, this pass deletes as the
/// specified function. Otherwise, it deletes as much of the module as
/// possible, except for the function specified.
///
FunctionExtractorPass(Function *F = 0, bool isolateFn = true)
: Named(F), isolateFunc(isolateFn) {}
FunctionExtractorPass(Function *F = 0, bool deleteFn = true)
: Named(F), deleteFunc(deleteFn) {}
bool run(Module &M) {
if (Named == 0) {
@ -34,10 +34,10 @@ namespace {
if (Named == 0) return false; // No function to extract
}
if (isolateFunc)
return isolateFunction(M);
else
if (deleteFunc)
return deleteFunction();
else
return isolateFunction(M);
}
bool deleteFunction() {
@ -112,6 +112,6 @@ namespace {
RegisterPass<FunctionExtractorPass> X("extract", "Function Extractor");
}
Pass *llvm::createFunctionExtractionPass(Function *F, bool isolateFn) {
return new FunctionExtractorPass(F, isolateFn);
Pass *llvm::createFunctionExtractionPass(Function *F, bool deleteFn) {
return new FunctionExtractorPass(F, deleteFn);
}