/src/WasmEdge/include/driver/options.h
Line | Count | Source |
1 | | // SPDX-License-Identifier: Apache-2.0 |
2 | | // SPDX-FileCopyrightText: Copyright The WasmEdge Authors |
3 | | |
4 | | //===-- wasmedge/driver/options.h - Shared option definitions -------------===// |
5 | | // |
6 | | // Part of the WasmEdge Project. |
7 | | // |
8 | | //===----------------------------------------------------------------------===// |
9 | | /// |
10 | | /// \file |
11 | | /// This file contains the shared proposal options base struct used by both |
12 | | /// the runtime tool and the compiler tool. |
13 | | /// |
14 | | //===----------------------------------------------------------------------===// |
15 | | #pragma once |
16 | | #include "common/configure.h" |
17 | | #include "po/argument_parser.h" |
18 | | #include <string_view> |
19 | | |
20 | | namespace WasmEdge { |
21 | | namespace Driver { |
22 | | |
23 | | using namespace std::literals; |
24 | | |
25 | | struct DriverProposalOptions { |
26 | | DriverProposalOptions() |
27 | 0 | : PropWASM1(PO::Description("Set as WASM 1.0 standard."sv)), |
28 | 0 | PropWASM2(PO::Description("Set as WASM 2.0 standard."sv)), |
29 | 0 | PropWASM3(PO::Description("Set as WASM 3.0 standard (default)."sv)), |
30 | 0 | PropMutGlobals(PO::Description( |
31 | 0 | "Disable Import/Export of mutable globals proposal"sv)), |
32 | 0 | PropNonTrapF2IConvs(PO::Description( |
33 | 0 | "Disable Non-trapping float-to-int conversions proposal"sv)), |
34 | 0 | PropSignExtendOps( |
35 | 0 | PO::Description("Disable Sign-extension operators proposal"sv)), |
36 | 0 | PropMultiValue(PO::Description("Disable Multi-value proposal"sv)), |
37 | 0 | PropBulkMemOps( |
38 | 0 | PO::Description("Disable Bulk memory operations proposal"sv)), |
39 | 0 | PropRefTypes(PO::Description("Disable Reference types proposal"sv)), |
40 | 0 | PropSIMD(PO::Description("Disable SIMD proposal"sv)), |
41 | 0 | PropTailCall(PO::Description("Disable Tail-call proposal"sv)), |
42 | 0 | PropExtendConst(PO::Description("Disable Extended-const proposal"sv)), |
43 | 0 | PropFunctionReference( |
44 | 0 | PO::Description("Disable Function Reference proposal"sv)), |
45 | 0 | PropGC(PO::Description("Disable GC proposal"sv)), |
46 | 0 | PropMultiMem(PO::Description("Disable Multiple memories proposal"sv)), |
47 | 0 | PropRelaxedSIMD(PO::Description("Disable Relaxed SIMD proposal"sv)), |
48 | 0 | PropTailCallDeprecated(PO::Description( |
49 | 0 | "(DEPRECATED) Enable Tail-call proposal. WASM 3.0 includes this " |
50 | 0 | "proposal, and this option will be removed in the future."sv)), |
51 | 0 | PropExtendConstDeprecated(PO::Description( |
52 | 0 | "(DEPRECATED) Enable Extended-const proposal. WASM 3.0 includes " |
53 | 0 | "this proposal, and this option will be removed in the future."sv)), |
54 | 0 | PropFunctionReferenceDeprecated(PO::Description( |
55 | 0 | "(DEPRECATED) Enable Function Reference proposal. WASM 3.0 " |
56 | 0 | "includes this proposal, and this option will be removed in the " |
57 | 0 | "future."sv)), |
58 | 0 | PropGCDeprecated(PO::Description( |
59 | 0 | "(DEPRECATED) Enable GC proposal. WASM 3.0 includes this proposal, " |
60 | 0 | "and this option will be removed in the future."sv)), |
61 | 0 | PropMultiMemDeprecated(PO::Description( |
62 | 0 | "(DEPRECATED) Enable Multiple memories proposal. WASM 3.0 includes " |
63 | 0 | "this proposal, and this option will be removed in the future."sv)), |
64 | 0 | PropRelaxedSIMDDeprecated(PO::Description( |
65 | 0 | "(DEPRECATED) Enable Relaxed SIMD proposal. WASM 3.0 includes this " |
66 | 0 | "proposal, and this option will be removed in the future."sv)), |
67 | 0 | PropMemory64(PO::Description("Disable Memory64 proposal"sv)), |
68 | 0 | PropThreads(PO::Description("Enable Threads proposal"sv)), |
69 | 0 | PropAll(PO::Description("Enable all features"sv)) {} |
70 | | |
71 | | PO::Option<PO::Toggle> PropWASM1; |
72 | | PO::Option<PO::Toggle> PropWASM2; |
73 | | PO::Option<PO::Toggle> PropWASM3; |
74 | | PO::Option<PO::Toggle> PropMutGlobals; |
75 | | PO::Option<PO::Toggle> PropNonTrapF2IConvs; |
76 | | PO::Option<PO::Toggle> PropSignExtendOps; |
77 | | PO::Option<PO::Toggle> PropMultiValue; |
78 | | PO::Option<PO::Toggle> PropBulkMemOps; |
79 | | PO::Option<PO::Toggle> PropRefTypes; |
80 | | PO::Option<PO::Toggle> PropSIMD; |
81 | | PO::Option<PO::Toggle> PropTailCall; |
82 | | PO::Option<PO::Toggle> PropExtendConst; |
83 | | PO::Option<PO::Toggle> PropFunctionReference; |
84 | | PO::Option<PO::Toggle> PropGC; |
85 | | PO::Option<PO::Toggle> PropMultiMem; |
86 | | PO::Option<PO::Toggle> PropRelaxedSIMD; |
87 | | PO::Option<PO::Toggle> PropTailCallDeprecated; |
88 | | PO::Option<PO::Toggle> PropExtendConstDeprecated; |
89 | | PO::Option<PO::Toggle> PropFunctionReferenceDeprecated; |
90 | | PO::Option<PO::Toggle> PropGCDeprecated; |
91 | | PO::Option<PO::Toggle> PropMultiMemDeprecated; |
92 | | PO::Option<PO::Toggle> PropRelaxedSIMDDeprecated; |
93 | | PO::Option<PO::Toggle> PropMemory64; |
94 | | PO::Option<PO::Toggle> PropThreads; |
95 | | PO::Option<PO::Toggle> PropAll; |
96 | | |
97 | 0 | void addProposalOptions(PO::ArgumentParser &Parser) noexcept { |
98 | 0 | Parser.add_option("wasm-1"sv, PropWASM1) |
99 | 0 | .add_option("wasm-2"sv, PropWASM2) |
100 | 0 | .add_option("wasm-3"sv, PropWASM3) |
101 | 0 | .add_option("disable-import-export-mut-globals"sv, PropMutGlobals) |
102 | 0 | .add_option("disable-non-trap-float-to-int"sv, PropNonTrapF2IConvs) |
103 | 0 | .add_option("disable-sign-extension-operators"sv, PropSignExtendOps) |
104 | 0 | .add_option("disable-multi-value"sv, PropMultiValue) |
105 | 0 | .add_option("disable-bulk-memory"sv, PropBulkMemOps) |
106 | 0 | .add_option("disable-reference-types"sv, PropRefTypes) |
107 | 0 | .add_option("disable-simd"sv, PropSIMD) |
108 | 0 | .add_option("disable-tail-call"sv, PropTailCall) |
109 | 0 | .add_option("disable-extended-const"sv, PropExtendConst) |
110 | 0 | .add_option("disable-function-reference"sv, PropFunctionReference) |
111 | 0 | .add_option("disable-gc"sv, PropGC) |
112 | 0 | .add_option("disable-multi-memory"sv, PropMultiMem) |
113 | 0 | .add_option("disable-relaxed-simd"sv, PropRelaxedSIMD) |
114 | 0 | .add_option("enable-tail-call"sv, PropTailCallDeprecated) |
115 | 0 | .add_option("enable-extended-const"sv, PropExtendConstDeprecated) |
116 | 0 | .add_option("enable-function-reference"sv, |
117 | 0 | PropFunctionReferenceDeprecated) |
118 | 0 | .add_option("enable-gc"sv, PropGCDeprecated) |
119 | 0 | .add_option("enable-multi-memory"sv, PropMultiMemDeprecated) |
120 | 0 | .add_option("enable-relaxed-simd"sv, PropRelaxedSIMDDeprecated) |
121 | 0 | .add_option("disable-memory64"sv, PropMemory64) |
122 | 0 | .add_option("enable-threads"sv, PropThreads) |
123 | 0 | .add_option("enable-all"sv, PropAll); |
124 | 0 | } |
125 | | }; |
126 | | |
127 | | Configure |
128 | | createProposalConfigure(const struct DriverProposalOptions &Opt) noexcept; |
129 | | |
130 | | } // namespace Driver |
131 | | } // namespace WasmEdge |