LLVM  14.0.0git
IteratedDominanceFrontier.h
Go to the documentation of this file.
1 //===- IteratedDominanceFrontier.h - Calculate IDF --------------*- 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-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_ANALYSIS_ITERATEDDOMINANCEFRONTIER_H
10 #define LLVM_ANALYSIS_ITERATEDDOMINANCEFRONTIER_H
11 
12 #include "llvm/Support/CFGDiff.h"
14 
15 namespace llvm {
16 
17 class BasicBlock;
18 
19 namespace IDFCalculatorDetail {
20 
21 /// Specialization for BasicBlock for the optional use of GraphDiff.
22 template <bool IsPostDom> struct ChildrenGetterTy<BasicBlock, IsPostDom> {
23  using NodeRef = BasicBlock *;
25 
26  ChildrenGetterTy() = default;
28  assert(GD);
29  }
30 
31  ChildrenTy get(const NodeRef &N);
32 
34 };
35 
36 } // end of namespace IDFCalculatorDetail
37 
38 template <bool IsPostDom>
39 class IDFCalculator final : public IDFCalculatorBase<BasicBlock, IsPostDom> {
40 public:
41  using IDFCalculatorBase =
44 
46  : IDFCalculatorBase(DT) {}
47 
51  assert(GD);
52  }
53 };
54 
57 
58 //===----------------------------------------------------------------------===//
59 // Implementation.
60 //===----------------------------------------------------------------------===//
61 
62 namespace IDFCalculatorDetail {
63 
64 template <bool IsPostDom>
67 
68  using OrderedNodeTy =
70 
71  if (!GD) {
72  auto Children = children<OrderedNodeTy>(N);
73  return {Children.begin(), Children.end()};
74  }
75 
76  return GD->template getChildren<IsPostDom>(N);
77 }
78 
79 } // end of namespace IDFCalculatorDetail
80 
81 } // end of namespace llvm
82 
83 #endif
llvm::IDFCalculator::IDFCalculator
IDFCalculator(DominatorTreeBase< BasicBlock, IsPostDom > &DT, const GraphDiff< BasicBlock *, IsPostDom > *GD)
Definition: IteratedDominanceFrontier.h:48
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::IDFCalculatorDetail::ChildrenGetterTy::get
ChildrenTy get(const NodeRef &N)
Definition: GenericIteratedDominanceFrontier.h:120
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
llvm::IDFCalculatorDetail::ChildrenGetterTy::NodeRef
typename GraphTraits< NodeTy >::NodeRef NodeRef
Definition: GenericIteratedDominanceFrontier.h:40
llvm::GraphDiff
Definition: CFGDiff.h:57
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:58
CFGDiff.h
GenericIteratedDominanceFrontier.h
llvm::IDFCalculator::IDFCalculator
IDFCalculator(DominatorTreeBase< BasicBlock, IsPostDom > &DT)
Definition: IteratedDominanceFrontier.h:45
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::IDFCalculatorDetail::ChildrenGetterTy< BasicBlock, IsPostDom >::ChildrenGetterTy
ChildrenGetterTy(const GraphDiff< BasicBlock *, IsPostDom > *GD)
Definition: IteratedDominanceFrontier.h:27
llvm::IDFCalculator
Definition: IteratedDominanceFrontier.h:39
llvm::ISD::BasicBlock
@ BasicBlock
Various leaf nodes.
Definition: ISDOpcodes.h:71
llvm::IDFCalculatorDetail::ChildrenGetterTy::ChildrenTy
SmallVector< NodeRef, 8 > ChildrenTy
Definition: GenericIteratedDominanceFrontier.h:41
llvm::IDFCalculatorDetail::ChildrenGetterTy< BasicBlock, IsPostDom >::ChildrenTy
SmallVector< BasicBlock *, 8 > ChildrenTy
Definition: IteratedDominanceFrontier.h:24
llvm::DominatorTreeBase< BasicBlock, IsPostDom >
llvm::IDFCalculatorDetail::ChildrenGetterTy
Generic utility class used for getting the children of a basic block.
Definition: GenericIteratedDominanceFrontier.h:39
llvm::IDFCalculatorBase< BasicBlock, IsPostDom >
llvm::IDFCalculatorBase::ChildrenGetterTy
IDFCalculatorDetail::ChildrenGetterTy< NodeTy, IsPostDom > ChildrenGetterTy
Definition: GenericIteratedDominanceFrontier.h:62
N
#define N
llvm::IDFCalculator::ChildrenGetterTy
typename IDFCalculatorBase::ChildrenGetterTy ChildrenGetterTy
Definition: IteratedDominanceFrontier.h:43
llvm::IDFCalculator::IDFCalculatorBase
typename llvm::IDFCalculatorBase< BasicBlock, IsPostDom > IDFCalculatorBase
Definition: IteratedDominanceFrontier.h:42