80 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9/// This file defines some shared command-line options that can be used when10/// 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 42cl::opt<bool> skipExternalRttiDefinition(43 "skip-external-rtti-definition", llvm::cl::init(false),44 llvm::cl::desc("do not define rtti static objects for types belonging to "45 "other compilation units"),46 cl::Hidden);47 48OptimizationLevel defaultOptLevel{OptimizationLevel::O0};49 50codegenoptions::DebugInfoKind noDebugInfo{codegenoptions::NoDebugInfo};51 52/// Optimizer Passes53DisableOption(CfgConversion, "cfg-conversion", "disable FIR to CFG pass");54DisableOption(FirAvc, "avc", "array value copy analysis and transformation");55DisableOption(FirMao, "memory-allocation-opt",56 "memory allocation optimization");57 58DisableOption(FirAliasTags, "fir-alias-tags", "fir alias analysis");59cl::opt<bool> useOldAliasTags(60 "use-old-alias-tags",61 cl::desc("Use a single TBAA tree for all functions and do not use "62 "the FIR alias tags pass"),63 cl::init(false), cl::Hidden);64 65/// CodeGen Passes66DisableOption(CodeGenRewrite, "codegen-rewrite", "rewrite FIR for codegen");67DisableOption(TargetRewrite, "target-rewrite", "rewrite FIR for target");68DisableOption(DebugInfo, "debug-info", "Add debug info");69DisableOption(FirToLlvmIr, "fir-to-llvmir", "FIR to LLVM-IR dialect");70DisableOption(LlvmIrToLlvm, "llvm", "conversion to LLVM");71DisableOption(BoxedProcedureRewrite, "boxed-procedure-rewrite",72 "rewrite boxed procedures");73 74DisableOption(ExternalNameConversion, "external-name-interop",75 "convert names with external convention");76EnableOption(ConstantArgumentGlobalisation, "constant-argument-globalisation",77 "the local constant argument to global constant conversion");78DisableOption(CompilerGeneratedNamesConversion, "compiler-generated-names",79 "replace special symbols in compiler generated names");80