clang 17.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/ADT/Triple.h"
18#include "llvm/Support/Compiler.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};
46
47class LLVM_LIBRARY_VISIBILITY DirectXTargetInfo : public TargetInfo {
48public:
49 DirectXTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
50 : TargetInfo(Triple) {
51 TLSSupported = false;
52 VLASupported = false;
53 LongWidth = LongAlign = 64;
54 AddrSpaceMap = &DirectXAddrSpaceMap;
55 UseAddrSpaceMapMangling = true;
56 HasLegalHalfType = true;
57 HasFloat16 = true;
58 NoAsmVariants = true;
59 PlatformMinVersion = Triple.getOSVersion();
60 PlatformName = llvm::Triple::getOSTypeName(Triple.getOS());
61 resetDataLayout("e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:"
62 "32-f64:64-n8:16:32:64");
63 TheCXXABI.set(TargetCXXABI::Microsoft);
64 }
65 bool useFP16ConversionIntrinsics() const override { return false; }
66 void getTargetDefines(const LangOptions &Opts,
67 MacroBuilder &Builder) const override;
68
69 bool hasFeature(StringRef Feature) const override {
70 return Feature == "directx";
71 }
72
74 return std::nullopt;
75 }
76
77 const char *getClobbers() const override { return ""; }
78
80 return std::nullopt;
81 }
82
83 bool validateAsmConstraint(const char *&Name,
84 TargetInfo::ConstraintInfo &info) const override {
85 return true;
86 }
87
89 return std::nullopt;
90 }
91
93 return TargetInfo::VoidPtrBuiltinVaList;
94 }
95};
96
97} // namespace targets
98} // namespace clang
99
100#endif // LLVM_CLANG_LIB_BASIC_TARGETS_DIRECTX_H
Defines the clang::TargetOptions class.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:82
Exposes information about the current target.
Definition: TargetInfo.h:206
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
Definition: TargetInfo.h:288
Options for controlling the target.
Definition: TargetOptions.h:26
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
Definition: DirectX.h:92
ArrayRef< TargetInfo::GCCRegAlias > getGCCRegAliases() const override
Definition: DirectX.h:88
bool useFP16ConversionIntrinsics() const override
Check whether llvm intrinsics such as llvm.convert.to.fp16 should be used to convert to and from __fp...
Definition: DirectX.h:65
ArrayRef< Builtin::Info > getTargetBuiltins() const override
Return information about target-specific builtins for the current primary target, and info about whic...
Definition: DirectX.h:73
ArrayRef< const char * > getGCCRegNames() const override
Definition: DirectX.h:79
bool hasFeature(StringRef Feature) const override
Determine whether the given target has the given feature.
Definition: DirectX.h:69
bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &info) const override
Definition: DirectX.h:83
DirectXTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
Definition: DirectX.h:49
const char * getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
Definition: DirectX.h:77
Defines the clang::TargetInfo interface.
static const unsigned DirectXAddrSpaceMap[]
Definition: DirectX.h:23