/src/WasmEdge/include/ast/component/start.h
Line | Count | Source (jump to first uncovered line) |
1 | | // SPDX-License-Identifier: Apache-2.0 |
2 | | // SPDX-FileCopyrightText: 2019-2024 Second State INC |
3 | | |
4 | | //===-- wasmedge/ast/component/start.h - Start class definition -----------===// |
5 | | // |
6 | | // Part of the WasmEdge Project. |
7 | | // |
8 | | //===----------------------------------------------------------------------===// |
9 | | /// |
10 | | /// \file |
11 | | /// This file contains the declaration of the Start node class. |
12 | | /// |
13 | | //===----------------------------------------------------------------------===// |
14 | | #pragma once |
15 | | |
16 | | #include "ast/component/type.h" |
17 | | #include "common/span.h" |
18 | | |
19 | | #include <vector> |
20 | | |
21 | | namespace WasmEdge { |
22 | | namespace AST { |
23 | | namespace Component { |
24 | | |
25 | | // start ::= f:<funcidx> arg*:vec(<valueidx>) r:<u32> |
26 | | // => (start f (value arg)* (result (value))Ęł) |
27 | | |
28 | | /// AST Component::Start node. |
29 | | class Start { |
30 | | public: |
31 | 0 | uint32_t getFunctionIndex() const noexcept { return FuncIdx; } |
32 | 0 | uint32_t &getFunctionIndex() noexcept { return FuncIdx; } |
33 | 0 | Span<const uint32_t> getArguments() const noexcept { return Args; } |
34 | 0 | std::vector<uint32_t> &getArguments() noexcept { return Args; } |
35 | 0 | uint32_t getResult() const noexcept { return Result; } |
36 | 0 | uint32_t &getResult() noexcept { return Result; } |
37 | | |
38 | | private: |
39 | | uint32_t FuncIdx; |
40 | | std::vector<uint32_t> Args; |
41 | | uint32_t Result; |
42 | | }; |
43 | | |
44 | | } // namespace Component |
45 | | } // namespace AST |
46 | | } // namespace WasmEdge |