13#ifndef LLVM_CLANG_LIB_BASIC_TARGETS_SPIR_H
14#define LLVM_CLANG_LIB_BASIC_TARGETS_SPIR_H
18#include "llvm/ADT/Triple.h"
19#include "llvm/Support/Compiler.h"
85 assert((Triple.isSPIR() || Triple.isSPIRV()) &&
86 "Invalid architecture for SPIR or SPIR-V.");
87 assert(getTriple().getOS() == llvm::Triple::UnknownOS &&
88 "SPIR(-V) target must use unknown OS");
89 assert(getTriple().getEnvironment() == llvm::Triple::UnknownEnvironment &&
90 "SPIR(-V) target must use unknown environment type");
93 LongWidth = LongAlign = 64;
95 UseAddrSpaceMapMangling =
true;
96 HasLegalHalfType =
true;
100 NoAsmVariants =
true;
128 return TargetInfo::VoidPtrBuiltinVaList;
131 std::optional<unsigned>
150 TargetInfo::adjust(Diags, Opts);
163 (getTriple().isSPIRV() && Opts.CUDAIsDevice));
169 supportAllOpenCLOpts();
181 assert(Triple.isSPIR() &&
"Invalid architecture for SPIR.");
182 assert(getTriple().getOS() == llvm::Triple::UnknownOS &&
183 "SPIR target must use unknown OS");
184 assert(getTriple().getEnvironment() == llvm::Triple::UnknownEnvironment &&
185 "SPIR target must use unknown environment type");
192 return Feature ==
"spir";
202 assert(Triple.getArch() == llvm::Triple::spir &&
203 "Invalid architecture for 32-bit SPIR.");
204 PointerWidth = PointerAlign = 32;
205 SizeType = TargetInfo::UnsignedInt;
206 PtrDiffType = IntPtrType = TargetInfo::SignedInt;
207 resetDataLayout(
"e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-"
208 "v96:128-v192:256-v256:256-v512:512-v1024:1024");
219 assert(Triple.getArch() == llvm::Triple::spir64 &&
220 "Invalid architecture for 64-bit SPIR.");
221 PointerWidth = PointerAlign = 64;
222 SizeType = TargetInfo::UnsignedLong;
223 PtrDiffType = IntPtrType = TargetInfo::SignedLong;
224 resetDataLayout(
"e-i64:64-v16:16-v24:32-v32:32-v48:64-"
225 "v96:128-v192:256-v256:256-v512:512-v1024:1024");
236 assert(Triple.isSPIRV() &&
"Invalid architecture for SPIR-V.");
237 assert(getTriple().getOS() == llvm::Triple::UnknownOS &&
238 "SPIR-V target must use unknown OS");
239 assert(getTriple().getEnvironment() == llvm::Triple::UnknownEnvironment &&
240 "SPIR-V target must use unknown environment type");
247 return Feature ==
"spirv";
255 assert(Triple.getArch() == llvm::Triple::spirv32 &&
256 "Invalid architecture for 32-bit SPIR-V.");
257 PointerWidth = PointerAlign = 32;
258 SizeType = TargetInfo::UnsignedInt;
259 PtrDiffType = IntPtrType = TargetInfo::SignedInt;
260 resetDataLayout(
"e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-"
261 "v96:128-v192:256-v256:256-v512:512-v1024:1024");
272 assert(Triple.getArch() == llvm::Triple::spirv64 &&
273 "Invalid architecture for 64-bit SPIR-V.");
274 PointerWidth = PointerAlign = 64;
275 SizeType = TargetInfo::UnsignedLong;
276 PtrDiffType = IntPtrType = TargetInfo::SignedLong;
277 resetDataLayout(
"e-i64:64-v16:16-v24:32-v32:32-v48:64-"
278 "v96:128-v192:256-v256:256-v512:512-v1024:1024");
Defines the clang::TargetOptions class.
Concrete class used by the front-end to report problems and issues.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Exposes information about the current target.
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
Options for controlling the target.
ArrayRef< Builtin::Info > getTargetBuiltins() const override
Return information about target-specific builtins for the current primary target, and info about whic...
BuiltinVaListKind getBuiltinVaListKind() const override
Returns the kind of __builtin_va_list type that should be used with this target.
ArrayRef< const char * > getGCCRegNames() const override
void adjust(DiagnosticsEngine &Diags, LangOptions &Opts) override
Set forced language options.
bool validateAsmConstraint(const char *&Name, TargetInfo::ConstraintInfo &info) const override
bool hasInt128Type() const override
Determine whether the __int128 type is supported on this target.
const char * getClobbers() const override
Returns a string of target-specific clobbers, in LLVM format.
BaseSPIRTargetInfo(const llvm::Triple &Triple, const TargetOptions &)
void setAddressSpaceMap(bool DefaultIsGeneric)
bool useFP16ConversionIntrinsics() const override
Check whether llvm intrinsics such as llvm.convert.to.fp16 should be used to convert to and from __fp...
ArrayRef< TargetInfo::GCCRegAlias > getGCCRegAliases() const override
CallingConvCheckResult checkCallingConvention(CallingConv CC) const override
Determines whether a given calling convention is valid for the target.
std::optional< unsigned > getDWARFAddressSpace(unsigned AddressSpace) const override
bool hasBitIntType() const override
Determine whether the _BitInt type is supported on this target.
void setSupportedOpenCLOpts() override
Set supported OpenCL extensions and optional core features.
CallingConv getDefaultCallingConv() const override
Gets the default calling convention for the given target and declaration context.
SPIR32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
SPIR64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
SPIRTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
bool checkArithmeticFenceSupported() const override
Controls if __arithmetic_fence is supported in the targeted backend.
bool hasFeature(StringRef Feature) const override
Determine whether the given target has the given feature.
SPIRV32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
SPIRV64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
bool hasFeature(StringRef Feature) const override
Determine whether the given target has the given feature.
SPIRVTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
Defines the clang::TargetInfo interface.
static const unsigned SPIRDefIsPrivMap[]
static const unsigned SPIRDefIsGenMap[]
CallingConv
CallingConv - Specifies the calling convention that a function uses.