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

Misha Brukman brukman at cs.uiuc.edu
Mon Mar 1 20:19:59 PST 2004


Changes in directory llvm/tools/gccld:

GenerateCode.cpp updated: 1.17 -> 1.17.2.1
Linker.cpp updated: 1.21 -> 1.21.2.1
gccld.cpp updated: 1.68 -> 1.68.4.1

---
Log message:

Merge from trunk

---
Diffs of the changes:  (+25 -13)

Index: llvm/tools/gccld/GenerateCode.cpp
diff -u llvm/tools/gccld/GenerateCode.cpp:1.17 llvm/tools/gccld/GenerateCode.cpp:1.17.2.1
--- llvm/tools/gccld/GenerateCode.cpp:1.17	Tue Jan 13 21:39:46 2004
+++ llvm/tools/gccld/GenerateCode.cpp	Mon Mar  1 17:59:18 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());
@@ -91,13 +102,6 @@
     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());
 
@@ -107,6 +111,11 @@
     if (!DisableInline)
       addPass(Passes, createFunctionInliningPass()); // Inline small functions
 
+    // The IPO passes may leave cruft around.  Clean up after them.
+    addPass(Passes, createInstructionCombiningPass());
+
+    addPass(Passes, createScalarReplAggregatesPass()); // Break up allocas
+
     // Run a few AA driven optimizations here and now, to cleanup the code.
     // Eventually we should put an IP AA in place here.
 
@@ -114,8 +123,7 @@
     addPass(Passes, createLoadValueNumberingPass()); // GVN for load instrs
     addPass(Passes, createGCSEPass());               // Remove common subexprs
 
-    // The FuncResolve pass may leave cruft around if functions were prototyped
-    // differently than they were defined.  Remove this cruft.
+    // Cleanup and simplify the code after the scalar optimizations.
     addPass(Passes, createInstructionCombiningPass());
 
     // Delete basic blocks, which optimization passes may have killed...
@@ -239,8 +247,10 @@
   // Add in the libraries to link.
   std::vector<std::string> Libs(Libraries);
   for (unsigned index = 0; index < Libs.size(); index++) {
-    Libs[index] = "-l" + Libs[index];
-    cmd.push_back(Libs[index].c_str());
+    if (Libs[index] != "crtend") {
+      Libs[index] = "-l" + Libs[index];
+      cmd.push_back(Libs[index].c_str());
+    }
   }
   cmd.push_back(NULL);
 


Index: llvm/tools/gccld/Linker.cpp
diff -u llvm/tools/gccld/Linker.cpp:1.21 llvm/tools/gccld/Linker.cpp:1.21.2.1
--- llvm/tools/gccld/Linker.cpp:1.21	Tue Dec 23 14:27:14 2003
+++ llvm/tools/gccld/Linker.cpp	Mon Mar  1 17:59:18 2004
@@ -21,6 +21,7 @@
 #include "llvm/Transforms/IPO.h"
 #include "llvm/Transforms/Scalar.h"
 #include "llvm/Transforms/Utils/Linker.h"
+#include "Config/config.h"
 #include "Support/CommandLine.h"
 #include "Support/FileUtilities.h"
 #include "Support/Signals.h"
@@ -56,8 +57,8 @@
     if (!SharedObjectOnly && FileOpenable(Directory + LibName + ".bc"))
       return Directory + LibName + ".bc";
 
-    if (FileOpenable(Directory + LibName + ".so"))
-      return Directory + LibName + ".so";
+    if (FileOpenable(Directory + LibName + SHLIBEXT))
+      return Directory + LibName + SHLIBEXT;
 
     if (!SharedObjectOnly && FileOpenable(Directory + LibName + ".a"))
       return Directory + LibName + ".a";


Index: llvm/tools/gccld/gccld.cpp
diff -u llvm/tools/gccld/gccld.cpp:1.68 llvm/tools/gccld/gccld.cpp:1.68.4.1
--- llvm/tools/gccld/gccld.cpp:1.68	Tue Dec  9 09:39:11 2003
+++ llvm/tools/gccld/gccld.cpp	Mon Mar  1 17:59:18 2004
@@ -195,6 +195,7 @@
 
 int main(int argc, char **argv, char **envp) {
   cl::ParseCommandLineOptions(argc, argv, " llvm linker for GCC\n");
+  PrintStackTraceOnErrorSignal();
 
   std::string ModuleID("gccld-output");
   std::auto_ptr<Module> Composite(new Module(ModuleID));





More information about the llvm-commits mailing list