diff options
author | Chris Lattner <sabre@nondot.org> | 2004-02-25 21:35:13 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-02-25 21:35:13 +0000 |
commit | b66a35ef9c7cbefd9e3244d1a7a52cca238e223a (patch) | |
tree | e76ee7390cf637b95a26620ff9395bcf868b8ff7 /llvm | |
parent | 0f39359dd278a26cf4809046f3700275aae56cd8 (diff) | |
download | bcm5719-llvm-b66a35ef9c7cbefd9e3244d1a7a52cca238e223a.tar.gz bcm5719-llvm-b66a35ef9c7cbefd9e3244d1a7a52cca238e223a.zip |
Add a new pass, run internalize first
llvm-svn: 11839
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/tools/gccld/GenerateCode.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/llvm/tools/gccld/GenerateCode.cpp b/llvm/tools/gccld/GenerateCode.cpp index d717cd5616a..3277c48e22f 100644 --- a/llvm/tools/gccld/GenerateCode.cpp +++ b/llvm/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()); |