[llvm-commits] CVS: llvm/tools/gccld/GenerateCode.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Feb 25 15:36:00 PST 2004


Changes in directory llvm/tools/gccld:

GenerateCode.cpp updated: 1.18 -> 1.19

---
Log message:

Add a new pass, run internalize first


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

Index: llvm/tools/gccld/GenerateCode.cpp
diff -u llvm/tools/gccld/GenerateCode.cpp:1.18 llvm/tools/gccld/GenerateCode.cpp:1.19
--- llvm/tools/gccld/GenerateCode.cpp:1.18	Mon Jan 26 17:51:10 2004
+++ llvm/tools/gccld/GenerateCode.cpp	Wed Feb 25 15:35:13 2004
@@ -81,6 +81,17 @@
   addPass(Passes, createFunctionResolvingPass());
 
   if (!DisableOptimizations) {
+    if (Internalize) {
+      // Now that composite has been compiled, scan through the module, looking
+      // for a main function.  If main is defined, mark all other functions
+      // internal.
+      addPass(Passes, createInternalizePass());
+    }
+
+    // Now that we internalized some globals, see if we can mark any globals as
+    // being constant!
+    addPass(Passes, createGlobalConstifierPass());
+
     // Linking modules together can lead to duplicated global constants, only
     // keep one copy of each constant...
     addPass(Passes, createConstantMergePass());
@@ -90,13 +101,6 @@
     // supporting.
     if (Strip)
       addPass(Passes, createSymbolStrippingPass());
-
-    if (Internalize) {
-      // Now that composite has been compiled, scan through the module, looking
-      // for a main function.  If main is defined, mark all other functions
-      // internal.
-      addPass(Passes, createInternalizePass());
-    }
 
     // Propagate constants at call sites into the functions they call.
     addPass(Passes, createIPConstantPropagationPass());





More information about the llvm-commits mailing list