//===-- WebAssemblyExceptionInfo.h - WebAssembly Exception Info -*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// /// /// \file /// \brief This file implements WebAssemblyException information analysis. /// //===----------------------------------------------------------------------===// #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYEXCEPTIONINFO_H #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYEXCEPTIONINFO_H #include "WebAssembly.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/CodeGen/MachineFunctionPass.h" namespace llvm { class MachineDominatorTree; class MachineDominanceFrontier; // WebAssembly instructions for exception handling are structured as follows: // try // instructions* // catch ----| // instructions* | -> A WebAssemblyException consists of this region // end ----| // // A WebAssemblyException object contains BBs that belong to a 'catch' part of // the try-catch-end structure to be created later. 'try' and 'end' markers // are not present at this stage and will be generated in CFGStackify pass. // Because CFGSort requires all the BBs within a catch part to be sorted // together as it does for loops, this pass calculates the nesting structure of // catch part of exceptions in a function. // // An exception catch part is defined as a BB with catch instruction and all // other BBs dominated by this BB. class WebAssemblyException { … }; raw_ostream &operator<<(raw_ostream &OS, const WebAssemblyException &WE); class WebAssemblyExceptionInfo final : public MachineFunctionPass { … }; } // end namespace llvm #endif