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
31extern template LLVM_TEMPLATE_ABI void
34extern template LLVM_TEMPLATE_ABI void
37extern template LLVM_TEMPLATE_ABI void
40extern template LLVM_TEMPLATE_ABI bool
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
56
57 /// Handle invalidation explicitly.
58 LLVM_ABI bool invalidate(MachineFunction &, const PreservedAnalyses &PA,
59 MachineFunctionAnalysisManager::Invalidator &);
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
82
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
#define LLVM_ABI
Definition Compiler.h:213
#define LLVM_TEMPLATE_ABI
Definition Compiler.h:214
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.
void recalculate(ParentType &Func)
LLVM_ABI Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
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
bool Verify(const DomTreeT &DT, typename DomTreeT::VerificationLevel VL)
void DeleteEdge(DomTreeT &DT, typename DomTreeT::NodePtr From, typename DomTreeT::NodePtr To)
GraphDiff< MachineBasicBlock *, true > MBBPostDomTreeGraphDiff
void ApplyUpdates(DomTreeT &DT, GraphDiff< typename DomTreeT::NodePtr, DomTreeT::IsPostDominator > &PreViewCFG, GraphDiff< typename DomTreeT::NodePtr, DomTreeT::IsPostDominator > *PostViewCFG)
void InsertEdge(DomTreeT &DT, typename DomTreeT::NodePtr From, typename DomTreeT::NodePtr To)
PostDomTreeBase< MachineBasicBlock > MBBPostDomTree
This is an optimization pass for GlobalISel generic memory operations.
Printable print(const GCNRegPressure &RP, const GCNSubtarget *ST=nullptr, unsigned DynamicVGPRBlockSize=0)
DominatorTreeBase< T, true > PostDomTreeBase
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
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