//===-- CodeGen/AsmPrinter/WasmException.cpp - Wasm Exception Impl --------===// // // 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 // //===----------------------------------------------------------------------===// // // This file contains support for writing WebAssembly exception info into asm // files. // //===----------------------------------------------------------------------===// #include "WasmException.h" #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/IR/Mangler.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCStreamer.h" usingnamespacellvm; void WasmException::endModule() { … } void WasmException::endFunction(const MachineFunction *MF) { … } // Compute the call-site table for wasm EH. Even though we use the same function // name to share the common routines, a call site entry in the table corresponds // to not a call site for possibly-throwing functions but a landing pad. In wasm // EH the VM is responsible for stack unwinding. After an exception occurs and // the stack is unwound, the control flow is transferred to wasm 'catch' // instruction by the VM, after which the personality function is called from // the compiler-generated code. Refer to WasmEHPrepare pass for more // information. void WasmException::computeCallSiteTable( SmallVectorImpl<CallSiteEntry> &CallSites, SmallVectorImpl<CallSiteRange> &CallSiteRanges, const SmallVectorImpl<const LandingPadInfo *> &LandingPads, const SmallVectorImpl<unsigned> &FirstActions) { … }