summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-25 21:35:13 +0000
committerChris Lattner <sabre@nondot.org>2004-02-25 21:35:13 +0000
commitdd429c6de9e4c65d4992ec6494e57635dcb2b641 (patch)
tree61f44d105dd7484aeeff7265c944cfeddb4d296c /tools
parenta93d19fff7e53d48bbdb74b85ca5dc23f00855a8 (diff)
downloadllvm-dd429c6de9e4c65d4992ec6494e57635dcb2b641.tar.gz
llvm-dd429c6de9e4c65d4992ec6494e57635dcb2b641.tar.bz2
llvm-dd429c6de9e4c65d4992ec6494e57635dcb2b641.tar.xz
Add a new pass, run internalize first
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11839 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/gccld/GenerateCode.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/tools/gccld/GenerateCode.cpp b/tools/gccld/GenerateCode.cpp
index d717cd5616..3277c48e22 100644
--- a/tools/gccld/GenerateCode.cpp
+++ b/tools/gccld/GenerateCode.cpp
@@ -81,6 +81,17 @@ GenerateBytecode (Module *M, bool Strip, bool Internalize, std::ostream *Out) {
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 @@ GenerateBytecode (Module *M, bool Strip, bool Internalize, std::ostream *Out) {
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());