1349cc55cSDimitry Andric //===--- SPIR.h - Declare SPIR and SPIR-V target feature support *- C++ -*-===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric // 9349cc55cSDimitry Andric // This file declares SPIR and SPIR-V TargetInfo objects. 100b57cec5SDimitry Andric // 110b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 120b57cec5SDimitry Andric 130b57cec5SDimitry Andric #ifndef LLVM_CLANG_LIB_BASIC_TARGETS_SPIR_H 140b57cec5SDimitry Andric #define LLVM_CLANG_LIB_BASIC_TARGETS_SPIR_H 150b57cec5SDimitry Andric 16*06c3fb27SDimitry Andric #include "Targets.h" 170b57cec5SDimitry Andric #include "clang/Basic/TargetInfo.h" 180b57cec5SDimitry Andric #include "clang/Basic/TargetOptions.h" 190b57cec5SDimitry Andric #include "llvm/Support/Compiler.h" 20*06c3fb27SDimitry Andric #include "llvm/TargetParser/Triple.h" 21bdd1243dSDimitry Andric #include <optional> 220b57cec5SDimitry Andric 230b57cec5SDimitry Andric namespace clang { 240b57cec5SDimitry Andric namespace targets { 250b57cec5SDimitry Andric 26349cc55cSDimitry Andric // Used by both the SPIR and SPIR-V targets. 27fe6060f1SDimitry Andric static const unsigned SPIRDefIsPrivMap[] = { 280b57cec5SDimitry Andric 0, // Default 290b57cec5SDimitry Andric 1, // opencl_global 300b57cec5SDimitry Andric 3, // opencl_local 310b57cec5SDimitry Andric 2, // opencl_constant 320b57cec5SDimitry Andric 0, // opencl_private 330b57cec5SDimitry Andric 4, // opencl_generic 34e8d8bef9SDimitry Andric 5, // opencl_global_device 35e8d8bef9SDimitry Andric 6, // opencl_global_host 360b57cec5SDimitry Andric 0, // cuda_device 370b57cec5SDimitry Andric 0, // cuda_constant 38480093f4SDimitry Andric 0, // cuda_shared 39fe6060f1SDimitry Andric // SYCL address space values for this map are dummy 40fe6060f1SDimitry Andric 0, // sycl_global 41fe6060f1SDimitry Andric 0, // sycl_global_device 42fe6060f1SDimitry Andric 0, // sycl_global_host 43fe6060f1SDimitry Andric 0, // sycl_local 44fe6060f1SDimitry Andric 0, // sycl_private 45fe6060f1SDimitry Andric 0, // ptr32_sptr 46fe6060f1SDimitry Andric 0, // ptr32_uptr 47bdd1243dSDimitry Andric 0, // ptr64 48bdd1243dSDimitry Andric 0, // hlsl_groupshared 49*06c3fb27SDimitry Andric // Wasm address space values for this target are dummy values, 50*06c3fb27SDimitry Andric // as it is only enabled for Wasm targets. 51*06c3fb27SDimitry Andric 20, // wasm_funcref 52fe6060f1SDimitry Andric }; 53fe6060f1SDimitry Andric 54349cc55cSDimitry Andric // Used by both the SPIR and SPIR-V targets. 55fe6060f1SDimitry Andric static const unsigned SPIRDefIsGenMap[] = { 56fe6060f1SDimitry Andric 4, // Default 57fe6060f1SDimitry Andric // OpenCL address space values for this map are dummy and they can't be used 58fe6060f1SDimitry Andric 0, // opencl_global 59fe6060f1SDimitry Andric 0, // opencl_local 60fe6060f1SDimitry Andric 0, // opencl_constant 61fe6060f1SDimitry Andric 0, // opencl_private 62fe6060f1SDimitry Andric 0, // opencl_generic 63fe6060f1SDimitry Andric 0, // opencl_global_device 64fe6060f1SDimitry Andric 0, // opencl_global_host 654824e7fdSDimitry Andric // cuda_* address space mapping is intended for HIPSPV (HIP to SPIR-V 664824e7fdSDimitry Andric // translation). This mapping is enabled when the language mode is HIP. 674824e7fdSDimitry Andric 1, // cuda_device 684824e7fdSDimitry Andric // cuda_constant pointer can be casted to default/"flat" pointer, but in 694824e7fdSDimitry Andric // SPIR-V casts between constant and generic pointers are not allowed. For 704824e7fdSDimitry Andric // this reason cuda_constant is mapped to SPIR-V CrossWorkgroup. 714824e7fdSDimitry Andric 1, // cuda_constant 724824e7fdSDimitry Andric 3, // cuda_shared 73fe6060f1SDimitry Andric 1, // sycl_global 74fe6060f1SDimitry Andric 5, // sycl_global_device 75fe6060f1SDimitry Andric 6, // sycl_global_host 76fe6060f1SDimitry Andric 3, // sycl_local 77fe6060f1SDimitry Andric 0, // sycl_private 78480093f4SDimitry Andric 0, // ptr32_sptr 79480093f4SDimitry Andric 0, // ptr32_uptr 80bdd1243dSDimitry Andric 0, // ptr64 81bdd1243dSDimitry Andric 0, // hlsl_groupshared 82*06c3fb27SDimitry Andric // Wasm address space values for this target are dummy values, 83*06c3fb27SDimitry Andric // as it is only enabled for Wasm targets. 84*06c3fb27SDimitry Andric 20, // wasm_funcref 850b57cec5SDimitry Andric }; 860b57cec5SDimitry Andric 87349cc55cSDimitry Andric // Base class for SPIR and SPIR-V target info. 88349cc55cSDimitry Andric class LLVM_LIBRARY_VISIBILITY BaseSPIRTargetInfo : public TargetInfo { 89*06c3fb27SDimitry Andric std::unique_ptr<TargetInfo> HostTarget; 90*06c3fb27SDimitry Andric 91349cc55cSDimitry Andric protected: 92*06c3fb27SDimitry Andric BaseSPIRTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) 930b57cec5SDimitry Andric : TargetInfo(Triple) { 944824e7fdSDimitry Andric assert((Triple.isSPIR() || Triple.isSPIRV()) && 954824e7fdSDimitry Andric "Invalid architecture for SPIR or SPIR-V."); 960b57cec5SDimitry Andric assert(getTriple().getOS() == llvm::Triple::UnknownOS && 97349cc55cSDimitry Andric "SPIR(-V) target must use unknown OS"); 980b57cec5SDimitry Andric assert(getTriple().getEnvironment() == llvm::Triple::UnknownEnvironment && 99349cc55cSDimitry Andric "SPIR(-V) target must use unknown environment type"); 1000b57cec5SDimitry Andric TLSSupported = false; 1010b57cec5SDimitry Andric VLASupported = false; 1020b57cec5SDimitry Andric LongWidth = LongAlign = 64; 103fe6060f1SDimitry Andric AddrSpaceMap = &SPIRDefIsPrivMap; 1040b57cec5SDimitry Andric UseAddrSpaceMapMangling = true; 1050b57cec5SDimitry Andric HasLegalHalfType = true; 1060b57cec5SDimitry Andric HasFloat16 = true; 1070b57cec5SDimitry Andric // Define available target features 1080b57cec5SDimitry Andric // These must be defined in sorted order! 1090b57cec5SDimitry Andric NoAsmVariants = true; 110*06c3fb27SDimitry Andric 111*06c3fb27SDimitry Andric llvm::Triple HostTriple(Opts.HostTriple); 112*06c3fb27SDimitry Andric if (!HostTriple.isSPIR() && !HostTriple.isSPIRV() && 113*06c3fb27SDimitry Andric HostTriple.getArch() != llvm::Triple::UnknownArch) { 114*06c3fb27SDimitry Andric HostTarget = AllocateTarget(llvm::Triple(Opts.HostTriple), Opts); 115*06c3fb27SDimitry Andric 116*06c3fb27SDimitry Andric // Copy properties from host target. 117*06c3fb27SDimitry Andric BoolWidth = HostTarget->getBoolWidth(); 118*06c3fb27SDimitry Andric BoolAlign = HostTarget->getBoolAlign(); 119*06c3fb27SDimitry Andric IntWidth = HostTarget->getIntWidth(); 120*06c3fb27SDimitry Andric IntAlign = HostTarget->getIntAlign(); 121*06c3fb27SDimitry Andric HalfWidth = HostTarget->getHalfWidth(); 122*06c3fb27SDimitry Andric HalfAlign = HostTarget->getHalfAlign(); 123*06c3fb27SDimitry Andric FloatWidth = HostTarget->getFloatWidth(); 124*06c3fb27SDimitry Andric FloatAlign = HostTarget->getFloatAlign(); 125*06c3fb27SDimitry Andric DoubleWidth = HostTarget->getDoubleWidth(); 126*06c3fb27SDimitry Andric DoubleAlign = HostTarget->getDoubleAlign(); 127*06c3fb27SDimitry Andric LongWidth = HostTarget->getLongWidth(); 128*06c3fb27SDimitry Andric LongAlign = HostTarget->getLongAlign(); 129*06c3fb27SDimitry Andric LongLongWidth = HostTarget->getLongLongWidth(); 130*06c3fb27SDimitry Andric LongLongAlign = HostTarget->getLongLongAlign(); 131*06c3fb27SDimitry Andric MinGlobalAlign = HostTarget->getMinGlobalAlign(/* TypeSize = */ 0); 132*06c3fb27SDimitry Andric NewAlign = HostTarget->getNewAlign(); 133*06c3fb27SDimitry Andric DefaultAlignForAttributeAligned = 134*06c3fb27SDimitry Andric HostTarget->getDefaultAlignForAttributeAligned(); 135*06c3fb27SDimitry Andric IntMaxType = HostTarget->getIntMaxType(); 136*06c3fb27SDimitry Andric WCharType = HostTarget->getWCharType(); 137*06c3fb27SDimitry Andric WIntType = HostTarget->getWIntType(); 138*06c3fb27SDimitry Andric Char16Type = HostTarget->getChar16Type(); 139*06c3fb27SDimitry Andric Char32Type = HostTarget->getChar32Type(); 140*06c3fb27SDimitry Andric Int64Type = HostTarget->getInt64Type(); 141*06c3fb27SDimitry Andric SigAtomicType = HostTarget->getSigAtomicType(); 142*06c3fb27SDimitry Andric ProcessIDType = HostTarget->getProcessIDType(); 143*06c3fb27SDimitry Andric 144*06c3fb27SDimitry Andric UseBitFieldTypeAlignment = HostTarget->useBitFieldTypeAlignment(); 145*06c3fb27SDimitry Andric UseZeroLengthBitfieldAlignment = 146*06c3fb27SDimitry Andric HostTarget->useZeroLengthBitfieldAlignment(); 147*06c3fb27SDimitry Andric UseExplicitBitFieldAlignment = HostTarget->useExplicitBitFieldAlignment(); 148*06c3fb27SDimitry Andric ZeroLengthBitfieldBoundary = HostTarget->getZeroLengthBitfieldBoundary(); 149*06c3fb27SDimitry Andric 150*06c3fb27SDimitry Andric // This is a bit of a lie, but it controls __GCC_ATOMIC_XXX_LOCK_FREE, and 151*06c3fb27SDimitry Andric // we need those macros to be identical on host and device, because (among 152*06c3fb27SDimitry Andric // other things) they affect which standard library classes are defined, 153*06c3fb27SDimitry Andric // and we need all classes to be defined on both the host and device. 154*06c3fb27SDimitry Andric MaxAtomicInlineWidth = HostTarget->getMaxAtomicInlineWidth(); 155*06c3fb27SDimitry Andric } 1560b57cec5SDimitry Andric } 1570b57cec5SDimitry Andric 158349cc55cSDimitry Andric public: 1590b57cec5SDimitry Andric // SPIR supports the half type and the only llvm intrinsic allowed in SPIR is 1600b57cec5SDimitry Andric // memcpy as per section 3 of the SPIR spec. 1610b57cec5SDimitry Andric bool useFP16ConversionIntrinsics() const override { return false; } 1620b57cec5SDimitry Andric 163bdd1243dSDimitry Andric ArrayRef<Builtin::Info> getTargetBuiltins() const override { 164bdd1243dSDimitry Andric return std::nullopt; 165bdd1243dSDimitry Andric } 1660b57cec5SDimitry Andric 167*06c3fb27SDimitry Andric std::string_view getClobbers() const override { return ""; } 1680b57cec5SDimitry Andric 169bdd1243dSDimitry Andric ArrayRef<const char *> getGCCRegNames() const override { 170bdd1243dSDimitry Andric return std::nullopt; 171bdd1243dSDimitry Andric } 1720b57cec5SDimitry Andric 1730b57cec5SDimitry Andric bool validateAsmConstraint(const char *&Name, 1740b57cec5SDimitry Andric TargetInfo::ConstraintInfo &info) const override { 1750b57cec5SDimitry Andric return true; 1760b57cec5SDimitry Andric } 1770b57cec5SDimitry Andric 1780b57cec5SDimitry Andric ArrayRef<TargetInfo::GCCRegAlias> getGCCRegAliases() const override { 179bdd1243dSDimitry Andric return std::nullopt; 1800b57cec5SDimitry Andric } 1810b57cec5SDimitry Andric 1820b57cec5SDimitry Andric BuiltinVaListKind getBuiltinVaListKind() const override { 1830b57cec5SDimitry Andric return TargetInfo::VoidPtrBuiltinVaList; 1840b57cec5SDimitry Andric } 1850b57cec5SDimitry Andric 186bdd1243dSDimitry Andric std::optional<unsigned> 187fe6060f1SDimitry Andric getDWARFAddressSpace(unsigned AddressSpace) const override { 188fe6060f1SDimitry Andric return AddressSpace; 189fe6060f1SDimitry Andric } 190fe6060f1SDimitry Andric 1910b57cec5SDimitry Andric CallingConvCheckResult checkCallingConvention(CallingConv CC) const override { 1920b57cec5SDimitry Andric return (CC == CC_SpirFunction || CC == CC_OpenCLKernel) ? CCCR_OK 1930b57cec5SDimitry Andric : CCCR_Warning; 1940b57cec5SDimitry Andric } 1950b57cec5SDimitry Andric 1960b57cec5SDimitry Andric CallingConv getDefaultCallingConv() const override { 1970b57cec5SDimitry Andric return CC_SpirFunction; 1980b57cec5SDimitry Andric } 1990b57cec5SDimitry Andric 200fe6060f1SDimitry Andric void setAddressSpaceMap(bool DefaultIsGeneric) { 201fe6060f1SDimitry Andric AddrSpaceMap = DefaultIsGeneric ? &SPIRDefIsGenMap : &SPIRDefIsPrivMap; 202fe6060f1SDimitry Andric } 203fe6060f1SDimitry Andric 204fe6060f1SDimitry Andric void adjust(DiagnosticsEngine &Diags, LangOptions &Opts) override { 205fe6060f1SDimitry Andric TargetInfo::adjust(Diags, Opts); 206fe6060f1SDimitry Andric // FIXME: SYCL specification considers unannotated pointers and references 207fe6060f1SDimitry Andric // to be pointing to the generic address space. See section 5.9.3 of 208fe6060f1SDimitry Andric // SYCL 2020 specification. 20981ad6265SDimitry Andric // Currently, there is no way of representing SYCL's and HIP/CUDA's default 2104824e7fdSDimitry Andric // address space language semantic along with the semantics of embedded C's 2114824e7fdSDimitry Andric // default address space in the same address space map. Hence the map needs 2124824e7fdSDimitry Andric // to be reset to allow mapping to the desired value of 'Default' entry for 21381ad6265SDimitry Andric // SYCL and HIP/CUDA. 2144824e7fdSDimitry Andric setAddressSpaceMap( 2154824e7fdSDimitry Andric /*DefaultIsGeneric=*/Opts.SYCLIsDevice || 21681ad6265SDimitry Andric // The address mapping from HIP/CUDA language for device code is only 21781ad6265SDimitry Andric // defined for SPIR-V. 21881ad6265SDimitry Andric (getTriple().isSPIRV() && Opts.CUDAIsDevice)); 219fe6060f1SDimitry Andric } 220fe6060f1SDimitry Andric 2210b57cec5SDimitry Andric void setSupportedOpenCLOpts() override { 2220b57cec5SDimitry Andric // Assume all OpenCL extensions and optional core features are supported 223349cc55cSDimitry Andric // for SPIR and SPIR-V since they are generic targets. 224e8d8bef9SDimitry Andric supportAllOpenCLOpts(); 2250b57cec5SDimitry Andric } 2265ffd83dbSDimitry Andric 2270eae32dcSDimitry Andric bool hasBitIntType() const override { return true; } 228e8d8bef9SDimitry Andric 229e8d8bef9SDimitry Andric bool hasInt128Type() const override { return false; } 2300b57cec5SDimitry Andric }; 231fe6060f1SDimitry Andric 232349cc55cSDimitry Andric class LLVM_LIBRARY_VISIBILITY SPIRTargetInfo : public BaseSPIRTargetInfo { 233349cc55cSDimitry Andric public: 234349cc55cSDimitry Andric SPIRTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) 235349cc55cSDimitry Andric : BaseSPIRTargetInfo(Triple, Opts) { 2364824e7fdSDimitry Andric assert(Triple.isSPIR() && "Invalid architecture for SPIR."); 237349cc55cSDimitry Andric assert(getTriple().getOS() == llvm::Triple::UnknownOS && 238349cc55cSDimitry Andric "SPIR target must use unknown OS"); 239349cc55cSDimitry Andric assert(getTriple().getEnvironment() == llvm::Triple::UnknownEnvironment && 240349cc55cSDimitry Andric "SPIR target must use unknown environment type"); 241349cc55cSDimitry Andric } 242349cc55cSDimitry Andric 243349cc55cSDimitry Andric void getTargetDefines(const LangOptions &Opts, 244349cc55cSDimitry Andric MacroBuilder &Builder) const override; 245349cc55cSDimitry Andric 246349cc55cSDimitry Andric bool hasFeature(StringRef Feature) const override { 247349cc55cSDimitry Andric return Feature == "spir"; 248349cc55cSDimitry Andric } 249*06c3fb27SDimitry Andric 250*06c3fb27SDimitry Andric bool checkArithmeticFenceSupported() const override { return true; } 251349cc55cSDimitry Andric }; 252349cc55cSDimitry Andric 2530b57cec5SDimitry Andric class LLVM_LIBRARY_VISIBILITY SPIR32TargetInfo : public SPIRTargetInfo { 2540b57cec5SDimitry Andric public: 2550b57cec5SDimitry Andric SPIR32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) 2560b57cec5SDimitry Andric : SPIRTargetInfo(Triple, Opts) { 2574824e7fdSDimitry Andric assert(Triple.getArch() == llvm::Triple::spir && 2584824e7fdSDimitry Andric "Invalid architecture for 32-bit SPIR."); 2590b57cec5SDimitry Andric PointerWidth = PointerAlign = 32; 2600b57cec5SDimitry Andric SizeType = TargetInfo::UnsignedInt; 2610b57cec5SDimitry Andric PtrDiffType = IntPtrType = TargetInfo::SignedInt; 2620b57cec5SDimitry Andric resetDataLayout("e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-" 2630b57cec5SDimitry Andric "v96:128-v192:256-v256:256-v512:512-v1024:1024"); 2640b57cec5SDimitry Andric } 2650b57cec5SDimitry Andric 2660b57cec5SDimitry Andric void getTargetDefines(const LangOptions &Opts, 2670b57cec5SDimitry Andric MacroBuilder &Builder) const override; 2680b57cec5SDimitry Andric }; 2690b57cec5SDimitry Andric 2700b57cec5SDimitry Andric class LLVM_LIBRARY_VISIBILITY SPIR64TargetInfo : public SPIRTargetInfo { 2710b57cec5SDimitry Andric public: 2720b57cec5SDimitry Andric SPIR64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) 2730b57cec5SDimitry Andric : SPIRTargetInfo(Triple, Opts) { 2744824e7fdSDimitry Andric assert(Triple.getArch() == llvm::Triple::spir64 && 2754824e7fdSDimitry Andric "Invalid architecture for 64-bit SPIR."); 2760b57cec5SDimitry Andric PointerWidth = PointerAlign = 64; 2770b57cec5SDimitry Andric SizeType = TargetInfo::UnsignedLong; 2780b57cec5SDimitry Andric PtrDiffType = IntPtrType = TargetInfo::SignedLong; 2790b57cec5SDimitry Andric resetDataLayout("e-i64:64-v16:16-v24:32-v32:32-v48:64-" 2800b57cec5SDimitry Andric "v96:128-v192:256-v256:256-v512:512-v1024:1024"); 2810b57cec5SDimitry Andric } 2820b57cec5SDimitry Andric 2830b57cec5SDimitry Andric void getTargetDefines(const LangOptions &Opts, 2840b57cec5SDimitry Andric MacroBuilder &Builder) const override; 2850b57cec5SDimitry Andric }; 286349cc55cSDimitry Andric 287349cc55cSDimitry Andric class LLVM_LIBRARY_VISIBILITY SPIRVTargetInfo : public BaseSPIRTargetInfo { 288349cc55cSDimitry Andric public: 289349cc55cSDimitry Andric SPIRVTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) 290349cc55cSDimitry Andric : BaseSPIRTargetInfo(Triple, Opts) { 2914824e7fdSDimitry Andric assert(Triple.isSPIRV() && "Invalid architecture for SPIR-V."); 292349cc55cSDimitry Andric assert(getTriple().getOS() == llvm::Triple::UnknownOS && 293349cc55cSDimitry Andric "SPIR-V target must use unknown OS"); 294349cc55cSDimitry Andric assert(getTriple().getEnvironment() == llvm::Triple::UnknownEnvironment && 295349cc55cSDimitry Andric "SPIR-V target must use unknown environment type"); 296349cc55cSDimitry Andric } 297349cc55cSDimitry Andric 298349cc55cSDimitry Andric void getTargetDefines(const LangOptions &Opts, 299349cc55cSDimitry Andric MacroBuilder &Builder) const override; 300349cc55cSDimitry Andric 301349cc55cSDimitry Andric bool hasFeature(StringRef Feature) const override { 302349cc55cSDimitry Andric return Feature == "spirv"; 303349cc55cSDimitry Andric } 304349cc55cSDimitry Andric }; 305349cc55cSDimitry Andric 306349cc55cSDimitry Andric class LLVM_LIBRARY_VISIBILITY SPIRV32TargetInfo : public SPIRVTargetInfo { 307349cc55cSDimitry Andric public: 308349cc55cSDimitry Andric SPIRV32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) 309349cc55cSDimitry Andric : SPIRVTargetInfo(Triple, Opts) { 3104824e7fdSDimitry Andric assert(Triple.getArch() == llvm::Triple::spirv32 && 3114824e7fdSDimitry Andric "Invalid architecture for 32-bit SPIR-V."); 312349cc55cSDimitry Andric PointerWidth = PointerAlign = 32; 313349cc55cSDimitry Andric SizeType = TargetInfo::UnsignedInt; 314349cc55cSDimitry Andric PtrDiffType = IntPtrType = TargetInfo::SignedInt; 315349cc55cSDimitry Andric resetDataLayout("e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-" 316349cc55cSDimitry Andric "v96:128-v192:256-v256:256-v512:512-v1024:1024"); 317349cc55cSDimitry Andric } 318349cc55cSDimitry Andric 319349cc55cSDimitry Andric void getTargetDefines(const LangOptions &Opts, 320349cc55cSDimitry Andric MacroBuilder &Builder) const override; 321349cc55cSDimitry Andric }; 322349cc55cSDimitry Andric 323349cc55cSDimitry Andric class LLVM_LIBRARY_VISIBILITY SPIRV64TargetInfo : public SPIRVTargetInfo { 324349cc55cSDimitry Andric public: 325349cc55cSDimitry Andric SPIRV64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) 326349cc55cSDimitry Andric : SPIRVTargetInfo(Triple, Opts) { 3274824e7fdSDimitry Andric assert(Triple.getArch() == llvm::Triple::spirv64 && 3284824e7fdSDimitry Andric "Invalid architecture for 64-bit SPIR-V."); 329349cc55cSDimitry Andric PointerWidth = PointerAlign = 64; 330349cc55cSDimitry Andric SizeType = TargetInfo::UnsignedLong; 331349cc55cSDimitry Andric PtrDiffType = IntPtrType = TargetInfo::SignedLong; 332349cc55cSDimitry Andric resetDataLayout("e-i64:64-v16:16-v24:32-v32:32-v48:64-" 333349cc55cSDimitry Andric "v96:128-v192:256-v256:256-v512:512-v1024:1024"); 334349cc55cSDimitry Andric } 335349cc55cSDimitry Andric 336349cc55cSDimitry Andric void getTargetDefines(const LangOptions &Opts, 337349cc55cSDimitry Andric MacroBuilder &Builder) const override; 338349cc55cSDimitry Andric }; 339349cc55cSDimitry Andric 3400b57cec5SDimitry Andric } // namespace targets 3410b57cec5SDimitry Andric } // namespace clang 3420b57cec5SDimitry Andric #endif // LLVM_CLANG_LIB_BASIC_TARGETS_SPIR_H 343