Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line | 
|---|---|---|---|
| 14 | pmbaty | 1 | //===--- TargetOptions.h ----------------------------------------*- 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 | /// \file | ||
| 10 | /// Defines the clang::TargetOptions class. | ||
| 11 | /// | ||
| 12 | //===----------------------------------------------------------------------===// | ||
| 13 | |||
| 14 | #ifndef LLVM_CLANG_BASIC_TARGETOPTIONS_H | ||
| 15 | #define LLVM_CLANG_BASIC_TARGETOPTIONS_H | ||
| 16 | |||
| 17 | #include "clang/Basic/OpenCLOptions.h" | ||
| 18 | #include "llvm/Support/VersionTuple.h" | ||
| 19 | #include "llvm/Target/TargetOptions.h" | ||
| 20 | #include <string> | ||
| 21 | #include <vector> | ||
| 22 | |||
| 23 | namespace clang { | ||
| 24 | |||
| 25 | /// Options for controlling the target. | ||
| 26 | class TargetOptions { | ||
| 27 | public: | ||
| 28 |   /// The name of the target triple to compile for. | ||
| 29 | std::string Triple; | ||
| 30 | |||
| 31 |   /// When compiling for the device side, contains the triple used to compile | ||
| 32 |   /// for the host. | ||
| 33 | std::string HostTriple; | ||
| 34 | |||
| 35 |   /// If given, the name of the target CPU to generate code for. | ||
| 36 | std::string CPU; | ||
| 37 | |||
| 38 |   /// If given, the name of the target CPU to tune code for. | ||
| 39 | std::string TuneCPU; | ||
| 40 | |||
| 41 |   /// If given, the unit to use for floating point math. | ||
| 42 | std::string FPMath; | ||
| 43 | |||
| 44 |   /// If given, the name of the target ABI to use. | ||
| 45 | std::string ABI; | ||
| 46 | |||
| 47 |   /// The EABI version to use | ||
| 48 | llvm::EABI EABIVersion; | ||
| 49 | |||
| 50 |   /// If given, the version string of the linker in use. | ||
| 51 | std::string LinkerVersion; | ||
| 52 | |||
| 53 |   /// The list of target specific features to enable or disable, as written on the command line. | ||
| 54 | std::vector<std::string> FeaturesAsWritten; | ||
| 55 | |||
| 56 |   /// The list of target specific features to enable or disable -- this should | ||
| 57 |   /// be a list of strings starting with by '+' or '-'. | ||
| 58 | std::vector<std::string> Features; | ||
| 59 | |||
| 60 |   /// The map of which features have been enabled disabled based on the command | ||
| 61 |   /// line. | ||
| 62 | llvm::StringMap<bool> FeatureMap; | ||
| 63 | |||
| 64 |   /// Supported OpenCL extensions and optional core features. | ||
| 65 | llvm::StringMap<bool> OpenCLFeaturesMap; | ||
| 66 | |||
| 67 |   /// The list of OpenCL extensions to enable or disable, as written on | ||
| 68 |   /// the command line. | ||
| 69 | std::vector<std::string> OpenCLExtensionsAsWritten; | ||
| 70 | |||
| 71 |   /// If given, enables support for __int128_t and __uint128_t types. | ||
| 72 | bool ForceEnableInt128 = false; | ||
| 73 | |||
| 74 |   /// \brief If enabled, use 32-bit pointers for accessing const/local/shared | ||
| 75 |   /// address space. | ||
| 76 | bool NVPTXUseShortPointers = false; | ||
| 77 | |||
| 78 |   /// \brief If enabled, allow AMDGPU unsafe floating point atomics. | ||
| 79 | bool AllowAMDGPUUnsafeFPAtomics = false; | ||
| 80 | |||
| 81 |   /// \brief Enumeration value for AMDGPU code object version, which is the | ||
| 82 |   /// code object version times 100. | ||
| 83 | enum CodeObjectVersionKind { | ||
| 84 | COV_None, | ||
| 85 | COV_2 = 200, | ||
| 86 | COV_3 = 300, | ||
| 87 | COV_4 = 400, | ||
| 88 | COV_5 = 500, | ||
| 89 | }; | ||
| 90 |   /// \brief Code object version for AMDGPU. | ||
| 91 |   CodeObjectVersionKind CodeObjectVersion; | ||
| 92 | |||
| 93 |   // The code model to be used as specified by the user. Corresponds to | ||
| 94 |   // CodeModel::Model enum defined in include/llvm/Support/CodeGen.h, plus | ||
| 95 |   // "default" for the case when the user has not explicitly specified a | ||
| 96 |   // code model. | ||
| 97 | std::string CodeModel; | ||
| 98 | |||
| 99 |   /// The version of the SDK which was used during the compilation. | ||
| 100 |   /// The option is used for two different purposes: | ||
| 101 |   /// * on darwin the version is propagated to LLVM where it's used | ||
| 102 |   ///   to support SDK Version metadata (See D55673). | ||
| 103 |   /// * CUDA compilation uses it to control parts of CUDA compilation | ||
| 104 |   ///   in clang that depend on specific version of the CUDA SDK. | ||
| 105 | llvm::VersionTuple SDKVersion; | ||
| 106 | |||
| 107 |   /// The name of the darwin target- ariant triple to compile for. | ||
| 108 | std::string DarwinTargetVariantTriple; | ||
| 109 | |||
| 110 |   /// The version of the darwin target variant SDK which was used during the | ||
| 111 |   /// compilation. | ||
| 112 | llvm::VersionTuple DarwinTargetVariantSDKVersion; | ||
| 113 | |||
| 114 |   /// The validator version for dxil. | ||
| 115 | std::string DxilValidatorVersion; | ||
| 116 | |||
| 117 |   /// The entry point name for HLSL shader being compiled as specified by -E. | ||
| 118 | std::string HLSLEntry; | ||
| 119 | }; | ||
| 120 | |||
| 121 | } // end namespace clang | ||
| 122 | |||
| 123 | #endif |