LLVM 20.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
14
15namespace llvm {
16
17class BasicBlock;
18
19namespace IDFCalculatorDetail {
20
21/// Specialization for BasicBlock for the optional use of GraphDiff.
22template <bool IsPostDom> struct ChildrenGetterTy<BasicBlock, IsPostDom> {
25
26 ChildrenGetterTy() = default;
28 assert(GD);
29 }
30
31 ChildrenTy get(const NodeRef &N);
32
34};
35
36} // end of namespace IDFCalculatorDetail
37
38template <bool IsPostDom>
39class IDFCalculator final : public IDFCalculatorBase<BasicBlock, IsPostDom> {
40public:
44
46 : IDFCalculatorBase(DT) {}
47
51 assert(GD);
52 }
53};
54
57
58//===----------------------------------------------------------------------===//
59// Implementation.
60//===----------------------------------------------------------------------===//
61
62namespace IDFCalculatorDetail {
63
64template <bool IsPostDom>
65typename ChildrenGetterTy<BasicBlock, IsPostDom>::ChildrenTy
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
Compute iterated dominance frontiers using a linear time algorithm.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Basic Block Representation.
Definition: BasicBlock.h:61
Core dominator tree base class.
Determine the iterated dominance frontier, given a set of defining blocks, and optionally,...
IDFCalculatorDetail::ChildrenGetterTy< NodeTy, IsPostDom > ChildrenGetterTy
std::conditional_t< IsPostDom, Inverse< NodeTy * >, NodeTy * > OrderedNodeTy
IDFCalculator(DominatorTreeBase< BasicBlock, IsPostDom > &DT, const GraphDiff< BasicBlock *, IsPostDom > *GD)
IDFCalculator(DominatorTreeBase< BasicBlock, IsPostDom > &DT)
typename IDFCalculatorBase::ChildrenGetterTy ChildrenGetterTy
typename llvm::IDFCalculatorBase< BasicBlock, IsPostDom > IDFCalculatorBase
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1196
@ BasicBlock
Various leaf nodes.
Definition: ISDOpcodes.h:71
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
#define N
Generic utility class used for getting the children of a basic block.
typename GraphTraits< NodeTy * >::NodeRef NodeRef