mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Add control of function merging to the PMBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217731 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
75d7f73678
commit
c2104d4856
@ -123,6 +123,7 @@ public:
|
||||
bool VerifyInput;
|
||||
bool VerifyOutput;
|
||||
bool StripDebug;
|
||||
bool MergeFunctions;
|
||||
|
||||
private:
|
||||
/// ExtensionList - This is list of all of the extensions that are registered.
|
||||
|
@ -91,6 +91,7 @@ PassManagerBuilder::PassManagerBuilder() {
|
||||
VerifyInput = false;
|
||||
VerifyOutput = false;
|
||||
StripDebug = false;
|
||||
MergeFunctions = false;
|
||||
}
|
||||
|
||||
PassManagerBuilder::~PassManagerBuilder() {
|
||||
@ -330,6 +331,10 @@ void PassManagerBuilder::populateModulePassManager(PassManagerBase &MPM) {
|
||||
MPM.add(createConstantMergePass()); // Merge dup global constants
|
||||
}
|
||||
}
|
||||
|
||||
if (MergeFunctions)
|
||||
MPM.add(createMergeFunctionsPass());
|
||||
|
||||
addExtensionsToPM(EP_OptimizerLast, MPM);
|
||||
}
|
||||
|
||||
@ -427,6 +432,11 @@ void PassManagerBuilder::addLTOOptimizationPasses(PassManagerBase &PM) {
|
||||
|
||||
// Now that we have optimized the program, discard unreachable functions.
|
||||
PM.add(createGlobalDCEPass());
|
||||
|
||||
// FIXME: this is profitable (for compiler time) to do at -O0 too, but
|
||||
// currently it damages debug info.
|
||||
if (MergeFunctions)
|
||||
PM.add(createMergeFunctionsPass());
|
||||
}
|
||||
|
||||
void PassManagerBuilder::populateLTOPassManager(PassManagerBase &PM,
|
||||
|
Loading…
Reference in New Issue
Block a user