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