24 #define DEBUG_TYPE "wasm-exception-info" 29 "WebAssembly Exception Information",
true,
true)
36 LLVM_DEBUG(
dbgs() <<
"********** Exception Info Calculation **********\n" 37 "********** Function: " 38 << MF.getName() <<
'\n');
40 auto &MDT = getAnalysis<MachineDominatorTree>();
41 auto &MDF = getAnalysis<MachineDominanceFrontier>();
42 recalculate(MDT, MDF);
59 discoverAndMapException(WE, MDT, MDF);
72 for (
auto *WE : Exceptions) {
73 if (WE->getParentException())
74 WE->getParentException()->getSubExceptions().push_back(WE);
81 for (
auto *WE : Exceptions) {
83 std::reverse(WE->getSubExceptions().begin(), WE->getSubExceptions().end());
90 TopLevelExceptions.clear();
100 void WebAssemblyExceptionInfo::discoverAndMapException(
103 unsigned NumBlocks = 0;
104 unsigned NumSubExceptions = 0;
112 "Catch terminate pad has more than one successors");
120 while (!WL.
empty()) {
167 OS.
indent(Depth * 2) <<
"Exception at depth " << getExceptionDepth()
170 for (
unsigned I = 0;
I < getBlocks().size(); ++
I) {
177 OS <<
"." << BB->getName();
179 if (getEHPad() == MBB)
180 OS <<
" (landing-pad)";
184 for (
auto &SubE : SubExceptions)
185 SubE->print(OS, Depth + 2);
188 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 198 for (
auto *WE : TopLevelExceptions)
void DeleteContainerPointers(Container &C)
For a container of pointers, deletes the pointers and then clears the container.
This class represents lattice values for constants.
A Module instance is used to store all the information related to an LLVM module. ...
void print(raw_ostream &OS, unsigned Depth=0) const
void push_back(const T &Elt)
void print(raw_ostream &OS, const Module *M=nullptr) const override
print - Print out the internal state of the pass.
raw_ostream & indent(unsigned NumSpaces)
indent - Insert 'NumSpaces' spaces.
iterator_range< succ_iterator > successors()
void recalculate(MachineDominatorTree &MDT, const MachineDominanceFrontier &MDF)
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
WebAssembly Exception true
std::vector< MachineBasicBlock * > & getBlocksVector()
auto reverse(ContainerTy &&C, typename std::enable_if< has_rbegin< ContainerTy >::value >::type *=nullptr) -> decltype(make_range(C.rbegin(), C.rend()))
void addBlock(MachineBasicBlock *MBB)
int getNumber() const
MachineBasicBlocks are uniquely numbered at the function level, unless they're not in a MachineFuncti...
This file implements WebAssemblyException information analysis.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
This file contains the declaration of the WebAssembly-specific utility functions. ...
void changeExceptionFor(MachineBasicBlock *MBB, WebAssemblyException *WE)
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
This file provides WebAssembly-specific target descriptions.
MachineBasicBlock * getEHPad() const
Represent the analysis usage information of a pass.
iterator_range< po_iterator< T > > post_order(const T &G)
succ_iterator succ_begin()
void addTopLevelException(WebAssemblyException *WE)
INITIALIZE_PASS_BEGIN(WebAssemblyExceptionInfo, DEBUG_TYPE, "WebAssembly Exception Information", true, true) INITIALIZE_PASS_END(WebAssemblyExceptionInfo
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
WebAssemblyException * getExceptionFor(const MachineBasicBlock *MBB) const
iterator find(MachineBasicBlock *B)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
bool dominates(const MachineDomTreeNode *A, const MachineDomTreeNode *B) const
void setParentException(WebAssemblyException *WE)
bool isCatchTerminatePad(const MachineBasicBlock &MBB)
Returns if the given BB is a single BB terminate pad which starts with a 'catch' instruction.
LLVM_NODISCARD T pop_back_val()
WebAssemblyException * getParentException() const
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void setPreservesAll()
Set by analyses that do not transform their input at all.
unsigned succ_size() const
void reserveBlocks(unsigned Size)
bool isEHPad() const
Returns true if the block is a landing pad.
LLVM_NODISCARD bool empty() const
const BasicBlock * getBasicBlock() const
Return the LLVM basic block that this instance corresponded to originally.
WebAssembly Exception Information
const std::vector< WebAssemblyException * > & getSubExceptions() const
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This class implements an extremely fast bulk output stream that can only output to a stream...
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
bool isCatchAllTerminatePad(const MachineBasicBlock &MBB)
Returns if the given BB is a single BB terminate pad which starts with a 'catch_all' insrtruction...