[llvm-commits] CVS: llvm/tools/extract/extract.cpp

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


Changes in directory llvm/tools/extract:

extract.cpp updated: 1.21 -> 1.22

---
Log message:

Add command-line option to select whether to isolate or delete function from
module. Default is `isolate' as before.


---
Diffs of the changes:  (+5 -1)

Index: llvm/tools/extract/extract.cpp
diff -u llvm/tools/extract/extract.cpp:1.21 llvm/tools/extract/extract.cpp:1.22
--- llvm/tools/extract/extract.cpp:1.21	Thu Feb 19 14:32:39 2004
+++ llvm/tools/extract/extract.cpp	Thu Apr 22 18:07:39 2004
@@ -36,6 +36,9 @@
 static cl::opt<bool>
 Force("f", cl::desc("Overwrite output files"));
 
+static cl::opt<bool>
+DeleteFn("delete", cl::desc("Delete specified function from Module"));
+
 // ExtractFunc - The function to extract from the module... defaults to main.
 static cl::opt<std::string>
 ExtractFunc("func", cl::desc("Specify function to extract"), cl::init("main"),
@@ -64,7 +67,8 @@
   //
   PassManager Passes;
   Passes.add(new TargetData("extract", M.get())); // Use correct TargetData
-  Passes.add(createFunctionExtractionPass(F));    // Extract the function
+  // Either isolate the function or delete it from the Module
+  Passes.add(createFunctionExtractionPass(F, DeleteFn));
   Passes.add(createGlobalDCEPass());              // Delete unreachable globals
   Passes.add(createFunctionResolvingPass());      // Delete prototypes
   Passes.add(createDeadTypeEliminationPass());    // Remove dead types...





More information about the llvm-commits mailing list