mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-07 23:44:41 +00:00
Add a new pass, run internalize first
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11839 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a93d19fff7
commit
dd429c6de9
@ -81,6 +81,17 @@ GenerateBytecode (Module *M, bool Strip, bool Internalize, std::ostream *Out) {
|
|||||||
addPass(Passes, createFunctionResolvingPass());
|
addPass(Passes, createFunctionResolvingPass());
|
||||||
|
|
||||||
if (!DisableOptimizations) {
|
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
|
// Linking modules together can lead to duplicated global constants, only
|
||||||
// keep one copy of each constant...
|
// keep one copy of each constant...
|
||||||
addPass(Passes, createConstantMergePass());
|
addPass(Passes, createConstantMergePass());
|
||||||
@ -91,13 +102,6 @@ GenerateBytecode (Module *M, bool Strip, bool Internalize, std::ostream *Out) {
|
|||||||
if (Strip)
|
if (Strip)
|
||||||
addPass(Passes, createSymbolStrippingPass());
|
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.
|
// Propagate constants at call sites into the functions they call.
|
||||||
addPass(Passes, createIPConstantPropagationPass());
|
addPass(Passes, createIPConstantPropagationPass());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user