[llvm-commits] CVS: llvm/lib/Transforms/IPO/ExtractFunction.cpp

Misha Brukman brukman at cs.uiuc.edu
Thu Apr 22 18:01:02 PDT 2004


Changes in directory llvm/lib/Transforms/IPO:

ExtractFunction.cpp updated: 1.8 -> 1.9

---
Log message:

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.


---
Diffs of the changes:  (+11 -11)

Index: llvm/lib/Transforms/IPO/ExtractFunction.cpp
diff -u llvm/lib/Transforms/IPO/ExtractFunction.cpp:1.8 llvm/lib/Transforms/IPO/ExtractFunction.cpp:1.9
--- llvm/lib/Transforms/IPO/ExtractFunction.cpp:1.8	Thu Apr 22 17:52:22 2004
+++ llvm/lib/Transforms/IPO/ExtractFunction.cpp	Thu Apr 22 18:00:51 2004
@@ -19,14 +19,14 @@
 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 @@
         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 @@
   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);
 }





More information about the llvm-commits mailing list