mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-28 21:34:23 +00:00
Seperate stats for DCE'd functions and vars
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2961 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f8dff732ae
commit
5796091dfd
@ -13,7 +13,8 @@
|
|||||||
#include "Support/DepthFirstIterator.h"
|
#include "Support/DepthFirstIterator.h"
|
||||||
#include "Support/StatisticReporter.h"
|
#include "Support/StatisticReporter.h"
|
||||||
|
|
||||||
static Statistic<> NumRemoved("globaldce\t- Number of global values removed");
|
static Statistic<> NumFunctions("globaldce\t- Number of functions removed");
|
||||||
|
static Statistic<> NumVariables("globaldce\t- Number of global variables removed");
|
||||||
|
|
||||||
static bool RemoveUnreachableFunctions(Module &M, CallGraph &CallGraph) {
|
static bool RemoveUnreachableFunctions(Module &M, CallGraph &CallGraph) {
|
||||||
// Calculate which functions are reachable from the external functions in the
|
// Calculate which functions are reachable from the external functions in the
|
||||||
@ -34,7 +35,7 @@ static bool RemoveUnreachableFunctions(Module &M, CallGraph &CallGraph) {
|
|||||||
I->dropAllReferences();
|
I->dropAllReferences();
|
||||||
N->removeAllCalledFunctions();
|
N->removeAllCalledFunctions();
|
||||||
FunctionsToDelete.push_back(N);
|
FunctionsToDelete.push_back(N);
|
||||||
++NumRemoved;
|
++NumFunctions;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +62,7 @@ static bool RemoveUnreachableGlobalVariables(Module &M) {
|
|||||||
++I; // Cannot eliminate global variable
|
++I; // Cannot eliminate global variable
|
||||||
else {
|
else {
|
||||||
I = M.getGlobalList().erase(I);
|
I = M.getGlobalList().erase(I);
|
||||||
++NumRemoved;
|
++NumVariables;
|
||||||
Changed = true;
|
Changed = true;
|
||||||
}
|
}
|
||||||
return Changed;
|
return Changed;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user