bool BT::reached(const MachineBasicBlock *B) const {
int BN = B->getNumber();
assert(BN >= 0);
- for (EdgeSetType::iterator I = EdgeExec.begin(), E = EdgeExec.end();
- I != E; ++I) {
- if (I->second == BN)
- return true;
- }
- return false;
+ return ReachedBB.count(BN);
}
// Visit an individual instruction. This could be a newly added instruction,
EdgeExec.clear();
InstrExec.clear();
Map.clear();
+ ReachedBB.clear();
+ ReachedBB.reserve(MF.size());
}
void BT::run() {
if (EdgeExec.count(Edge))
continue;
EdgeExec.insert(Edge);
+ ReachedBB.insert(Edge.second);
const MachineBasicBlock &B = *MF.getBlockNumbered(Edge.second);
MachineBasicBlock::const_iterator It = B.begin(), End = B.end();
#ifndef LLVM_LIB_TARGET_HEXAGON_BITTRACKER_H
#define LLVM_LIB_TARGET_HEXAGON_BITTRACKER_H
+#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/MachineFunction.h"
typedef std::set<const MachineInstr *> InstrSetType;
typedef std::queue<CFGEdge> EdgeQueueType;
- EdgeSetType EdgeExec; // Executable flow graph edges.
- InstrSetType InstrExec; // Executable instructions.
- EdgeQueueType FlowQ; // Work queue of CFG edges.
- bool Trace; // Enable tracing for debugging.
+ EdgeSetType EdgeExec; // Executable flow graph edges.
+ InstrSetType InstrExec; // Executable instructions.
+ EdgeQueueType FlowQ; // Work queue of CFG edges.
+ DenseSet<unsigned> ReachedBB; // Cache of reached blocks.
+ bool Trace; // Enable tracing for debugging.
const MachineEvaluator &ME;
MachineFunction &MF;