1 //===-- VPlanDominatorTree.h ------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 /// This file implements dominator tree analysis for a single level of a VPlan's
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_TRANSFORMS_VECTORIZE_VPLANDOMINATORTREE_H
16 #define LLVM_TRANSFORMS_VECTORIZE_VPLANDOMINATORTREE_H
20 #include "llvm/ADT/GraphTraits.h"
21 #include "llvm/IR/Dominators.h"
22 #include "llvm/Support/GenericDomTree.h"
26 template <> struct DomTreeNodeTraits
<VPBlockBase
> {
27 using NodeType
= VPBlockBase
;
28 using NodePtr
= VPBlockBase
*;
29 using ParentPtr
= VPlan
*;
31 static NodePtr
getEntryNode(ParentPtr Parent
) { return Parent
->getEntry(); }
32 static ParentPtr
getParent(NodePtr B
) { return B
->getPlan(); }
36 /// Template specialization of the standard LLVM dominator tree utility for
38 using VPDominatorTree
= DomTreeBase
<VPBlockBase
>;
40 using VPDomTreeNode
= DomTreeNodeBase
<VPBlockBase
>;
42 /// Template specializations of GraphTraits for VPDomTreeNode.
44 struct GraphTraits
<VPDomTreeNode
*>
45 : public DomTreeGraphTraitsBase
<VPDomTreeNode
,
46 VPDomTreeNode::const_iterator
> {};
49 struct GraphTraits
<const VPDomTreeNode
*>
50 : public DomTreeGraphTraitsBase
<const VPDomTreeNode
,
51 VPDomTreeNode::const_iterator
> {};
53 #endif // LLVM_TRANSFORMS_VECTORIZE_VPLANDOMINATORTREE_H