// converting the one argument insert calls.
template <class NodeRef, class InfoType> struct df_iterator_dom_storage {
public:
- typedef DenseMap<NodeRef, InfoType> BaseSet;
+ using BaseSet = DenseMap<NodeRef, InfoType>;
df_iterator_dom_storage(BaseSet &Storage) : Storage(Storage) {}
- typedef typename BaseSet::iterator iterator;
+ using iterator = typename BaseSet::iterator;
std::pair<iterator, bool> insert(NodeRef N) {
return Storage.insert({N, InfoType()});
}
typename GraphT::NodeRef Eval(DominatorTreeBaseByGraphTraits<GraphT> &DT,
typename GraphT::NodeRef VIn,
unsigned LastLinked) {
+ using NodePtr = typename GraphT::NodeRef;
+
auto &VInInfo = DT.Info[VIn];
if (VInInfo.DFSNum < LastLinked)
return VIn;
- SmallVector<typename GraphT::NodeRef, 32> Work;
- SmallPtrSet<typename GraphT::NodeRef, 32> Visited;
+ SmallVector<NodePtr, 32> Work;
+ SmallPtrSet<NodePtr, 32> Visited;
if (VInInfo.Parent >= LastLinked)
Work.push_back(VIn);
while (!Work.empty()) {
- typename GraphT::NodeRef V = Work.back();
+ NodePtr V = Work.back();
auto &VInfo = DT.Info[V];
- typename GraphT::NodeRef VAncestor = DT.Vertex[VInfo.Parent];
+ NodePtr VAncestor = DT.Vertex[VInfo.Parent];
// Process Ancestor first
if (Visited.insert(VAncestor).second && VInfo.Parent >= LastLinked) {
continue;
auto &VAInfo = DT.Info[VAncestor];
- typename GraphT::NodeRef VAncestorLabel = VAInfo.Label;
- typename GraphT::NodeRef VLabel = VInfo.Label;
+ NodePtr VAncestorLabel = VAInfo.Label;
+ NodePtr VLabel = VInfo.Label;
if (DT.Info[VAncestorLabel].Semi < DT.Info[VLabel].Semi)
VInfo.Label = VAncestorLabel;
VInfo.Parent = VAInfo.Parent;
template <class FuncT, class NodeT>
void Calculate(DominatorTreeBaseByGraphTraits<GraphTraits<NodeT>> &DT,
FuncT &F) {
- typedef GraphTraits<NodeT> GraphT;
- static_assert(std::is_pointer<typename GraphT::NodeRef>::value,
+ using GraphT = GraphTraits<NodeT>;
+ using NodePtr = typename GraphT::NodeRef;
+ static_assert(std::is_pointer<NodePtr>::value,
"NodeRef should be pointer type");
- typedef typename std::remove_pointer<typename GraphT::NodeRef>::type NodeType;
+ using NodeType = typename std::remove_pointer<NodePtr>::type;
unsigned N = 0;
bool MultipleRoots = (DT.Roots.size() > 1);
Buckets[i] = i;
for (unsigned i = N; i >= 2; --i) {
- typename GraphT::NodeRef W = DT.Vertex[i];
+ NodePtr W = DT.Vertex[i];
auto &WInfo = DT.Info[W];
// Step #2: Implicitly define the immediate dominator of vertices
for (unsigned j = i; Buckets[j] != i; j = Buckets[j]) {
- typename GraphT::NodeRef V = DT.Vertex[Buckets[j]];
- typename GraphT::NodeRef U = Eval<GraphT>(DT, V, i + 1);
+ NodePtr V = DT.Vertex[Buckets[j]];
+ NodePtr U = Eval<GraphT>(DT, V, i + 1);
DT.IDoms[V] = DT.Info[U].Semi < i ? U : W;
}
}
if (N >= 1) {
- typename GraphT::NodeRef Root = DT.Vertex[1];
+ NodePtr Root = DT.Vertex[1];
for (unsigned j = 1; Buckets[j] != 1; j = Buckets[j]) {
- typename GraphT::NodeRef V = DT.Vertex[Buckets[j]];
+ NodePtr V = DT.Vertex[Buckets[j]];
DT.IDoms[V] = Root;
}
}
// Step #4: Explicitly define the immediate dominator of each vertex
for (unsigned i = 2; i <= N; ++i) {
- typename GraphT::NodeRef W = DT.Vertex[i];
- typename GraphT::NodeRef &WIDom = DT.IDoms[W];
+ NodePtr W = DT.Vertex[i];
+ NodePtr &WIDom = DT.IDoms[W];
if (WIDom != DT.Vertex[DT.Info[W].Semi])
WIDom = DT.IDoms[WIDom];
}
// one exit block, or it may be the virtual exit (denoted by (BasicBlock *)0)
// which postdominates all real exits if there are multiple exit blocks, or
// an infinite loop.
- typename GraphT::NodeRef Root = !MultipleRoots ? DT.Roots[0] : nullptr;
+ NodePtr Root = !MultipleRoots ? DT.Roots[0] : nullptr;
DT.RootNode =
(DT.DomTreeNodes[Root] =
// Loop over all of the reachable blocks in the function...
for (unsigned i = 2; i <= N; ++i) {
- typename GraphT::NodeRef W = DT.Vertex[i];
+ NodePtr W = DT.Vertex[i];
// Don't replace this with 'count', the insertion side effect is important
if (DT.DomTreeNodes[W])
continue; // Haven't calculated this node yet?
- typename GraphT::NodeRef ImmDom = DT.getIDom(W);
+ NodePtr ImmDom = DT.getIDom(W);
assert(ImmDom || DT.DomTreeNodes[nullptr]);