//===-- driver/cl_options.h - LDC command line options ----------*- C++ -*-===// // // LDC – the LLVM D compiler // // This file is distributed under the BSD-style LDC license. See the LICENSE // file for details. // //===----------------------------------------------------------------------===// // // Defines the LDC command line options as handled using the LLVM command // line parsing library. // //===----------------------------------------------------------------------===// #pragma once #include "driver/cl_options-llvm.h" #include "driver/targetmachine.h" #include "gen/cl_helpers.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/CodeGen.h" #include "llvm/Support/CommandLine.h" #include #include namespace llvm { class FastMathFlags; class TargetMachine; } namespace opts { namespace cl = llvm::cl; /// Stores the commandline arguments list, including the ones specified by the /// config and response files. extern llvm::SmallVector allArguments; extern cl::OptionCategory linkingCategory; /* Mostly generated with the following command: egrep -e '^(cl::|#if|#e)' gen/cl_options.cpp \ | sed -re 's/^(cl::.*)\(.*$/ extern \1;/' */ extern cl::list fileList; extern cl::list runargs; extern cl::opt invokedByLDMD; extern cl::opt compileOnly; extern cl::opt noAsm; extern cl::opt dontWriteObj; extern cl::opt objectFile; extern cl::opt objectDir; extern cl::opt soname; extern cl::opt output_bc; extern cl::opt output_ll; extern cl::opt output_s; extern cl::opt output_o; extern cl::opt ddocDir; extern cl::opt ddocFile; extern cl::opt jsonFile; extern cl::list jsonFields; extern cl::opt hdrDir; extern cl::opt hdrFile; extern cl::opt hdrKeepAllBodies; extern cl::opt mixinFile; extern cl::list versions; extern cl::list transitions; extern cl::list previews; extern cl::list reverts; extern cl::opt moduleDeps; extern cl::opt cacheDir; extern cl::list linkerSwitches; extern cl::list ccSwitches; extern cl::list includeModulePatterns; extern cl::opt m32bits; extern cl::opt m64bits; extern cl::opt mTargetTriple; extern cl::opt mABI; extern FloatABI::Type floatABI; extern cl::opt linkonceTemplates; extern cl::opt disableLinkerStripDead; extern cl::opt defaultToHiddenVisibility; // Math options extern bool fFastMath; extern llvm::FastMathFlags defaultFMF; void setDefaultMathOptions(llvm::TargetOptions &targetOptions); // Arguments to -d-debug extern std::vector debugArgs; // Arguments to -run void createClashingOptions(); void hideLLVMOptions(); // LTO options enum LTOKind { LTO_None, LTO_Full, LTO_Thin, }; extern cl::opt ltoMode; inline bool isUsingLTO() { return ltoMode != LTO_None; } inline bool isUsingThinLTO() { return ltoMode == LTO_Thin; } #if LDC_LLVM_VER >= 400 extern cl::opt saveOptimizationRecord; #endif #if LDC_LLVM_SUPPORTED_TARGET_SPIRV || LDC_LLVM_SUPPORTED_TARGET_NVPTX extern cl::list dcomputeTargets; extern cl::opt dcomputeFilePrefix; #endif #if defined(LDC_DYNAMIC_COMPILE) extern cl::opt enableDynamicCompile; extern cl::opt dynamicCompileTlsWorkaround; #else constexpr bool enableDynamicCompile = false; #endif }