LLVM 23.0.0git
MachineRegionInfo.h
Go to the documentation of this file.
1//===- llvm/CodeGen/MachineRegionInfo.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#ifndef LLVM_CODEGEN_MACHINEREGIONINFO_H
10#define LLVM_CODEGEN_MACHINEREGIONINFO_H
11
21#include <cassert>
22
23namespace llvm {
24
26class MachineRegion;
29
48
49class MachineRegionNode : public RegionNodeBase<RegionTraits<MachineFunction>> {
50public:
52 bool isSubRegion = false)
54 isSubRegion) {}
55
56 bool operator==(const MachineRegion &RN) const {
57 return this == reinterpret_cast<const MachineRegionNode *>(&RN);
58 }
59};
60
61class MachineRegion : public RegionBase<RegionTraits<MachineFunction>> {
62public:
65 MachineRegion *Parent = nullptr);
67
68 bool operator==(const MachineRegionNode &RN) const {
69 return &RN == reinterpret_cast<const MachineRegionNode *>(this);
70 }
71};
72
74 : public RegionInfoBase<RegionTraits<MachineFunction>> {
75public:
78
79 // updateStatistics - Update statistic about created regions.
80 void updateStatistics(MachineRegion *R) final;
81
84};
85
88
89public:
90 static char ID;
91
92 explicit MachineRegionInfoPass();
94
96
97 const MachineRegionInfo &getRegionInfo() const { return RI; }
98
99 /// @name MachineFunctionPass interface
100 //@{
101 bool runOnMachineFunction(MachineFunction &F) override;
102 void releaseMemory() override;
103 void verifyAnalysis() const override;
104 void getAnalysisUsage(AnalysisUsage &AU) const override;
105 void print(raw_ostream &OS, const Module *) const override;
106 void dump() const;
107 //@}
108};
109
110template <>
111template <>
114 const {
115 assert(!isSubRegion() && "This is not a MachineBasicBlock RegionNode!");
116 return getEntry();
117}
118
119template <>
120template <>
123 const {
124 assert(isSubRegion() && "This is not a subregion RegionNode!");
125 auto Unconst =
127 return reinterpret_cast<MachineRegion *>(Unconst);
128}
129
133
136
137template <>
156
157template <>
175
176extern template class RegionBase<RegionTraits<MachineFunction>>;
177extern template class RegionNodeBase<RegionTraits<MachineFunction>>;
178extern template class RegionInfoBase<RegionTraits<MachineFunction>>;
179
180} // end namespace llvm
181
182#endif // LLVM_CODEGEN_MACHINEREGIONINFO_H
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
#define LLVM_ABI
Definition Compiler.h:213
This file builds on the ADT/GraphTraits.h file to build generic depth first graph iterator.
#define F(x, y, z)
Definition MD5.cpp:54
#define RegionNodeGraphTraits(NodeT, BlockT, RegionT)
#define RegionGraphTraits(RegionT, NodeT)
Represent the analysis usage information of a pass.
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
Representation of each machine instruction.
MachinePostDominatorTree - an analysis pass wrapper for DominatorTree used to compute the post-domina...
MachineRegionInfo & getRegionInfo()
const MachineRegionInfo & getRegionInfo() const
~MachineRegionInfo() override
void recalculate(MachineFunction &F, MachineDominatorTree *DT, MachinePostDominatorTree *PDT, MachineDominanceFrontier *DF)
void updateStatistics(MachineRegion *R) final
bool operator==(const MachineRegion &RN) const
MachineRegionNode(MachineRegion *Parent, MachineBasicBlock *Entry, bool isSubRegion=false)
LLVM_ABI ~MachineRegion()
LLVM_ABI MachineRegion(MachineBasicBlock *Entry, MachineBasicBlock *Exit, MachineRegionInfo *RI, MachineDominatorTree *DT, MachineRegion *Parent=nullptr)
bool operator==(const MachineRegionNode &RN) const
A Module instance is used to store all the information related to an LLVM module.
Definition Module.h:68
RegionBase(BlockT *Entry, BlockT *Exit, RegionInfoT *RI, DomTreeT *DT, RegionT *Parent=nullptr)
RegionT * getTopLevelRegion() const
Definition RegionInfo.h:864
RegionNodeBase(RegionT *Parent, BlockT *Entry, bool isSubRegion=false)
Definition RegionInfo.h:148
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.
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
DomTreeNodeBase< MachineBasicBlock > MachineDomTreeNode
static NodeRef getEntryNode(MachineRegionInfoPass *RI)
df_iterator< NodeRef, df_iterator_default_set< NodeRef >, false, GraphTraits< FlatIt< NodeRef > > > nodes_iterator
static nodes_iterator nodes_end(MachineRegionInfoPass *RI)
static nodes_iterator nodes_begin(MachineRegionInfoPass *RI)
df_iterator< NodeRef, df_iterator_default_set< NodeRef >, false, GraphTraits< FlatIt< NodeRef > > > nodes_iterator
static nodes_iterator nodes_end(MachineRegionInfo *RI)
static NodeRef getEntryNode(MachineRegionInfo *RI)
static nodes_iterator nodes_begin(MachineRegionInfo *RI)
typename MachineRegionInfo *::UnknownGraphTypeError NodeRef
Definition GraphTraits.h:95
static unsigned getNumSuccessors(MachineBasicBlock *BB)