Clarify the logic: the flag is renamed to `deleteFn' to signify it will delete
authorMisha Brukman <brukman+llvm@gmail.com>
Thu, 22 Apr 2004 23:00:51 +0000 (23:00 +0000)
committerMisha Brukman <brukman+llvm@gmail.com>
Thu, 22 Apr 2004 23:00:51 +0000 (23:00 +0000)
the function instead of isolating it. This also means the condition is reversed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13112 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Transforms/IPO.h
lib/Transforms/IPO/ExtractFunction.cpp

index 7db830251532d4462ac0102818a3eb56fc3a297b..2f7ac0cd2c7f1e4a74f48528b64018489219d6b9 100644 (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);
 
 
 //===----------------------------------------------------------------------===//
index 052742689fca26c5190fe006bcfb91d5d5474ca3..41b796035b26165f6b1809b6ea636e258a17bf30 100644 (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);
 }