1//===-- CommandLineOpts.cpp -- shared command line options ------*- 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/// This file defines some shared command-line options that can be used when
10/// debugging the test tools.
11
12#include "flang/Optimizer/Passes/CommandLineOpts.h"
13
14using namespace llvm;
15
16#define DisableOption(DOName, DOOption, DODescription) \
17 cl::opt<bool> disable##DOName("disable-" DOOption, \
18 cl::desc("disable " DODescription " pass"), \
19 cl::init(false), cl::Hidden)
20#define EnableOption(EOName, EOOption, EODescription) \
21 cl::opt<bool> enable##EOName("enable-" EOOption, \
22 cl::desc("enable " EODescription " pass"), \
23 cl::init(false), cl::Hidden)
24
25cl::opt<bool> dynamicArrayStackToHeapAllocation(
26 "fdynamic-heap-array",
27 cl::desc("place all array allocations of dynamic size on the heap"),
28 cl::init(false), cl::Hidden);
29
30cl::opt<std::size_t> arrayStackAllocationThreshold(
31 "fstack-array-size",
32 cl::desc(
33 "place all array allocations more than <size> elements on the heap"),
34 cl::init(~static_cast<std::size_t>(0)), cl::Hidden);
35
36cl::opt<bool> ignoreMissingTypeDescriptors(
37 "ignore-missing-type-desc",
38 cl::desc("ignore failures to find derived type descriptors when "
39 "translating FIR to LLVM"),
40 cl::init(false), cl::Hidden);
41
42OptimizationLevel defaultOptLevel{OptimizationLevel::O0};
43
44codegenoptions::DebugInfoKind noDebugInfo{codegenoptions::NoDebugInfo};
45
46/// Optimizer Passes
47DisableOption(CfgConversion, "cfg-conversion", "disable FIR to CFG pass");
48DisableOption(FirAvc, "avc", "array value copy analysis and transformation");
49DisableOption(FirMao, "memory-allocation-opt",
50 "memory allocation optimization");
51
52DisableOption(FirAliasTags, "fir-alias-tags", "fir alias analysis");
53cl::opt<bool> useOldAliasTags(
54 "use-old-alias-tags",
55 cl::desc("Use a single TBAA tree for all functions and do not use "
56 "the FIR alias tags pass"),
57 cl::init(false), cl::Hidden);
58
59/// CodeGen Passes
60DisableOption(CodeGenRewrite, "codegen-rewrite", "rewrite FIR for codegen");
61DisableOption(TargetRewrite, "target-rewrite", "rewrite FIR for target");
62DisableOption(DebugInfo, "debug-info", "Add debug info");
63DisableOption(FirToLlvmIr, "fir-to-llvmir", "FIR to LLVM-IR dialect");
64DisableOption(LlvmIrToLlvm, "llvm", "conversion to LLVM");
65DisableOption(BoxedProcedureRewrite, "boxed-procedure-rewrite",
66 "rewrite boxed procedures");
67
68DisableOption(ExternalNameConversion, "external-name-interop",
69 "convert names with external convention");
70EnableOption(ConstantArgumentGlobalisation, "constant-argument-globalisation",
71 "the local constant argument to global constant conversion");
72DisableOption(CompilerGeneratedNamesConversion, "compiler-generated-names",
73 "replace special symbols in compiler generated names");
74

source code of flang/lib/Optimizer/Passes/CommandLineOpts.cpp