aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/Core/StatsTracker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Core/StatsTracker.cpp')
-rw-r--r--lib/Core/StatsTracker.cpp45
1 files changed, 25 insertions, 20 deletions
diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp
index dbd86524..ccf6e04d 100644
--- a/lib/Core/StatsTracker.cpp
+++ b/lib/Core/StatsTracker.cpp
@@ -165,7 +165,7 @@ static bool instructionIsCoverable(Instruction *i) {
if (it==bb->begin()) {
return true;
} else {
- Instruction *prev = --it;
+ Instruction *prev = static_cast<Instruction *>(--it);
if (isa<CallInst>(prev) || isa<InvokeInst>(prev)) {
Function *target =
getDirectCallTarget(prev, /*moduleIsFullyLinked=*/true);
@@ -539,7 +539,8 @@ void StatsTracker::writeIStats() {
// Always try to write the filename before the function name, as otherwise
// KCachegrind can create two entries for the function, one with an
// unnamed file and one without.
- const InstructionInfo &ii = executor.kmodule->infos->getFunctionInfo(fnIt);
+ Function *fn = static_cast<Function *>(fnIt);
+ const InstructionInfo &ii = executor.kmodule->infos->getFunctionInfo(fn);
if (ii.file != sourceFile) {
of << "fl=" << ii.file << "\n";
sourceFile = ii.file;
@@ -635,9 +636,9 @@ static std::vector<Instruction*> getSuccs(Instruction *i) {
if (i==bb->getTerminator()) {
for (succ_iterator it = succ_begin(bb), ie = succ_end(bb); it != ie; ++it)
- res.push_back(it->begin());
+ res.push_back(static_cast<Instruction *>(it->begin()));
} else {
- res.push_back(++BasicBlock::iterator(i));
+ res.push_back(static_cast<Instruction *>(++BasicBlock::iterator(i)));
}
return res;
@@ -684,18 +685,19 @@ void StatsTracker::computeReachableUncovered() {
bbIt != bb_ie; ++bbIt) {
for (BasicBlock::iterator it = bbIt->begin(), ie = bbIt->end();
it != ie; ++it) {
- if (isa<CallInst>(it) || isa<InvokeInst>(it)) {
- CallSite cs(it);
+ Instruction *inst = static_cast<Instruction *>(it);
+ if (isa<CallInst>(inst) || isa<InvokeInst>(inst)) {
+ CallSite cs(inst);
if (isa<InlineAsm>(cs.getCalledValue())) {
// We can never call through here so assume no targets
// (which should be correct anyhow).
- callTargets.insert(std::make_pair(it,
+ callTargets.insert(std::make_pair(inst,
std::vector<Function*>()));
} else if (Function *target = getDirectCallTarget(
cs, /*moduleIsFullyLinked=*/true)) {
- callTargets[it].push_back(target);
+ callTargets[inst].push_back(target);
} else {
- callTargets[it] =
+ callTargets[inst] =
std::vector<Function*>(km->escapingFunctions.begin(),
km->escapingFunctions.end());
}
@@ -716,14 +718,15 @@ void StatsTracker::computeReachableUncovered() {
std::vector<Instruction *> instructions;
for (Module::iterator fnIt = m->begin(), fn_ie = m->end();
fnIt != fn_ie; ++fnIt) {
+ Function *fn = static_cast<Function *>(fnIt);
if (fnIt->isDeclaration()) {
if (fnIt->doesNotReturn()) {
- functionShortestPath[fnIt] = 0;
+ functionShortestPath[fn] = 0;
} else {
- functionShortestPath[fnIt] = 1; // whatever
+ functionShortestPath[fn] = 1; // whatever
}
} else {
- functionShortestPath[fnIt] = 0;
+ functionShortestPath[fn] = 0;
}
// Not sure if I should bother to preorder here. XXX I should.
@@ -731,13 +734,14 @@ void StatsTracker::computeReachableUncovered() {
bbIt != bb_ie; ++bbIt) {
for (BasicBlock::iterator it = bbIt->begin(), ie = bbIt->end();
it != ie; ++it) {
- instructions.push_back(it);
- unsigned id = infos.getInfo(it).id;
+ Instruction *inst = static_cast<Instruction *>(it);
+ instructions.push_back(inst);
+ unsigned id = infos.getInfo(inst).id;
sm.setIndexedValue(stats::minDistToReturn,
id,
- isa<ReturnInst>(it)
+ isa<ReturnInst>(inst)
#if LLVM_VERSION_CODE < LLVM_VERSION(3, 1)
- || isa<UnwindInst>(it)
+ || isa<UnwindInst>(inst)
#endif
);
}
@@ -790,13 +794,13 @@ void StatsTracker::computeReachableUncovered() {
// that no return instructions are reachable)
Function *f = inst->getParent()->getParent();
if (best != cur
- || (inst == f->begin()->begin()
+ || (inst == static_cast<Instruction *>(f->begin()->begin())
&& functionShortestPath[f] != best)) {
sm.setIndexedValue(stats::minDistToReturn, id, best);
changed = true;
// Update shortest path if this is the entry point.
- if (inst==f->begin()->begin())
+ if (inst == static_cast<Instruction *>(f->begin()->begin()))
functionShortestPath[f] = best;
}
}
@@ -813,8 +817,9 @@ void StatsTracker::computeReachableUncovered() {
bbIt != bb_ie; ++bbIt) {
for (BasicBlock::iterator it = bbIt->begin(), ie = bbIt->end();
it != ie; ++it) {
- unsigned id = infos.getInfo(it).id;
- instructions.push_back(&*it);
+ Instruction *inst = static_cast<Instruction *>(it);
+ unsigned id = infos.getInfo(inst).id;
+ instructions.push_back(inst);
sm.setIndexedValue(stats::minDistToUncovered,
id,
sm.getIndexedValue(stats::uncoveredInstructions, id));