Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:51

0001 //===--- TargetOptions.h ----------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 ///
0009 /// \file
0010 /// Defines the clang::TargetOptions class.
0011 ///
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_CLANG_BASIC_TARGETOPTIONS_H
0015 #define LLVM_CLANG_BASIC_TARGETOPTIONS_H
0016 
0017 #include "clang/Basic/OpenCLOptions.h"
0018 #include "llvm/Support/VersionTuple.h"
0019 #include "llvm/Target/TargetOptions.h"
0020 #include <string>
0021 #include <vector>
0022 
0023 namespace clang {
0024 
0025 /// Options for controlling the target.
0026 class TargetOptions {
0027 public:
0028   /// The name of the target triple to compile for.
0029   std::string Triple;
0030 
0031   /// When compiling for the device side, contains the triple used to compile
0032   /// for the host.
0033   std::string HostTriple;
0034 
0035   /// If given, the name of the target CPU to generate code for.
0036   std::string CPU;
0037 
0038   /// If given, the name of the target CPU to tune code for.
0039   std::string TuneCPU;
0040 
0041   /// If given, the unit to use for floating point math.
0042   std::string FPMath;
0043 
0044   /// If given, the name of the target ABI to use.
0045   std::string ABI;
0046 
0047   /// The EABI version to use
0048   llvm::EABI EABIVersion = llvm::EABI::Default;
0049 
0050   /// If given, the version string of the linker in use.
0051   std::string LinkerVersion;
0052 
0053   /// The list of target specific features to enable or disable, as written on the command line.
0054   std::vector<std::string> FeaturesAsWritten;
0055 
0056   /// The list of target specific features to enable or disable -- this should
0057   /// be a list of strings starting with by '+' or '-'.
0058   std::vector<std::string> Features;
0059 
0060   /// The map of which features have been enabled disabled based on the command
0061   /// line.
0062   llvm::StringMap<bool> FeatureMap;
0063 
0064   /// Supported OpenCL extensions and optional core features.
0065   llvm::StringMap<bool> OpenCLFeaturesMap;
0066 
0067   /// The list of OpenCL extensions to enable or disable, as written on
0068   /// the command line.
0069   std::vector<std::string> OpenCLExtensionsAsWritten;
0070 
0071   /// If given, enables support for __int128_t and __uint128_t types.
0072   bool ForceEnableInt128 = false;
0073 
0074   /// \brief If enabled, use 32-bit pointers for accessing const/local/shared
0075   /// address space.
0076   bool NVPTXUseShortPointers = false;
0077 
0078   /// \brief If enabled, allow AMDGPU unsafe floating point atomics.
0079   bool AllowAMDGPUUnsafeFPAtomics = false;
0080 
0081   /// \brief Code object version for AMDGPU.
0082   llvm::CodeObjectVersionKind CodeObjectVersion =
0083       llvm::CodeObjectVersionKind::COV_None;
0084 
0085   /// \brief Enumeration values for AMDGPU printf lowering scheme
0086   enum class AMDGPUPrintfKind {
0087     /// printf lowering scheme involving hostcalls, currently used by HIP
0088     /// programs by default
0089     Hostcall = 0,
0090 
0091     /// printf lowering scheme involving implicit printf buffers,
0092     Buffered = 1,
0093   };
0094 
0095   /// \brief AMDGPU Printf lowering scheme
0096   AMDGPUPrintfKind AMDGPUPrintfKindVal = AMDGPUPrintfKind::Hostcall;
0097 
0098   // The code model to be used as specified by the user. Corresponds to
0099   // CodeModel::Model enum defined in include/llvm/Support/CodeGen.h, plus
0100   // "default" for the case when the user has not explicitly specified a
0101   // code model.
0102   std::string CodeModel;
0103 
0104   // The large data threshold used for certain code models on certain
0105   // architectures.
0106   uint64_t LargeDataThreshold;
0107 
0108   /// The version of the SDK which was used during the compilation.
0109   /// The option is used for two different purposes:
0110   /// * on darwin the version is propagated to LLVM where it's used
0111   ///   to support SDK Version metadata (See D55673).
0112   /// * CUDA compilation uses it to control parts of CUDA compilation
0113   ///   in clang that depend on specific version of the CUDA SDK.
0114   llvm::VersionTuple SDKVersion;
0115 
0116   /// The name of the darwin target- ariant triple to compile for.
0117   std::string DarwinTargetVariantTriple;
0118 
0119   /// The version of the darwin target variant SDK which was used during the
0120   /// compilation.
0121   llvm::VersionTuple DarwinTargetVariantSDKVersion;
0122 
0123   /// The validator version for dxil.
0124   std::string DxilValidatorVersion;
0125 
0126   /// The entry point name for HLSL shader being compiled as specified by -E.
0127   std::string HLSLEntry;
0128 };
0129 
0130 } // end namespace clang
0131 
0132 #endif