/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/Target/WebAssembly/WebAssemblyUtilities.h
Line | Count | Source |
1 | | //===-- WebAssemblyUtilities - WebAssembly Utility Functions ---*- C++ -*-====// |
2 | | // |
3 | | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | | // See https://llvm.org/LICENSE.txt for license information. |
5 | | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | | // |
7 | | //===----------------------------------------------------------------------===// |
8 | | /// |
9 | | /// \file |
10 | | /// This file contains the declaration of the WebAssembly-specific |
11 | | /// utility functions. |
12 | | /// |
13 | | //===----------------------------------------------------------------------===// |
14 | | |
15 | | #ifndef LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYUTILITIES_H |
16 | | #define LLVM_LIB_TARGET_WEBASSEMBLY_WEBASSEMBLYUTILITIES_H |
17 | | |
18 | | #include "llvm/CodeGen/MachineBasicBlock.h" |
19 | | |
20 | | namespace llvm { |
21 | | |
22 | | class WebAssemblyFunctionInfo; |
23 | | |
24 | | namespace WebAssembly { |
25 | | |
26 | | bool isChild(const MachineInstr &MI, const WebAssemblyFunctionInfo &MFI); |
27 | | bool mayThrow(const MachineInstr &MI); |
28 | | |
29 | | // Exception-related function names |
30 | | extern const char *const ClangCallTerminateFn; |
31 | | extern const char *const CxaBeginCatchFn; |
32 | | extern const char *const CxaRethrowFn; |
33 | | extern const char *const StdTerminateFn; |
34 | | extern const char *const PersonalityWrapperFn; |
35 | | |
36 | | /// Return the "bottom" block of an entity, which can be either a MachineLoop or |
37 | | /// WebAssemblyException. This differs from MachineLoop::getBottomBlock in that |
38 | | /// it works even if the entity is discontiguous. |
39 | 161 | template <typename T> MachineBasicBlock *getBottom(const T *Unit) { |
40 | 161 | MachineBasicBlock *Bottom = Unit->getHeader(); |
41 | 161 | for (MachineBasicBlock *MBB : Unit->blocks()) |
42 | 547 | if (MBB->getNumber() > Bottom->getNumber()) |
43 | 268 | Bottom = MBB; |
44 | 161 | return Bottom; |
45 | 161 | } llvm::MachineBasicBlock* llvm::WebAssembly::getBottom<llvm::MachineLoop>(llvm::MachineLoop const*) Line | Count | Source | 39 | 90 | template <typename T> MachineBasicBlock *getBottom(const T *Unit) { | 40 | 90 | MachineBasicBlock *Bottom = Unit->getHeader(); | 41 | 90 | for (MachineBasicBlock *MBB : Unit->blocks()) | 42 | 247 | if (MBB->getNumber() > Bottom->getNumber()) | 43 | 114 | Bottom = MBB; | 44 | 90 | return Bottom; | 45 | 90 | } |
llvm::MachineBasicBlock* llvm::WebAssembly::getBottom<llvm::WebAssemblyException>(llvm::WebAssemblyException const*) Line | Count | Source | 39 | 71 | template <typename T> MachineBasicBlock *getBottom(const T *Unit) { | 40 | 71 | MachineBasicBlock *Bottom = Unit->getHeader(); | 41 | 71 | for (MachineBasicBlock *MBB : Unit->blocks()) | 42 | 300 | if (MBB->getNumber() > Bottom->getNumber()) | 43 | 154 | Bottom = MBB; | 44 | 71 | return Bottom; | 45 | 71 | } |
|
46 | | |
47 | | } // end namespace WebAssembly |
48 | | |
49 | | } // end namespace llvm |
50 | | |
51 | | #endif |