13#ifndef LLVM_CLANG_LIB_BASIC_TARGETS_NVPTX_H
14#define LLVM_CLANG_LIB_BASIC_TARGETS_NVPTX_H
19#include "llvm/Support/Compiler.h"
20#include "llvm/TargetParser/Triple.h"
64 static const char *
const GCCRegNames[];
67 std::unique_ptr<TargetInfo> HostTarget;
71 unsigned TargetPointerWidth);
83 const std::vector<std::string> &FeaturesVec)
const override {
84 if (GPU != OffloadArch::UNUSED)
86 Features[
"ptx" + std::to_string(PTXVersion)] =
true;
87 return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec);
90 bool hasFeature(StringRef Feature)
const override;
122 return TargetInfo::CharPtrBuiltinVaList;
130 for (
int i =
static_cast<int>(OffloadArch::SM_20);
131 i < static_cast<int>(OffloadArch::Generic); ++i)
135 bool setCPU(
const std::string &Name)
override {
137 return GPU != OffloadArch::UNKNOWN;
141 auto &Opts = getSupportedOpenCLOpts();
142 Opts[
"cl_clang_storage_class_specifiers"] =
true;
143 Opts[
"__cl_clang_function_pointers"] =
true;
144 Opts[
"__cl_clang_variadic_functions"] =
true;
145 Opts[
"__cl_clang_non_portable_kernel_param_types"] =
true;
146 Opts[
"__cl_clang_bitfields"] =
true;
148 Opts[
"cl_khr_fp64"] =
true;
149 Opts[
"__opencl_c_fp64"] =
true;
150 Opts[
"cl_khr_byte_addressable_store"] =
true;
151 Opts[
"cl_khr_global_int32_base_atomics"] =
true;
152 Opts[
"cl_khr_global_int32_extended_atomics"] =
true;
153 Opts[
"cl_khr_local_int32_base_atomics"] =
true;
154 Opts[
"cl_khr_local_int32_extended_atomics"] =
true;
158 return llvm::omp::NVPTXGridValues;
167 std::optional<unsigned>
181 return HostTarget->checkCallingConvention(CC);
static bool hasFeature(StringRef Feature, const LangOptions &LangOpts, const TargetInfo &Target)
Determine whether a translation unit built using the current language options has the given feature.
Defines the clang::TargetOptions class.
Concrete class used by the front-end to report problems and issues.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Exposes information about the current target.
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
Options for controlling the target.
bool hasBitIntType() const override
Determine whether the _BitInt type is supported on this target.
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
OffloadArch getGPU() const
ArrayRef< TargetInfo::GCCRegAlias > getGCCRegAliases() const override
void fillValidCPUList(SmallVectorImpl< StringRef > &Values) const override
Fill a SmallVectorImpl with the valid values to setCPU.
bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &Info) const override
bool hasBFloat16Type() const override
Determine whether the _BFloat16 type is supported on this target.
std::string_view getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
std::optional< unsigned > getDWARFAddressSpace(unsigned AddressSpace) const override
const llvm::omp::GV & getGridValue() const override
bool setCPU(const std::string &Name) override
Target the specified CPU.
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
bool isValidCPUName(StringRef Name) const override
Determine whether this TargetInfo supports the given CPU name.
bool useFP16ConversionIntrinsics() const override
Check whether llvm intrinsics such as llvm.convert.to.fp16 should be used to convert to and from __fp...
bool initFeatureMap(llvm::StringMap< bool > &Features, DiagnosticsEngine &Diags, StringRef CPU, const std::vector< std::string > &FeaturesVec) const override
Initialize the map with the default set of target features for the CPU this should include all legal ...
void setSupportedOpenCLOpts() override
Set supported OpenCL extensions and optional core features.
Defines the clang::TargetInfo interface.
static const unsigned NVPTXAddrSpaceMap[]
static const int NVPTXDWARFAddrSpaceMap[]
The DWARF address class.
The JSON file list parser is used to communicate input to InstallAPI.
OffloadArch StringToOffloadArch(llvm::StringRef S)
const char * OffloadArchToString(OffloadArch A)
CallingConv
CallingConv - Specifies the calling convention that a function uses.