23 #define DEBUG_TYPE "wasm-exception-info" 28 "WebAssembly Exception Information",
true,
true)
35 LLVM_DEBUG(
dbgs() <<
"********** Exception Info Calculation **********\n" 36 "********** Function: " 37 << MF.getName() <<
'\n');
39 auto &MDT = getAnalysis<MachineDominatorTree>();
40 auto &MDF = getAnalysis<MachineDominanceFrontier>();
41 recalculate(MDT, MDF);
54 discoverAndMapException(WE, MDT, MDF);
67 for (
auto *WE : Exceptions) {
68 if (WE->getParentException())
69 WE->getParentException()->getSubExceptions().push_back(WE);
76 for (
auto *WE : Exceptions) {
78 std::reverse(WE->getSubExceptions().begin(), WE->getSubExceptions().end());
85 TopLevelExceptions.clear();
95 void WebAssemblyExceptionInfo::discoverAndMapException(
98 unsigned NumBlocks = 0;
99 unsigned NumSubExceptions = 0;
105 while (!WL.
empty()) {
152 OS.
indent(Depth * 2) <<
"Exception at depth " << getExceptionDepth()
155 for (
unsigned I = 0;
I < getBlocks().size(); ++
I) {
162 OS <<
"." << BB->getName();
164 if (getEHPad() == MBB)
165 OS <<
" (landing-pad)";
169 for (
auto &SubE : SubExceptions)
170 SubE->print(OS, Depth + 2);
173 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 183 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.
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
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)
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)
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.
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)
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...