mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 05:24:01 +00:00
Add support for reading block frequencies. Fix bug in attribution of counts
to functions git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9559 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -19,6 +19,7 @@
|
||||
#include "Support/CommandLine.h"
|
||||
#include <iostream>
|
||||
#include <cstdio>
|
||||
#include <map>
|
||||
|
||||
namespace {
|
||||
cl::opt<std::string>
|
||||
@ -77,5 +78,16 @@ int main(int argc, char **argv) {
|
||||
for (unsigned i = 0, e = FunctionCounts.size(); i != e; ++i)
|
||||
printf("%3d. %5d/%d %s\n", i, FunctionCounts[i].second, TotalExecutions,
|
||||
FunctionCounts[i].first->getName().c_str());
|
||||
|
||||
|
||||
// If we have block count information, print out the LLVM module with
|
||||
// frequency annotations.
|
||||
if (PI.hasAccurateBlockCounts()) {
|
||||
std::vector<std::pair<BasicBlock*, unsigned> > Counts;
|
||||
PI.getBlockCounts(Counts);
|
||||
std::map<BasicBlock*, unsigned> BlockFreqs(Counts.begin(), Counts.end());
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user