brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · 44506f5 Raw
63 lines · c
1//===-- VPlanDominatorTree.h ------------------------------------*- C++ -*-===//2//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-exception6//7//===----------------------------------------------------------------------===//8///9/// \file10/// This file implements dominator tree analysis for a single level of a VPlan's11/// H-CFG.12///13//===----------------------------------------------------------------------===//14 15#ifndef LLVM_TRANSFORMS_VECTORIZE_VPLANDOMINATORTREE_H16#define LLVM_TRANSFORMS_VECTORIZE_VPLANDOMINATORTREE_H17 18#include "VPlan.h"19#include "VPlanCFG.h"20#include "llvm/ADT/GraphTraits.h"21#include "llvm/IR/Dominators.h"22#include "llvm/Support/GenericDomTree.h"23#include "llvm/Support/GenericDomTreeConstruction.h"24 25namespace llvm {26 27template <> struct DomTreeNodeTraits<VPBlockBase> {28  using NodeType = VPBlockBase;29  using NodePtr = VPBlockBase *;30  using ParentPtr = VPlan *;31 32  static NodePtr getEntryNode(ParentPtr Parent) { return Parent->getEntry(); }33  static ParentPtr getParent(NodePtr B) { return B->getPlan(); }34};35 36/// Template specialization of the standard LLVM dominator tree utility for37/// VPBlockBases.38class VPDominatorTree : public DominatorTreeBase<VPBlockBase, false> {39  using Base = DominatorTreeBase<VPBlockBase, false>;40 41public:42  explicit VPDominatorTree(VPlan &Plan) { recalculate(Plan); }43 44  /// Returns true if \p A properly dominates \p B.45  using Base::properlyDominates;46  bool properlyDominates(const VPRecipeBase *A, const VPRecipeBase *B);47};48 49using VPDomTreeNode = DomTreeNodeBase<VPBlockBase>;50 51/// Template specializations of GraphTraits for VPDomTreeNode.52template <>53struct GraphTraits<VPDomTreeNode *>54    : public DomTreeGraphTraitsBase<VPDomTreeNode,55                                    VPDomTreeNode::const_iterator> {};56 57template <>58struct GraphTraits<const VPDomTreeNode *>59    : public DomTreeGraphTraitsBase<const VPDomTreeNode,60                                    VPDomTreeNode::const_iterator> {};61} // namespace llvm62#endif // LLVM_TRANSFORMS_VECTORIZE_VPLANDOMINATORTREE_H63