clang 23.0.0git
DirectX.h
Go to the documentation of this file.
1//===--- DirectX.h - Declare DirectX target feature support -----*- 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// This file declares DXIL TargetInfo objects.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_CLANG_LIB_BASIC_TARGETS_DIRECTX_H
14#define LLVM_CLANG_LIB_BASIC_TARGETS_DIRECTX_H
17#include "llvm/Support/Compiler.h"
18#include "llvm/TargetParser/Triple.h"
19
20namespace clang {
21namespace targets {
22
23static const unsigned DirectXAddrSpaceMap[] = {
24 0, // Default
25 1, // opencl_global
26 3, // opencl_local
27 2, // opencl_constant
28 0, // opencl_private
29 4, // opencl_generic
30 5, // opencl_global_device
31 6, // opencl_global_host
32 0, // cuda_device
33 0, // cuda_constant
34 0, // cuda_shared
35 // SYCL address space values for this map are dummy
36 0, // sycl_global
37 0, // sycl_global_device
38 0, // sycl_global_host
39 0, // sycl_local
40 0, // sycl_private
41 0, // ptr32_sptr
42 0, // ptr32_uptr
43 0, // ptr64
44 3, // hlsl_groupshared
45 2, // hlsl_constant
46 0, // hlsl_private
47 0, // hlsl_device
48 0, // hlsl_input
49 0, // hlsl_output
50 0, // hlsl_push_constant
51 // Wasm address space values for this target are dummy values,
52 // as it is only enabled for Wasm targets.
53 20, // wasm_funcref
54};
55
56class LLVM_LIBRARY_VISIBILITY DirectXTargetInfo : public TargetInfo {
57public:
58 DirectXTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
59 : TargetInfo(Triple) {
60 TLSSupported = false;
61 VLASupported = false;
64 HasFastHalfType = true;
65 HasFloat16 = true;
66 NoAsmVariants = true;
68 PlatformMinVersion = Triple.getOSVersion();
69 PlatformName = llvm::Triple::getOSTypeName(Triple.getOS());
71 TheCXXABI.set(TargetCXXABI::GenericItanium);
72 }
73 bool useFP16ConversionIntrinsics() const override { return false; }
74 void getTargetDefines(const LangOptions &Opts,
75 MacroBuilder &Builder) const override;
76
77 bool hasFeature(StringRef Feature) const override {
78 return Feature == "directx";
79 }
80
81 llvm::SmallVector<Builtin::InfosShard> getTargetBuiltins() const override;
82
83 std::string_view getClobbers() const override { return ""; }
84
85 ArrayRef<const char *> getGCCRegNames() const override { return {}; }
86
87 bool validateAsmConstraint(const char *&Name,
88 TargetInfo::ConstraintInfo &info) const override {
89 return true;
90 }
91
93 return {};
94 }
95
99
101 const TargetInfo *Aux) override {
102 TargetInfo::adjust(Diags, Opts, Aux);
103 // The static values this addresses do not apply outside of the same thread
104 // This protection is neither available nor needed
105 Opts.ThreadsafeStatics = false;
106 }
107};
108
109} // namespace targets
110} // namespace clang
111
112#endif // LLVM_CLANG_LIB_BASIC_TARGETS_DIRECTX_H
Defines the clang::TargetOptions class.
Concrete class used by the front-end to report problems and issues.
Definition Diagnostic.h:233
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
TargetInfo(const llvm::Triple &T)
const LangASMap * AddrSpaceMap
Definition TargetInfo.h:260
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
Definition TargetInfo.h:334
@ VoidPtrBuiltinVaList
typedef void* __builtin_va_list;
Definition TargetInfo.h:339
VersionTuple PlatformMinVersion
Definition TargetInfo.h:263
virtual void adjust(DiagnosticsEngine &Diags, LangOptions &Opts, const TargetInfo *Aux)
Set forced language options.
void resetDataLayout(StringRef DL)
Set the data layout to the given string.
StringRef PlatformName
Definition TargetInfo.h:262
bool UseAddrSpaceMapMangling
Specify if mangling based on address space map should be used or not for language specific address sp...
Definition TargetInfo.h:386
TargetCXXABI TheCXXABI
Definition TargetInfo.h:258
Options for controlling the target.
std::string_view getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
Definition DirectX.h:83
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition DirectX.h:96
ArrayRef< TargetInfo::GCCRegAlias > getGCCRegAliases() const override
Definition DirectX.h:92
bool useFP16ConversionIntrinsics() const override
Check whether conversions to and from __fp16 should go through an integer bitcast with i16.
Definition DirectX.h:73
ArrayRef< const char * > getGCCRegNames() const override
Definition DirectX.h:85
bool hasFeature(StringRef Feature) const override
Determine whether the given target has the given feature.
Definition DirectX.h:77
bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &info) const override
Definition DirectX.h:87
DirectXTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
Definition DirectX.h:58
void adjust(DiagnosticsEngine &Diags, LangOptions &Opts, const TargetInfo *Aux) override
Set forced language options.
Definition DirectX.h:100
Defines the clang::TargetInfo interface.
static const unsigned DirectXAddrSpaceMap[]
Definition DirectX.h:23
The JSON file list parser is used to communicate input to InstallAPI.