• 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 <stdint.h>
19 #include <string>
20 
21 namespace opts::cg {
22 
23 maplecl::Option<bool> pie({"-fPIE", "--pie", "-pie"},
24                           "  --pie                       \tGenerate position-independent executable\n"
25                           "  --no-pie\n",
26                           {cgCategory, driverCategory, ldCategory}, maplecl::DisableWith("--no-pie"));
27 
28 maplecl::Option<bool> fpic({"-fPIC", "--fpic", "-fpic"},
29                            "  --fpic                      \tGenerate position-independent shared library\n"
30                            "  --no-fpic\n",
31                            {cgCategory, driverCategory, ldCategory}, maplecl::DisableWith("--no-fpic"));
32 
33 maplecl::Option<bool> verboseAsm({"--verbose-asm"},
34                                  "  --verbose-asm               \tAdd comments to asm output\n"
35                                  "  --no-verbose-asm\n",
36                                  {cgCategory}, maplecl::DisableWith("--no-verbose-asm"));
37 
38 maplecl::Option<bool> verboseCg({"--verbose-cg"},
39                                 "  --verbose-cg               \tAdd comments to cg output\n"
40                                 "  --no-verbose-cg\n",
41                                 {cgCategory}, maplecl::DisableWith("--no-verbose-cg"));
42 
43 maplecl::Option<bool> maplelinker({"--maplelinker"},
44                                   "  --maplelinker               \tGenerate the MapleLinker .s format\n"
45                                   "  --no-maplelinker\n",
46                                   {cgCategory}, maplecl::DisableWith("--no-maplelinker"));
47 
48 maplecl::Option<bool> quiet({"--quiet"},
49                             "  --quiet                     \tBe quiet (don't output debug messages)\n"
50                             "  --no-quiet\n",
51                             {cgCategory}, maplecl::DisableWith("--no-quiet"));
52 
53 maplecl::Option<bool> cg({"--cg"},
54                          "  --cg                        \tGenerate the output .s file\n"
55                          "  --no-cg\n",
56                          {cgCategory}, maplecl::DisableWith("--no-cg"));
57 
58 maplecl::Option<bool> replaceAsm({"--replaceasm"},
59                                  "  --replaceasm                \tReplace the the assembly code\n"
60                                  "  --no-replaceasm\n",
61                                  {cgCategory}, maplecl::DisableWith("--no-replaceasm"));
62 
63 maplecl::Option<bool> generalRegOnly(
64     {"--general-reg-only"},
65     " --general-reg-only           \tdisable floating-point or Advanced SIMD registers\n"
66     " --no-general-reg-only\n",
67     {cgCategory}, maplecl::DisableWith("--no-general-reg-only"));
68 
69 maplecl::Option<bool> lazyBinding({"--lazy-binding"},
70                                   "  --lazy-binding              \tBind class symbols lazily[default off]\n",
71                                   {cgCategory}, maplecl::DisableWith("--no-lazy-binding"));
72 
73 maplecl::Option<bool> hotFix({"--hot-fix"},
74                              "  --hot-fix                   \tOpen for App hot fix[default off]\n"
75                              "  --no-hot-fix\n",
76                              {cgCategory}, maplecl::DisableWith("--no-hot-fix"));
77 
78 maplecl::Option<bool> ebo({"--ebo"},
79                           "  --ebo                       \tPerform Extend block optimization\n"
80                           "  --no-ebo\n",
81                           {cgCategory}, maplecl::DisableWith("--no-ebo"));
82 
83 maplecl::Option<bool> cfgo({"--cfgo"},
84                            "  --cfgo                      \tPerform control flow optimization\n"
85                            "  --no-cfgo\n",
86                            {cgCategory}, maplecl::DisableWith("--no-cfgo"));
87 
88 maplecl::Option<bool> ico({"--ico"},
89                           "  --ico                       \tPerform if-conversion optimization\n"
90                           "  --no-ico\n",
91                           {cgCategory}, maplecl::DisableWith("--no-ico"));
92 
93 maplecl::Option<bool> storeloadopt({"--storeloadopt"},
94                                    "  --storeloadopt              \tPerform global store-load optimization\n"
95                                    "  --no-storeloadopt\n",
96                                    {cgCategory}, maplecl::DisableWith("--no-storeloadopt"));
97 
98 maplecl::Option<bool> globalopt({"--globalopt"},
99                                 "  --globalopt                 \tPerform global optimization\n"
100                                 "  --no-globalopt\n",
101                                 {cgCategory}, maplecl::DisableWith("--no-globalopt"));
102 
103 maplecl::Option<bool> hotcoldsplit({"--hotcoldsplit"},
104                                    "  --hotcoldsplit        \tPerform HotColdSplit optimization\n"
105                                    "  --no-hotcoldsplit\n",
106                                    {cgCategory}, maplecl::DisableWith("--no-hotcoldsplit"));
107 
108 maplecl::Option<bool> prelsra({"--prelsra"},
109                               "  --prelsra                   \tPerform live interval simplification in LSRA\n"
110                               "  --no-prelsra\n",
111                               {cgCategory}, maplecl::DisableWith("--no-prelsra"));
112 
113 maplecl::Option<bool> calleeregsPlacement(
114     {"--calleeregs-placement"},
115     "  --calleeregs-placement      \tOptimize placement of callee-save registers\n"
116     "  --no-calleeregs-placement\n",
117     {cgCategory}, maplecl::DisableWith("--no-calleeregs-placement"));
118 
119 maplecl::Option<bool> ssapreSave({"--ssapre-save"},
120                                  "  --ssapre-save                \tUse ssapre algorithm to save callee-save registers\n"
121                                  "  --no-ssapre-save\n",
122                                  {cgCategory}, maplecl::DisableWith("--no-ssapre-save"));
123 
124 maplecl::Option<bool> ssupreRestore({"--ssupre-restore"},
125                                     "  --ssupre-restore"
126                                     "             \tUse ssupre algorithm to restore callee-save registers\n"
127                                     "  --no-ssupre-restore\n",
128                                     {cgCategory}, maplecl::DisableWith("--no-ssupre-restore"));
129 
130 maplecl::Option<bool> prepeep({"--prepeep"},
131                               "  --prepeep                   \tPerform peephole optimization before RA\n"
132                               "  --no-prepeep\n",
133                               {cgCategory}, maplecl::DisableWith("--no-prepeep"));
134 
135 maplecl::Option<bool> peep({"--peep"},
136                            "  --peep                      \tPerform peephole optimization after RA\n"
137                            "  --no-peep\n",
138                            {cgCategory}, maplecl::DisableWith("--no-peep"));
139 
140 maplecl::Option<bool> preschedule({"--preschedule"},
141                                   "  --preschedule               \tPerform prescheduling\n"
142                                   "  --no-preschedule\n",
143                                   {cgCategory}, maplecl::DisableWith("--no-preschedule"));
144 
145 maplecl::Option<bool> schedule({"--schedule"},
146                                "  --schedule                  \tPerform scheduling\n"
147                                "  --no-schedule\n",
148                                {cgCategory}, maplecl::DisableWith("--no-schedule"));
149 
150 maplecl::Option<bool> retMerge({"--ret-merge"},
151                                "  --ret-merge                 \tMerge return bb into a single destination\n"
152                                "  --no-ret-merge              \tallows for multiple return bb\n",
153                                {cgCategory}, maplecl::DisableWith("--no-ret-merge"));
154 
155 maplecl::Option<bool> vregRename({"--vreg-rename"},
156                                  "  --vreg-rename"
157                                  "                  \tPerform rename of long live range around loops in coloring RA\n"
158                                  "  --no-vreg-rename\n",
159                                  {cgCategory}, maplecl::DisableWith("--no-vreg-rename"));
160 
161 maplecl::Option<bool> fullcolor({"--fullcolor"},
162                                 "  --fullcolor                  \tPerform multi-pass coloring RA\n"
163                                 "  --no-fullcolor\n",
164                                 {cgCategory}, maplecl::DisableWith("--no-fullcolor"));
165 
166 maplecl::Option<bool> writefieldopt({"--writefieldopt"},
167                                     "  --writefieldopt                  \tPerform WriteRefFieldOpt\n"
168                                     "  --no-writefieldopt\n",
169                                     {cgCategory}, maplecl::DisableWith("--no-writefieldopt"));
170 
171 maplecl::Option<bool> dumpOlog({"--dump-olog"},
172                                "  --dump-olog                 \tDump CFGO and ICO debug information\n"
173                                "  --no-dump-olog\n",
174                                {cgCategory}, maplecl::DisableWith("--no-dump-olog"));
175 
176 maplecl::Option<bool> nativeopt({"--nativeopt"},
177                                 "  --nativeopt                 \tEnable native opt\n"
178                                 "  --no-nativeopt\n",
179                                 {cgCategory}, maplecl::DisableWith("--no-nativeopt"));
180 
181 maplecl::Option<bool> objmap({"--objmap"},
182                              "  --objmap"
183                              "                    \tCreate object maps (GCTIBs) inside the main output (.s) file\n"
184                              "  --no-objmap\n",
185                              {cgCategory}, maplecl::DisableWith("--no-objmap"));
186 
187 maplecl::Option<bool> yieldpoint({"--yieldpoint"},
188                                  "  --yieldpoint                \tGenerate yieldpoints [default]\n"
189                                  "  --no-yieldpoint\n",
190                                  {cgCategory}, maplecl::DisableWith("--no-yieldpoint"));
191 
192 maplecl::Option<bool> proepilogue({"--proepilogue"},
193                                   "  --proepilogue               \tDo tail call optimization and"
194                                   " eliminate unnecessary prologue and epilogue.\n"
195                                   "  --no-proepilogue\n",
196                                   {cgCategory}, maplecl::DisableWith("--no-proepilogue"));
197 
198 maplecl::Option<bool> localRc({"--local-rc"},
199                               "  --local-rc                  \tHandle Local Stack RC [default]\n"
200                               "  --no-local-rc\n",
201                               {cgCategory}, maplecl::DisableWith("--no-local-rc"));
202 
203 maplecl::Option<std::string> insertCall({"--insert-call"},
204                                         "  --insert-call=name          \tInsert a call to the named function\n",
205                                         {cgCategory});
206 
207 maplecl::Option<bool> addDebugTrace({"--add-debug-trace"},
208                                     "  --add-debug-trace"
209                                     "           \tInstrument the output .s file to print call traces at runtime\n",
210                                     {cgCategory});
211 
212 maplecl::Option<bool> addFuncProfile({"--add-func-profile"},
213                                      "  --add-func-profile"
214                                      "          \tInstrument the output .s file to record func at runtime\n",
215                                      {cgCategory});
216 
217 maplecl::Option<std::string> classListFile(
218     {"--class-list-file"},
219     "  --class-list-file"
220     "           \tSet the class list file for the following generation options,\n"
221     "                              \tif not given, "
222     "generate for all visible classes\n"
223     "                              \t--class-list-file=class_list_file\n",
224     {cgCategory});
225 
226 maplecl::Option<bool> genCMacroDef(
227     {"--gen-c-macro-def"},
228     "  --gen-c-macro-def"
229     "           \tGenerate a .def file that contains extra type metadata, including the\n"
230     "                              \tclass instance sizes and field offsets (default)\n"
231     "  --no-gen-c-macro-def\n",
232     {cgCategory}, maplecl::DisableWith("--no-gen-c-macro-def"));
233 
234 maplecl::Option<bool> genGctibFile({"--gen-gctib-file"},
235                                    "  --gen-gctib-file"
236                                    "            \tGenerate a separate .s file for GCTIBs. Usually used together with\n"
237                                    "                              \t--no-objmap (not implemented yet)\n"
238                                    "  --no-gen-gctib-file\n",
239                                    {cgCategory}, maplecl::DisableWith("--no-gen-gctib-file"));
240 
241 maplecl::Option<bool> stackProtectorStrong(
242     {"--stack-protector-strong", "-fstack-protector", "-fstack-protector-strong"},
243     "  --stack-protector-strong                \tadd stack guard for some function \n"
244     "  --no-stack-protector-strong \n",
245     {cgCategory, driverCategory}, maplecl::DisableEvery({"--no-stack-protector-strong", "-fno-stack-protector"}));
246 
247 maplecl::Option<bool> stackProtectorAll({"--stack-protector-all"},
248                                         "  --stack-protector-all                 \tadd stack guard for all functions \n"
249                                         "  --no-stack-protector-all\n",
250                                         {cgCategory}, maplecl::DisableWith("--no-stack-protector-all"));
251 
252 maplecl::Option<bool> debug({"-g", "--g"}, "  -g                          \tGenerate debug information\n",
253                             {cgCategory});
254 
255 maplecl::Option<bool> gdwarf({"--gdwarf"}, "  --gdwarf                    \tGenerate dwarf infomation\n", {cgCategory});
256 
257 maplecl::Option<bool> gsrc(
258     {"--gsrc"}, "  --gsrc                      \tUse original source file instead of mpl file for debugging\n",
259     {cgCategory});
260 
261 maplecl::Option<bool> gmixedsrc({"--gmixedsrc"},
262                                 "  --gmixedsrc"
263                                 "                 \tUse both original source file and mpl file for debugging\n",
264                                 {cgCategory});
265 
266 maplecl::Option<bool> gmixedasm({"--gmixedasm"},
267                                 "  --gmixedasm"
268                                 "                 \tComment out both original source file and mpl file for debugging\n",
269                                 {cgCategory});
270 
271 maplecl::Option<bool> profile({"--p", "-p"}, "  -p                          \tGenerate profiling infomation\n",
272                               {cgCategory});
273 
274 maplecl::Option<bool> withRaLinearScan({"--with-ra-linear-scan"},
275                                        "  --with-ra-linear-scan       \tDo linear-scan register allocation\n",
276                                        {cgCategory});
277 
278 maplecl::Option<bool> withRaGraphColor({"--with-ra-graph-color"},
279                                        "  --with-ra-graph-color       \tDo coloring-based register allocation\n",
280                                        {cgCategory});
281 
282 maplecl::Option<bool> patchLongBranch({"--patch-long-branch"},
283                                       "  --patch-long-branch"
284                                       "         \tEnable patching long distance branch with jumping pad\n",
285                                       {cgCategory});
286 
287 maplecl::Option<bool> constFold({"--const-fold"},
288                                 "  --const-fold                \tEnable constant folding\n"
289                                 "  --no-const-fold\n",
290                                 {cgCategory}, maplecl::DisableWith("--no-const-fold"));
291 
292 maplecl::Option<std::string> ehExclusiveList(
293     {"--eh-exclusive-list"},
294     "  --eh-exclusive-list         \tFor generating gold files in unit testing\n"
295     "                              \t--eh-exclusive-list=list_file\n",
296     {cgCategory});
297 
298 maplecl::Option<bool> o0({"-O0", "--O0"}, "  -O0                         \tNo optimization.\n", {cgCategory});
299 
300 maplecl::Option<bool> o1({"-O1", "--O1"}, "  -O1                         \tDo some optimization.\n", {cgCategory});
301 
302 maplecl::Option<bool> o2({"-O2", "--O2"}, "  -O2                          \tDo some optimization.\n", {cgCategory});
303 
304 maplecl::Option<bool> os({"-Os", "--Os"}, "  -Os                          \tOptimize for size, based on O2.\n",
305                          {cgCategory});
306 
307 maplecl::Option<bool> olitecg({"-Olitecg", "--Olitecg"}, " -Olitecg                       \tOptimize for litecg.\n",
308                               {cgCategory});
309 
310 maplecl::Option<uint64_t> lsraBb({"--lsra-bb"},
311                                  "  --lsra-bb=NUM"
312                                  "               \tSwitch to spill mode if number of bb in function exceeds NUM\n",
313                                  {cgCategory});
314 
315 maplecl::Option<uint64_t> lsraInsn(
316     {"--lsra-insn"},
317     "  --lsra-insn=NUM"
318     "             \tSwitch to spill mode if number of instructons in function exceeds NUM\n",
319     {cgCategory});
320 
321 maplecl::Option<uint64_t> lsraOverlap({"--lsra-overlap"},
322                                       "  --lsra-overlap=NUM          \toverlap NUM to decide pre spill in lsra\n",
323                                       {cgCategory});
324 
325 maplecl::Option<uint8_t> remat({"--remat"},
326                                "  --remat                     \tEnable rematerialization during register allocation\n"
327                                "                              \t     0: no rematerialization (default)\n"
328                                "                              \t  >= 1: rematerialize constants\n"
329                                "                              \t  >= 2: rematerialize addresses\n"
330                                "                              \t  >= 3: rematerialize local dreads\n"
331                                "                              \t  >= 4: rematerialize global dreads\n",
332                                {cgCategory});
333 
334 maplecl::Option<bool> suppressFileinfo({"--suppress-fileinfo"},
335                                        "  --suppress-fileinfo         \tFor generating gold files in unit testing\n",
336                                        {cgCategory});
337 
338 maplecl::Option<bool> dumpCfg({"--dump-cfg"}, "  --dump-cfg\n", {cgCategory});
339 
340 maplecl::Option<std::string> target({"--target"}, "  --target=TARGETMACHINE \t generate code for TARGETMACHINE\n",
341                                     {cgCategory}, maplecl::optionalValue);
342 
343 maplecl::Option<std::string> dumpPhases({"--dump-phases"},
344                                         "  --dump-phases=PHASENAME,..."
345                                         " \tEnable debug trace for specified phases in the comma separated list\n",
346                                         {cgCategory});
347 
348 maplecl::Option<std::string> skipPhases({"--skip-phases"},
349                                         "  --skip-phases=PHASENAME,..."
350                                         " \tSkip the phases specified in the comma separated list\n",
351                                         {cgCategory});
352 
353 maplecl::Option<std::string> skipFrom({"--skip-from"},
354                                       "  --skip-from=PHASENAME       \tSkip the rest phases from PHASENAME(included)\n",
355                                       {cgCategory});
356 
357 maplecl::Option<std::string> skipAfter(
358     {"--skip-after"}, "  --skip-after=PHASENAME      \tSkip the rest phases after PHASENAME(excluded)\n", {cgCategory});
359 
360 maplecl::Option<std::string> dumpFunc(
361     {"--dump-func"},
362     "  --dump-func=FUNCNAME"
363     "        \tDump/trace only for functions whose names contain FUNCNAME as substring\n"
364     "                              \t(can only specify once)\n",
365     {cgCategory});
366 
367 maplecl::Option<bool> timePhases(
368     {"--time-phases"},
369     "  --time-phases               \tCollect compilation time stats for each phase\n"
370     "  --no-time-phases            \tDon't Collect compilation time stats for each phase\n",
371     {cgCategory}, maplecl::DisableWith("--no-time-phases"));
372 
373 maplecl::Option<bool> useBarriersForVolatile({"--use-barriers-for-volatile"},
374                                              "  --use-barriers-for-volatile \tOptimize volatile load/str\n"
375                                              "  --no-use-barriers-for-volatile\n",
376                                              {cgCategory}, maplecl::DisableWith("--no-use-barriers-for-volatile"));
377 
378 maplecl::Option<std::string> range(
379     {"--range"}, "  --range=NUM0,NUM1           \tOptimize only functions in the range [NUM0, NUM1]\n", {cgCategory});
380 
381 maplecl::Option<uint8_t> fastAlloc({"--fast-alloc"},
382                                    "  --fast-alloc=[0/1]          \tO2 RA fast mode, set to 1 to spill all registers\n",
383                                    {cgCategory});
384 
385 maplecl::Option<std::string> spillRange(
386     {"--spill_range"}, "  --spill_range=NUM0,NUM1     \tO2 RA spill registers in the range [NUM0, NUM1]\n",
387     {cgCategory});
388 
389 maplecl::Option<bool> dupBb({"--dup-bb"},
390                             "  --dup-bb                 \tAllow cfg optimizer to duplicate bb\n"
391                             "  --no-dup-bb              \tDon't allow cfg optimizer to duplicate bb\n",
392                             {cgCategory}, maplecl::DisableWith("--no-dup-bb"));
393 
394 maplecl::Option<bool> calleeCfi({"--callee-cfi"},
395                                 "  --callee-cfi                \tcallee cfi message will be generated\n"
396                                 "  --no-callee-cfi             \tcallee cfi message will not be generated\n",
397                                 {cgCategory}, maplecl::DisableWith("--no-callee-cfi"));
398 
399 maplecl::Option<bool> printFunc({"--print-func"},
400                                 "  --print-func\n"
401                                 "  --no-print-func\n",
402                                 {cgCategory}, maplecl::DisableWith("--no-print-func"));
403 
404 maplecl::Option<std::string> cyclePatternList({"--cycle-pattern-list"},
405                                               "  --cycle-pattern-list        \tFor generating cycle pattern meta\n"
406                                               "                              \t--cycle-pattern-list=list_file\n",
407                                               {cgCategory});
408 
409 maplecl::Option<std::string> duplicateAsmList(
410     {"--duplicate_asm_list"},
411     "  --duplicate_asm_list        \tDuplicate asm functions to delete plt call\n"
412     "                              \t--duplicate_asm_list=list_file\n",
413     {cgCategory});
414 
415 maplecl::Option<std::string> duplicateAsmList2({"--duplicate_asm_list2"},
416                                                "  --duplicate_asm_list2"
417                                                "       \tDuplicate more asm functions to delete plt call\n"
418                                                "                              \t--duplicate_asm_list2=list_file\n",
419                                                {cgCategory});
420 
421 maplecl::Option<std::string> blockMarker({"--block-marker"},
422                                          "  --block-marker"
423                                          "              \tEmit block marker symbols in emitted assembly files\n",
424                                          {cgCategory});
425 
426 maplecl::Option<bool> soeCheck({"--soe-check"},
427                                "  --soe-check                 \tInsert a soe check instruction[default off]\n",
428                                {cgCategory});
429 
430 maplecl::Option<bool> checkArraystore({"--check-arraystore"},
431                                       "  --check-arraystore          \tcheck arraystore exception[default off]\n"
432                                       "  --no-check-arraystore\n",
433                                       {cgCategory}, maplecl::DisableWith("--no-check-arraystore"));
434 
435 maplecl::Option<bool> debugSchedule({"--debug-schedule"},
436                                     "  --debug-schedule            \tdump scheduling information\n"
437                                     "  --no-debug-schedule\n",
438                                     {cgCategory}, maplecl::DisableWith("--no-debug-schedule"));
439 
440 maplecl::Option<bool> bruteforceSchedule({"--bruteforce-schedule"},
441                                          "  --bruteforce-schedule       \tdo brute force schedule\n"
442                                          "  --no-bruteforce-schedule\n",
443                                          {cgCategory}, maplecl::DisableWith("--no-bruteforce-schedule"));
444 
445 maplecl::Option<bool> simulateSchedule({"--simulate-schedule"},
446                                        "  --simulate-schedule         \tdo simulate schedule\n"
447                                        "  --no-simulate-schedule\n",
448                                        {cgCategory}, maplecl::DisableWith("--no-simulate-schedule"));
449 
450 maplecl::Option<bool> crossLoc({"--cross-loc"},
451                                "  --cross-loc                 \tcross loc insn schedule\n"
452                                "  --no-cross-loc\n",
453                                {cgCategory}, maplecl::DisableWith("--no-cross-loc"));
454 
455 maplecl::Option<std::string> floatAbi({"--float-abi"},
456                                       "  --float-abi=name            \tPrint the abi type.\n"
457                                       "                              \tname=hard: abi-hard (Default)\n"
458                                       "                              \tname=soft: abi-soft\n"
459                                       "                              \tname=softfp: abi-softfp\n",
460                                       {cgCategory});
461 
462 maplecl::Option<std::string> filetype({"--filetype"},
463                                       "  --filetype=name             \tChoose a file type.\n"
464                                       "                              \tname=asm: Emit an assembly file (Default)\n"
465                                       "                              \tname=obj: Emit an object file\n"
466                                       "                              \tname=null: not support yet\n",
467                                       {cgCategory});
468 
469 maplecl::Option<bool> longCalls({"--long-calls"},
470                                 "  --long-calls                \tgenerate long call\n"
471                                 "  --no-long-calls\n",
472                                 {cgCategory}, maplecl::DisableWith("--no-long-calls"));
473 
474 maplecl::Option<bool> functionSections({"--function-sections"},
475                                        " --function-sections           \t \n"
476                                        "  --no-function-sections\n",
477                                        {cgCategory}, maplecl::DisableWith("--no-function-sections"));
478 
479 maplecl::Option<bool> omitFramePointer({"--omit-frame-pointer", "-fomit-frame-pointer"},
480                                        " --omit-frame-pointer          \t do not use frame pointer \n"
481                                        " --no-omit-frame-pointer\n",
482                                        {cgCategory, driverCategory},
483                                        maplecl::DisableEvery({"--no-omit-frame-pointer", "-fno-omit-frame-pointer"}));
484 
485 maplecl::Option<bool> fastMath({"--fast-math"},
486                                "  --fast-math                  \tPerform fast math\n"
487                                "  --no-fast-math\n",
488                                {cgCategory}, maplecl::DisableWith("--no-fast-math"));
489 
490 maplecl::Option<bool> tailcall({"--tailcall"},
491                                "  --tailcall                   \tDo tail call optimization\n"
492                                "  --no-tailcall\n",
493                                {cgCategory}, maplecl::DisableWith("--no-tailcall"));
494 
495 maplecl::Option<bool> alignAnalysis({"--align-analysis"},
496                                     "  --align-analysis                 \tPerform alignanalysis\n"
497                                     "  --no-align-analysis\n",
498                                     {cgCategory}, maplecl::DisableWith("--no-align-analysis"));
499 
500 maplecl::Option<bool> cgSsa({"--cg-ssa"},
501                             "  --cg-ssa                     \tPerform cg ssa\n"
502                             "  --no-cg-ssa\n",
503                             {cgCategory}, maplecl::DisableWith("--no-cg-ssa"));
504 
505 maplecl::Option<bool> common({"--common", "-fcommon"},
506                              " --common           \t \n"
507                              " --no-common\n",
508                              {cgCategory, driverCategory}, maplecl::DisableEvery({"--no-common", "-fno-common"}));
509 
510 maplecl::Option<bool> condbrAlign({"--condbr-align"},
511                                   "  --condbr-align                   \tPerform condbr align\n"
512                                   "  --no-condbr-align\n",
513                                   {cgCategory}, maplecl::DisableWith("--no-condbr-align"));
514 
515 maplecl::Option<uint32_t> alignMinBbSize({"--align-min-bb-size"},
516                                          " --align-min-bb-size=NUM"
517                                          "           \tO2 Minimum bb size for alignment   unit:byte\n",
518                                          {cgCategory});
519 
520 maplecl::Option<uint32_t> alignMaxBbSize({"--align-max-bb-size"},
521                                          " --align-max-bb-size=NUM"
522                                          "           \tO2 Maximum bb size for alignment   unit:byte\n",
523                                          {cgCategory});
524 
525 maplecl::Option<uint32_t> loopAlignPow(
526     {"--loop-align-pow"}, " --loop-align-pow=NUM           \tO2 loop bb align pow (NUM == 0, no loop-align)\n",
527     {cgCategory});
528 
529 maplecl::Option<uint32_t> jumpAlignPow(
530     {"--jump-align-pow"}, " --jump-align-pow=NUM           \tO2 jump bb align pow (NUM == 0, no jump-align)\n",
531     {cgCategory});
532 
533 maplecl::Option<uint32_t> funcAlignPow(
534     {"--func-align-pow"}, " --func-align-pow=NUM           \tO2 func bb align pow (NUM == 0, no func-align)\n",
535     {cgCategory});
536 
537 }  // namespace opts::cg
538