1 //===--- DirectX.h - Declare DirectX target feature support -----*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // This file declares DXIL TargetInfo objects.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_DIRECTX_H
14 #define LLVM_CLANG_LIB_BASIC_TARGETS_DIRECTX_H
15 #include "clang/Basic/TargetInfo.h"
16 #include "clang/Basic/TargetOptions.h"
17 #include "llvm/ADT/Triple.h"
18 #include "llvm/Support/Compiler.h"
23 static const unsigned DirectXAddrSpaceMap
[] = {
30 5, // opencl_global_device
31 6, // opencl_global_host
35 // SYCL address space values for this map are dummy
37 0, // sycl_global_device
38 0, // sycl_global_host
46 class LLVM_LIBRARY_VISIBILITY DirectXTargetInfo
: public TargetInfo
{
48 DirectXTargetInfo(const llvm::Triple
&Triple
, const TargetOptions
&)
49 : TargetInfo(Triple
) {
52 LongWidth
= LongAlign
= 64;
53 AddrSpaceMap
= &DirectXAddrSpaceMap
;
54 UseAddrSpaceMapMangling
= true;
55 HasLegalHalfType
= true;
58 PlatformMinVersion
= Triple
.getOSVersion();
59 PlatformName
= llvm::Triple::getOSTypeName(Triple
.getOS());
60 resetDataLayout("e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:"
61 "32-f64:64-n8:16:32:64");
62 TheCXXABI
.set(TargetCXXABI::Microsoft
);
64 bool useFP16ConversionIntrinsics() const override
{ return false; }
65 void getTargetDefines(const LangOptions
&Opts
,
66 MacroBuilder
&Builder
) const override
;
68 bool hasFeature(StringRef Feature
) const override
{
69 return Feature
== "directx";
72 ArrayRef
<Builtin::Info
> getTargetBuiltins() const override
{ return None
; }
74 const char *getClobbers() const override
{ return ""; }
76 ArrayRef
<const char *> getGCCRegNames() const override
{ return None
; }
78 bool validateAsmConstraint(const char *&Name
,
79 TargetInfo::ConstraintInfo
&info
) const override
{
83 ArrayRef
<TargetInfo::GCCRegAlias
> getGCCRegAliases() const override
{
87 BuiltinVaListKind
getBuiltinVaListKind() const override
{
88 return TargetInfo::VoidPtrBuiltinVaList
;
92 } // namespace targets
95 #endif // LLVM_CLANG_LIB_BASIC_TARGETS_DIRECTX_H