| 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 | |
| 14 | using 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 | |
| 25 | cl::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 | |
| 30 | cl::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 | |
| 36 | cl::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 | |
| 42 | OptimizationLevel defaultOptLevel{OptimizationLevel::O0}; |
| 43 | |
| 44 | codegenoptions::DebugInfoKind noDebugInfo{codegenoptions::NoDebugInfo}; |
| 45 | |
| 46 | /// Optimizer Passes |
| 47 | DisableOption(CfgConversion, "cfg-conversion" , "disable FIR to CFG pass" ); |
| 48 | DisableOption(FirAvc, "avc" , "array value copy analysis and transformation" ); |
| 49 | DisableOption(FirMao, "memory-allocation-opt" , |
| 50 | "memory allocation optimization" ); |
| 51 | |
| 52 | DisableOption(FirAliasTags, "fir-alias-tags" , "fir alias analysis" ); |
| 53 | cl::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 |
| 60 | DisableOption(CodeGenRewrite, "codegen-rewrite" , "rewrite FIR for codegen" ); |
| 61 | DisableOption(TargetRewrite, "target-rewrite" , "rewrite FIR for target" ); |
| 62 | DisableOption(DebugInfo, "debug-info" , "Add debug info" ); |
| 63 | DisableOption(FirToLlvmIr, "fir-to-llvmir" , "FIR to LLVM-IR dialect" ); |
| 64 | DisableOption(LlvmIrToLlvm, "llvm" , "conversion to LLVM" ); |
| 65 | DisableOption(BoxedProcedureRewrite, "boxed-procedure-rewrite" , |
| 66 | "rewrite boxed procedures" ); |
| 67 | |
| 68 | DisableOption(ExternalNameConversion, "external-name-interop" , |
| 69 | "convert names with external convention" ); |
| 70 | EnableOption(ConstantArgumentGlobalisation, "constant-argument-globalisation" , |
| 71 | "the local constant argument to global constant conversion" ); |
| 72 | DisableOption(CompilerGeneratedNamesConversion, "compiler-generated-names" , |
| 73 | "replace special symbols in compiler generated names" ); |
| 74 | |