LLVM 20.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
18
19namespace llvm {
20
21extern template class DominatorTreeBase<MachineBasicBlock, true>; // PostDomTree
22
23namespace DomTreeBuilder {
26
27extern template void Calculate<MBBPostDomTree>(MBBPostDomTree &DT);
28extern template void InsertEdge<MBBPostDomTree>(MBBPostDomTree &DT,
31extern template void DeleteEdge<MBBPostDomTree>(MBBPostDomTree &DT,
34extern template void ApplyUpdates<MBBPostDomTree>(MBBPostDomTree &DT,
37extern template bool
38Verify<MBBPostDomTree>(const MBBPostDomTree &DT,
40} // namespace DomTreeBuilder
41
42///
43/// MachinePostDominatorTree - an analysis pass wrapper for DominatorTree
44/// used to compute the post-dominator tree for MachineFunctions.
45///
48
49public:
51
52 explicit MachinePostDominatorTree(MachineFunction &MF) { recalculate(MF); }
53
54 /// Handle invalidation explicitly.
55 bool invalidate(MachineFunction &, const PreservedAnalyses &PA,
57
58 /// Make findNearestCommonDominator(const NodeT *A, const NodeT *B) available.
59 using Base::findNearestCommonDominator;
60
61 /// Returns the nearest common dominator of the given blocks.
62 /// If that tree node is a virtual root, a nullptr will be returned.
64 findNearestCommonDominator(ArrayRef<MachineBasicBlock *> Blocks) const;
65};
66
70
71 static AnalysisKey Key;
72
73public:
75
77};
78
82
83public:
87 static bool isRequired() { return true; }
88};
89
91 std::optional<MachinePostDominatorTree> PDT;
92
93public:
94 static char ID;
95
97
99 const MachinePostDominatorTree &getPostDomTree() const { return *PDT; }
100
101 bool runOnMachineFunction(MachineFunction &MF) override;
102 void getAnalysisUsage(AnalysisUsage &AU) const override;
103 void releaseMemory() override { PDT.reset(); }
104 void verifyAnalysis() const override;
105 void print(llvm::raw_ostream &OS, const Module *M = nullptr) const override;
106};
107} //end of namespace llvm
108
109#endif
BlockVerifier::State From
DenseMap< Block *, BlockRelaxAux > Blocks
Definition: ELF_riscv.cpp:507
raw_pwrite_stream & OS
API to communicate dependencies between analyses during invalidation.
Definition: PassManager.h:292
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:253
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:65
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:111
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Printable print(const GCNRegPressure &RP, const GCNSubtarget *ST=nullptr)
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition: PassManager.h:92
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: Analysis.h:28
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:69