LLVM 22.0.0git
MachinePostDominators.h
Go to the documentation of this file.
1//===- llvm/CodeGen/MachinePostDominators.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-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file exposes interfaces to post dominance information for
10// target-specific code.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CODEGEN_MACHINEPOSTDOMINATORS_H
15#define LLVM_CODEGEN_MACHINEPOSTDOMINATORS_H
16
19
20namespace llvm {
21
22extern template class LLVM_TEMPLATE_ABI
24
25namespace DomTreeBuilder {
28
29extern template LLVM_TEMPLATE_ABI void
30Calculate<MBBPostDomTree>(MBBPostDomTree &DT);
31extern template LLVM_TEMPLATE_ABI void
32InsertEdge<MBBPostDomTree>(MBBPostDomTree &DT, MachineBasicBlock *From,
34extern template LLVM_TEMPLATE_ABI void
35DeleteEdge<MBBPostDomTree>(MBBPostDomTree &DT, MachineBasicBlock *From,
37extern template LLVM_TEMPLATE_ABI void
38ApplyUpdates<MBBPostDomTree>(MBBPostDomTree &DT, MBBPostDomTreeGraphDiff &,
40extern template LLVM_TEMPLATE_ABI bool
41Verify<MBBPostDomTree>(const MBBPostDomTree &DT,
43} // namespace DomTreeBuilder
44
45///
46/// MachinePostDominatorTree - an analysis pass wrapper for DominatorTree
47/// used to compute the post-dominator tree for MachineFunctions.
48///
51
52public:
54
55 explicit MachinePostDominatorTree(MachineFunction &MF) { recalculate(MF); }
56
57 /// Handle invalidation explicitly.
58 LLVM_ABI bool invalidate(MachineFunction &, const PreservedAnalyses &PA,
60
61 /// Make findNearestCommonDominator(const NodeT *A, const NodeT *B) available.
62 using Base::findNearestCommonDominator;
63
64 /// Returns the nearest common dominator of the given blocks.
65 /// If that tree node is a virtual root, a nullptr will be returned.
67 findNearestCommonDominator(ArrayRef<MachineBasicBlock *> Blocks) const;
68};
69
73
74 LLVM_ABI static AnalysisKey Key;
75
76public:
78
81};
82
86
87public:
91 static bool isRequired() { return true; }
92};
93
95 : public MachineFunctionPass {
96 std::optional<MachinePostDominatorTree> PDT;
97
98public:
99 static char ID;
100
102
104 const MachinePostDominatorTree &getPostDomTree() const { return *PDT; }
105
106 bool runOnMachineFunction(MachineFunction &MF) override;
107 void getAnalysisUsage(AnalysisUsage &AU) const override;
108 void releaseMemory() override { PDT.reset(); }
109 void verifyAnalysis() const override;
110 void print(llvm::raw_ostream &OS, const Module *M = nullptr) const override;
111};
112} //end of namespace llvm
113
114#endif
BlockVerifier::State From
#define LLVM_ABI
Definition: Compiler.h:213
#define LLVM_TEMPLATE_ABI
Definition: Compiler.h:214
DenseMap< Block *, BlockRelaxAux > Blocks
Definition: ELF_riscv.cpp:507
raw_pwrite_stream & OS
API to communicate dependencies between analyses during invalidation.
Definition: PassManager.h:294
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:255
Represent the analysis usage information of a pass.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
Core dominator tree base class.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const MachinePostDominatorTree & getPostDomTree() const
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
MachinePostDominatorTree - an analysis pass wrapper for DominatorTree used to compute the post-domina...
MachinePostDominatorTree(MachineFunction &MF)
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:112
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Printable print(const GCNRegPressure &RP, const GCNSubtarget *ST=nullptr, unsigned DynamicVGPRBlockSize=0)
template class LLVM_TEMPLATE_ABI DominatorTreeBase< MachineBasicBlock, true >
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition: PassManager.h:93
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: Analysis.h:29
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:70