LLVM: lib/Target/WebAssembly/WebAssemblyExceptionInfo.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYEXCEPTIONINFO_H
15#define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYEXCEPTIONINFO_H
16
20
21namespace llvm {
22
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
44
46 std::vector<std::unique_ptr> SubExceptions;
47 std::vector<MachineBasicBlock *> Blocks;
49
50public:
54
59
61 if (WE == this)
62 return true;
63 if (!WE)
64 return false;
66 }
68 return BlockSet.count(MBB);
69 }
70
75 Blocks.push_back(MBB);
76 BlockSet.insert(MBB);
77 }
85 unsigned getNumBlocks() const { return Blocks.size(); }
86 std::vector<MachineBasicBlock *> &getBlocksVector() { return Blocks; }
88
89 const std::vector<std::unique_ptr> &
91 return SubExceptions;
92 }
93 std::vector<std::unique_ptr> &getSubExceptions() {
94 return SubExceptions;
95 }
97 SubExceptions.push_back(std::move(E));
98 }
102
105 std::reverse(Blocks.begin() + From, Blocks.end());
106 }
107
108
110 unsigned D = 1;
112 CurException; CurException = CurException->ParentException)
113 ++D;
114 return D;
115 }
116
118 void dump() const;
119};
120
122
124
126 std::vector<std::unique_ptr> TopLevelExceptions;
127
132
133public:
140
146
147 bool empty() const { return TopLevelExceptions.empty(); }
148
149
150
152 return BBMap.lookup(MBB);
153 }
154
157 if (!WE) {
158 BBMap.erase(MBB);
159 return;
160 }
161 BBMap[MBB] = WE;
162 }
163
165 assert(!WE->getParentException() && "Not a top level exception!");
166 TopLevelExceptions.push_back(std::move(WE));
167 }
168
170};
171
172}
173
174#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file defines the SmallPtrSet class.
This file contains the entry points for global functions defined in the LLVM WebAssembly back-end.
Represent the analysis usage information of a pass.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
const_pointer const_iterator
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
MachineFunctionPass(char &ID)
A Module instance is used to store all the information related to an LLVM module.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
WebAssemblyExceptionInfo()
Definition WebAssemblyExceptionInfo.h:135
bool empty() const
Definition WebAssemblyExceptionInfo.h:147
~WebAssemblyExceptionInfo() override
Definition WebAssemblyExceptionInfo.h:136
static char ID
Definition WebAssemblyExceptionInfo.h:134
void changeExceptionFor(const MachineBasicBlock *MBB, WebAssemblyException *WE)
Definition WebAssemblyExceptionInfo.h:155
bool runOnMachineFunction(MachineFunction &) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
void addTopLevelException(std::unique_ptr< WebAssemblyException > WE)
Definition WebAssemblyExceptionInfo.h:164
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
void recalculate(MachineFunction &MF, MachineDominatorTree &MDT, const MachineDominanceFrontier &MDF)
WebAssemblyException * getExceptionFor(const MachineBasicBlock *MBB) const
Definition WebAssemblyExceptionInfo.h:151
void print(raw_ostream &OS, const Module *M=nullptr) const override
print - Print out the internal state of the pass.
WebAssemblyExceptionInfo & operator=(const WebAssemblyExceptionInfo &)=delete
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
WebAssemblyExceptionInfo(const WebAssemblyExceptionInfo &)=delete
void reverseBlock(unsigned From=0)
Definition WebAssemblyExceptionInfo.h:104
block_iterator block_end() const
Definition WebAssemblyExceptionInfo.h:81
void print(raw_ostream &OS, unsigned Depth=0) const
bool contains(const WebAssemblyException *WE) const
Definition WebAssemblyExceptionInfo.h:60
WebAssemblyException(const WebAssemblyException &)=delete
unsigned getNumBlocks() const
Definition WebAssemblyExceptionInfo.h:85
MachineBasicBlock * getEHPad() const
Definition WebAssemblyExceptionInfo.h:55
void addToBlocksSet(MachineBasicBlock *MBB)
Definition WebAssemblyExceptionInfo.h:71
iterator begin() const
Definition WebAssemblyExceptionInfo.h:100
iterator end() const
Definition WebAssemblyExceptionInfo.h:101
bool contains(const MachineBasicBlock *MBB) const
Definition WebAssemblyExceptionInfo.h:67
iterator_range< block_iterator > blocks() const
Definition WebAssemblyExceptionInfo.h:82
void reserveBlocks(unsigned Size)
Definition WebAssemblyExceptionInfo.h:103
const std::vector< std::unique_ptr< WebAssemblyException > > & getSubExceptions() const
Definition WebAssemblyExceptionInfo.h:90
SmallPtrSetImpl< MachineBasicBlock * > & getBlocksSet()
Definition WebAssemblyExceptionInfo.h:87
block_iterator block_begin() const
Definition WebAssemblyExceptionInfo.h:80
decltype(SubExceptions)::const_iterator iterator
Definition WebAssemblyExceptionInfo.h:99
ArrayRef< MachineBasicBlock * >::const_iterator block_iterator
Definition WebAssemblyExceptionInfo.h:79
std::vector< std::unique_ptr< WebAssemblyException > > & getSubExceptions()
Definition WebAssemblyExceptionInfo.h:93
void addSubException(std::unique_ptr< WebAssemblyException > E)
Definition WebAssemblyExceptionInfo.h:96
ArrayRef< MachineBasicBlock * > getBlocks() const
Definition WebAssemblyExceptionInfo.h:78
std::vector< MachineBasicBlock * > & getBlocksVector()
Definition WebAssemblyExceptionInfo.h:86
WebAssemblyException * getParentException() const
Definition WebAssemblyExceptionInfo.h:57
void removeFromBlocksSet(MachineBasicBlock *MBB)
Definition WebAssemblyExceptionInfo.h:72
WebAssemblyException(MachineBasicBlock *EHPad)
Definition WebAssemblyExceptionInfo.h:51
void addBlock(MachineBasicBlock *MBB)
Definition WebAssemblyExceptionInfo.h:74
unsigned getExceptionDepth() const
Definition WebAssemblyExceptionInfo.h:109
MachineBasicBlock * getHeader() const
Definition WebAssemblyExceptionInfo.h:56
void setParentException(WebAssemblyException *WE)
Definition WebAssemblyExceptionInfo.h:58
void addToBlocksVector(MachineBasicBlock *MBB)
Definition WebAssemblyExceptionInfo.h:73
const WebAssemblyException & operator=(const WebAssemblyException &)=delete
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)