//===-- 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. // //===----------------------------------------------------------------------===// #ifndef LDC_DRIVER_CL_OPTIONS_H #define LDC_DRIVER_CL_OPTIONS_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 // FIXME: Just for the BOUDNSCHECK enum; this is not pretty #include "globals.h" 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; /* 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 useDIP1000; 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::opt hdrDir; extern cl::opt hdrFile; extern cl::opt hdrKeepAllBodies; extern cl::list versions; extern cl::list transitions; extern cl::opt moduleDeps; extern cl::opt cacheDir; extern cl::list linkerSwitches; extern cl::list ccSwitches; extern cl::opt mArch; extern cl::opt m32bits; extern cl::opt m64bits; extern cl::opt mCPU; extern cl::list mAttrs; extern cl::opt mTargetTriple; #if LDC_LLVM_VER >= 307 extern cl::opt mABI; #endif extern cl::opt mRelocModel; extern cl::opt mCodeModel; extern cl::opt disableFpElim; extern cl::opt mFloatABI; extern cl::opt linkonceTemplates; extern cl::opt disableLinkerStripDead; // Math options extern bool fFastMath; extern llvm::FastMathFlags defaultFMF; void setDefaultMathOptions(llvm::TargetMachine &target); extern cl::opt boundsCheck; extern bool nonSafeBoundsChecks; #if LDC_WITH_PGO extern cl::opt genfileInstrProf; extern cl::opt usefileInstrProf; #endif extern cl::opt instrumentFunctions; // Arguments to -d-debug extern std::vector debugArgs; // Arguments to -run void createClashingOptions(); void hideLLVMOptions(); #if LDC_LLVM_VER >= 309 // 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; } #else inline bool isUsingLTO() { return false; } inline bool isUsingThinLTO() { return false; } #endif #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; #endif } #endif