• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "driver_options.h"
17 
18 #include <cstdint>
19 
20 namespace opts::cg {
21 
22 maplecl::Option<bool> verboseAsm({"--verbose-asm"},
23                                  "  --verbose-asm               \tAdd comments to asm output\n"
24                                  "  --no-verbose-asm\n",
25                                  {cgCategory}, maplecl::DisableWith("--no-verbose-asm"));
26 
27 maplecl::Option<bool> verboseCg({"--verbose-cg"},
28                                 "  --verbose-cg               \tAdd comments to cg output\n"
29                                 "  --no-verbose-cg\n",
30                                 {cgCategory}, maplecl::DisableWith("--no-verbose-cg"));
31 
32 maplecl::Option<bool> cg({"--cg"},
33                          "  --cg                        \tGenerate the output .s file\n"
34                          "  --no-cg\n",
35                          {cgCategory}, maplecl::DisableWith("--no-cg"));
36 
37 maplecl::Option<bool> supportFuncSymbol({"--enable-func-symbol"},
38                                 "  --enable-func-symbol               \tenable function symbols in symbol table\n"
39                                 "  --disable-func-symbol\n",
40                                 {cgCategory}, maplecl::DisableWith("--disable-func-symbol"));
41 
42 maplecl::Option<bool> generalRegOnly(
43     {"--general-reg-only"},
44     " --general-reg-only           \tdisable floating-point or Advanced SIMD registers\n"
45     " --no-general-reg-only\n",
46     {cgCategory}, maplecl::DisableWith("--no-general-reg-only"));
47 
48 maplecl::Option<bool> lazyBinding({"--lazy-binding"},
49                                   "  --lazy-binding              \tBind class symbols lazily[default off]\n",
50                                   {cgCategory}, maplecl::DisableWith("--no-lazy-binding"));
51 
52 maplecl::Option<bool> hotFix({"--hot-fix"},
53                              "  --hot-fix                   \tOpen for App hot fix[default off]\n"
54                              "  --no-hot-fix\n",
55                              {cgCategory}, maplecl::DisableWith("--no-hot-fix"));
56 
57 maplecl::Option<bool> yieldpoint({"--yieldpoint"},
58                                  "  --yieldpoint                \tGenerate yieldpoints [default]\n"
59                                  "  --no-yieldpoint\n",
60                                  {cgCategory}, maplecl::DisableWith("--no-yieldpoint"));
61 
62 maplecl::Option<bool> localRc({"--local-rc"},
63                               "  --local-rc                  \tHandle Local Stack RC [default]\n"
64                               "  --no-local-rc\n",
65                               {cgCategory}, maplecl::DisableWith("--no-local-rc"));
66 
67 maplecl::Option<bool> debug({"-g", "--g"}, "  -g                          \tGenerate debug information\n",
68                             {cgCategory});
69 
70 maplecl::Option<bool> gdwarf({"--gdwarf"}, "  --gdwarf                    \tGenerate dwarf infomation\n", {cgCategory});
71 
72 maplecl::Option<bool> gsrc(
73     {"--gsrc"}, "  --gsrc                      \tUse original source file instead of mpl file for debugging\n",
74     {cgCategory});
75 
76 maplecl::Option<bool> gmixedsrc({"--gmixedsrc"},
77                                 "  --gmixedsrc"
78                                 "                 \tUse both original source file and mpl file for debugging\n",
79                                 {cgCategory});
80 
81 maplecl::Option<bool> gmixedasm({"--gmixedasm"},
82                                 "  --gmixedasm"
83                                 "                 \tComment out both original source file and mpl file for debugging\n",
84                                 {cgCategory});
85 
86 maplecl::Option<bool> withRaLinearScan({"--with-ra-linear-scan"},
87                                        "  --with-ra-linear-scan       \tDo linear-scan register allocation\n",
88                                        {cgCategory});
89 
90 maplecl::Option<uint64_t> lsraBb({"--lsra-bb"},
91                                  "  --lsra-bb=NUM"
92                                  "               \tSwitch to spill mode if number of bb in function exceeds NUM\n",
93                                  {cgCategory});
94 
95 maplecl::Option<uint64_t> lsraInsn(
96     {"--lsra-insn"},
97     "  --lsra-insn=NUM"
98     "             \tSwitch to spill mode if number of instructons in function exceeds NUM\n",
99     {cgCategory});
100 
101 maplecl::Option<uint64_t> lsraOverlap({"--lsra-overlap"},
102                                       "  --lsra-overlap=NUM          \toverlap NUM to decide pre spill in lsra\n",
103                                       {cgCategory});
104 
105 maplecl::Option<bool> suppressFileinfo({"--suppress-fileinfo"},
106                                        "  --suppress-fileinfo         \tFor generating gold files in unit testing\n",
107                                        {cgCategory});
108 
109 maplecl::Option<bool> dumpCfg({"--dump-cfg"}, "  --dump-cfg\n", {cgCategory});
110 
111 maplecl::Option<std::string> target({"--target"}, "  --target=TARGETMACHINE \t generate code for TARGETMACHINE\n",
112                                     {cgCategory}, maplecl::optionalValue);
113 
114 maplecl::Option<std::string> dumpPhases({"--dump-phases"},
115                                         "  --dump-phases=PHASENAME,..."
116                                         " \tEnable debug trace for specified phases in the comma separated list\n",
117                                         {cgCategory});
118 
119 maplecl::Option<std::string> skipPhases({"--skip-phases"},
120                                         "  --skip-phases=PHASENAME,..."
121                                         " \tSkip the phases specified in the comma separated list\n",
122                                         {cgCategory});
123 
124 maplecl::Option<std::string> skipFrom({"--skip-from"},
125                                       "  --skip-from=PHASENAME       \tSkip the rest phases from PHASENAME(included)\n",
126                                       {cgCategory});
127 
128 maplecl::Option<std::string> skipAfter(
129     {"--skip-after"}, "  --skip-after=PHASENAME      \tSkip the rest phases after PHASENAME(excluded)\n", {cgCategory});
130 
131 maplecl::Option<std::string> dumpFunc(
132     {"--dump-func"},
133     "  --dump-func=FUNCNAME"
134     "        \tDump/trace only for functions whose names contain FUNCNAME as substring\n"
135     "                              \t(can only specify once)\n",
136     {cgCategory});
137 
138 maplecl::Option<bool> timePhases(
139     {"--time-phases"},
140     "  --time-phases               \tCollect compilation time stats for each phase\n"
141     "  --no-time-phases            \tDon't Collect compilation time stats for each phase\n",
142     {cgCategory}, maplecl::DisableWith("--no-time-phases"));
143 
144 maplecl::Option<std::string> range(
145     {"--range"}, "  --range=NUM0,NUM1           \tOptimize only functions in the range [NUM0, NUM1]\n", {cgCategory});
146 
147 maplecl::Option<std::string> spillRange(
148     {"--spill_range"}, "  --spill_range=NUM0,NUM1     \tO2 RA spill registers in the range [NUM0, NUM1]\n",
149     {cgCategory});
150 
151 maplecl::Option<bool> dupBb({"--dup-bb"},
152                             "  --dup-bb                 \tAllow cfg optimizer to duplicate bb\n"
153                             "  --no-dup-bb              \tDon't allow cfg optimizer to duplicate bb\n",
154                             {cgCategory}, maplecl::DisableWith("--no-dup-bb"));
155 
156 maplecl::Option<bool> calleeCfi({"--callee-cfi"},
157                                 "  --callee-cfi                \tcallee cfi message will be generated\n"
158                                 "  --no-callee-cfi             \tcallee cfi message will not be generated\n",
159                                 {cgCategory}, maplecl::DisableWith("--no-callee-cfi"));
160 
161 maplecl::Option<std::string> blockMarker({"--block-marker"},
162                                          "  --block-marker"
163                                          "              \tEmit block marker symbols in emitted assembly files\n",
164                                          {cgCategory});
165 
166 maplecl::Option<bool> crossLoc({"--cross-loc"},
167                                "  --cross-loc                 \tcross loc insn schedule\n"
168                                "  --no-cross-loc\n",
169                                {cgCategory}, maplecl::DisableWith("--no-cross-loc"));
170 
171 maplecl::Option<bool> omitFramePointer({"--omit-frame-pointer", "-fomit-frame-pointer"},
172                                        " --omit-frame-pointer          \t do not use frame pointer \n"
173                                        " --no-omit-frame-pointer\n",
174                                        {cgCategory, driverCategory},
175                                        maplecl::DisableEvery({"--no-omit-frame-pointer", "-fno-omit-frame-pointer"}));
176 
177 maplecl::Option<bool> tailcall({"--tailcall"},
178                                "  --tailcall                   \tDo tail call optimization\n"
179                                "  --no-tailcall\n",
180                                {cgCategory}, maplecl::DisableWith("--no-tailcall"));
181 
182 maplecl::Option<bool> cgSsa({"--cg-ssa"},
183                             "  --cg-ssa                     \tPerform cg ssa\n"
184                             "  --no-cg-ssa\n",
185                             {cgCategory}, maplecl::DisableWith("--no-cg-ssa"));
186 
187 maplecl::Option<uint32_t> funcAlignPow(
188     {"--func-align-pow"}, " --func-align-pow=NUM           \tO2 func bb align pow (NUM == 0, no func-align)\n",
189     {cgCategory});
190 }  // namespace opts::cg