11#include "TargetInfo.h"
13#include "llvm/IR/DerivedTypes.h"
29 CommonSPIRABIInfo(CodeGenTypes &CGT) : DefaultABIInfo(CGT) { setCCs(); }
35class SPIRVABIInfo :
public CommonSPIRABIInfo {
37 SPIRVABIInfo(CodeGenTypes &CGT) : CommonSPIRABIInfo(CGT) {}
38 void computeInfo(CGFunctionInfo &FI)
const override;
41 ABIArgInfo classifyKernelArgumentType(QualType Ty)
const;
44class AMDGCNSPIRVABIInfo :
public SPIRVABIInfo {
47 static constexpr unsigned MaxNumRegsForArgsRet = 16;
48 mutable unsigned NumRegsLeft = 0;
50 unsigned numRegsForType(QualType Ty)
const;
52 bool isHomogeneousAggregateBaseType(QualType Ty)
const override {
55 bool isHomogeneousAggregateSmallEnough(
const Type *Base,
56 uint64_t Members)
const override {
57 uint32_t NumRegs = (getContext().getTypeSize(Base) + 31) / 32;
60 return Members * NumRegs <= MaxNumRegsForArgsRet;
64 llvm::Type *coerceKernelArgumentType(llvm::Type *Ty,
unsigned FromAS,
68 ABIArgInfo classifyKernelArgumentType(QualType Ty)
const;
72 AMDGCNSPIRVABIInfo(CodeGenTypes &CGT) : SPIRVABIInfo(CGT) {}
73 void computeInfo(CGFunctionInfo &FI)
const override;
75 llvm::FixedVectorType *
76 getOptimalVectorMemoryType(llvm::FixedVectorType *Ty,
77 const LangOptions &LangOpt)
const override;
83 CommonSPIRTargetCodeGenInfo(CodeGen::CodeGenTypes &CGT)
84 : TargetCodeGenInfo(std::make_unique<CommonSPIRABIInfo>(CGT)) {}
85 CommonSPIRTargetCodeGenInfo(std::unique_ptr<ABIInfo> ABIInfo)
86 : TargetCodeGenInfo(std::move(ABIInfo)) {}
88 LangAS getASTAllocaAddressSpace()
const override {
90 getABIInfo().getDataLayout().getAllocaAddrSpace());
93 unsigned getDeviceKernelCallingConv()
const override;
94 llvm::Type *getOpenCLType(CodeGenModule &CGM,
const Type *
T)
const override;
95 llvm::Type *getHLSLType(CodeGenModule &CGM,
const Type *Ty,
96 const CGHLSLOffsetInfo &OffsetInfo)
const override;
98 llvm::Type *getHLSLPadding(CodeGenModule &CGM,
99 CharUnits NumBytes)
const override {
101 return llvm::TargetExtType::get(CGM.
getLLVMContext(),
"spirv.Padding", {},
105 bool isHLSLPadding(llvm::Type *Ty)
const override {
106 if (
auto *TET = dyn_cast<llvm::TargetExtType>(Ty))
107 return TET->getName() ==
"spirv.Padding";
111 llvm::Type *getSPIRVImageTypeFromHLSLResource(
112 const HLSLAttributedResourceType::Attributes &attributes,
113 QualType SampledType, CodeGenModule &CGM)
const;
115 setOCLKernelStubCallingConvention(
const FunctionType *&FT)
const override;
116 llvm::Constant *getNullPointer(
const CodeGen::CodeGenModule &CGM,
117 llvm::PointerType *
T,
118 QualType QT)
const override;
120class SPIRVTargetCodeGenInfo :
public CommonSPIRTargetCodeGenInfo {
122 SPIRVTargetCodeGenInfo(CodeGen::CodeGenTypes &CGT)
123 : CommonSPIRTargetCodeGenInfo(
124 (CGT.getTarget().getTriple().getVendor() == llvm::Triple::AMD)
125 ? std::make_unique<AMDGCNSPIRVABIInfo>(CGT)
126 : std::make_unique<SPIRVABIInfo>(CGT)) {}
128 LangAS getGlobalVarAddressSpace(CodeGenModule &CGM,
129 const VarDecl *D)
const override;
130 void setTargetAttributes(
const Decl *D, llvm::GlobalValue *GV,
131 CodeGen::CodeGenModule &M)
const override;
132 llvm::SyncScope::ID getLLVMSyncScopeID(
const LangOptions &LangOpts,
134 llvm::AtomicOrdering Ordering,
135 llvm::LLVMContext &Ctx)
const override;
136 bool supportsLibCall()
const override {
137 return getABIInfo().getTarget().getTriple().getVendor() !=
146 return "singlethread";
170void CommonSPIRABIInfo::setCCs() {
171 assert(getRuntimeCC() == llvm::CallingConv::C);
172 RuntimeCC = llvm::CallingConv::SPIR_FUNC;
175ABIArgInfo SPIRVABIInfo::classifyKernelArgumentType(QualType Ty)
const {
176 if (getContext().getLangOpts().isTargetDevice()) {
181 llvm::Type *LTy = CGT.ConvertType(Ty);
182 auto DefaultAS = getContext().getTargetAddressSpace(LangAS::Default);
183 auto GlobalAS = getContext().getTargetAddressSpace(LangAS::opencl_global);
184 auto *PtrTy = llvm::dyn_cast<llvm::PointerType>(LTy);
185 if (PtrTy && PtrTy->getAddressSpace() == DefaultAS) {
186 LTy = llvm::PointerType::get(PtrTy->getContext(), GlobalAS);
199 return getNaturalAlignIndirect(Ty, 0,
true);
205void SPIRVABIInfo::computeInfo(CGFunctionInfo &FI)
const {
214 if (CC == llvm::CallingConv::SPIR_KERNEL) {
215 I.info = classifyKernelArgumentType(I.type);
222unsigned AMDGCNSPIRVABIInfo::numRegsForType(QualType Ty)
const {
224 unsigned NumRegs = 0;
226 if (
const VectorType *VT = Ty->
getAs<VectorType>()) {
229 QualType EltTy = VT->getElementType();
230 unsigned EltSize = getContext().getTypeSize(EltTy);
234 return (VT->getNumElements() + 1) / 2;
236 unsigned EltNumRegs = (EltSize + 31) / 32;
237 return EltNumRegs * VT->getNumElements();
241 assert(!RD->hasFlexibleArrayMember());
243 for (
const FieldDecl *Field : RD->fields()) {
244 QualType FieldTy =
Field->getType();
245 NumRegs += numRegsForType(FieldTy);
251 return (getContext().getTypeSize(Ty) + 31) / 32;
254llvm::Type *AMDGCNSPIRVABIInfo::coerceKernelArgumentType(llvm::Type *Ty,
256 unsigned ToAS)
const {
258 auto *PtrTy = llvm::dyn_cast<llvm::PointerType>(Ty);
259 if (PtrTy && PtrTy->getAddressSpace() == FromAS)
260 return llvm::PointerType::get(Ty->getContext(), ToAS);
264ABIArgInfo AMDGCNSPIRVABIInfo::classifyReturnType(QualType RetTy)
const {
291 llvm::Type *I32Ty = llvm::Type::getInt32Ty(getVMContext());
295 if (numRegsForType(RetTy) <= MaxNumRegsForArgsRet)
302ABIArgInfo AMDGCNSPIRVABIInfo::classifyKernelArgumentType(QualType Ty)
const {
308 Ty = QualType(SeltTy, 0);
310 llvm::Type *OrigLTy = CGT.ConvertType(Ty);
311 llvm::Type *LTy = OrigLTy;
312 if (getContext().getLangOpts().isTargetDevice()) {
313 LTy = coerceKernelArgumentType(
314 OrigLTy, getContext().getTargetAddressSpace(LangAS::Default),
315 getContext().getTargetAddressSpace(LangAS::opencl_global));
323 getContext().getTypeAlignInChars(Ty),
324 getContext().getTargetAddressSpace(LangAS::opencl_constant),
333ABIArgInfo AMDGCNSPIRVABIInfo::classifyArgumentType(QualType Ty)
const {
334 assert(NumRegsLeft <= MaxNumRegsForArgsRet &&
"register estimate underflow");
343 unsigned NumRegs = numRegsForType(Ty);
344 NumRegsLeft -= std::min(NumRegs, NumRegsLeft);
353 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
373 unsigned NumRegs = (
Size + 31) / 32;
374 NumRegsLeft -= std::min(NumRegsLeft, NumRegs);
384 llvm::Type *I32Ty = llvm::Type::getInt32Ty(getVMContext());
388 if (NumRegsLeft > 0) {
389 unsigned NumRegs = numRegsForType(Ty);
390 if (NumRegsLeft >= NumRegs) {
391 NumRegsLeft -= NumRegs;
399 getContext().getTypeAlignInChars(Ty),
400 getContext().getTargetAddressSpace(LangAS::opencl_private));
403void AMDGCNSPIRVABIInfo::computeInfo(CGFunctionInfo &FI)
const {
409 NumRegsLeft = MaxNumRegsForArgsRet;
411 if (CC == llvm::CallingConv::SPIR_KERNEL)
412 I.info = classifyKernelArgumentType(I.type);
418llvm::FixedVectorType *AMDGCNSPIRVABIInfo::getOptimalVectorMemoryType(
419 llvm::FixedVectorType *Ty,
const LangOptions &LangOpt)
const {
421 if (Ty->getNumElements() == 3 && getDataLayout().getTypeSizeInBits(Ty) == 96)
423 return DefaultABIInfo::getOptimalVectorMemoryType(Ty, LangOpt);
431 AMDGCNSPIRVABIInfo(CGM.
getTypes()).computeInfo(FI);
433 SPIRVABIInfo(CGM.
getTypes()).computeInfo(FI);
435 CommonSPIRABIInfo(CGM.
getTypes()).computeInfo(FI);
441unsigned CommonSPIRTargetCodeGenInfo::getDeviceKernelCallingConv()
const {
442 return llvm::CallingConv::SPIR_KERNEL;
445void SPIRVTargetCodeGenInfo::setCUDAKernelCallingConvention(
446 const FunctionType *&FT)
const {
448 if (getABIInfo().getContext().getLangOpts().
HIP) {
449 FT = getABIInfo().getContext().adjustFunctionType(
455void CommonSPIRTargetCodeGenInfo::setOCLKernelStubCallingConvention(
456 const FunctionType *&FT)
const {
457 FT = getABIInfo().getContext().adjustFunctionType(
468CommonSPIRTargetCodeGenInfo::getNullPointer(
const CodeGen::CodeGenModule &CGM,
469 llvm::PointerType *PT,
474 unsigned ASAsInt =
static_cast<unsigned>(AS);
475 unsigned FirstTargetASAsInt =
476 static_cast<unsigned>(LangAS::FirstTargetAddressSpace);
477 unsigned CodeSectionINTELAS = FirstTargetASAsInt + 9;
480 bool IsFunctionPtrAS =
481 CGM.
getTriple().isSPIRV() && ASAsInt == CodeSectionINTELAS;
482 if (AS == LangAS::Default || AS == LangAS::opencl_generic ||
483 AS == LangAS::opencl_constant || IsFunctionPtrAS)
484 return llvm::ConstantPointerNull::get(PT);
487 auto NPT = llvm::PointerType::get(
488 PT->getContext(), Ctx.getTargetAddressSpace(LangAS::opencl_generic));
489 return llvm::ConstantExpr::getAddrSpaceCast(
490 llvm::ConstantPointerNull::get(NPT), PT);
494SPIRVTargetCodeGenInfo::getGlobalVarAddressSpace(CodeGenModule &CGM,
495 const VarDecl *D)
const {
498 "Address space agnostic languages only");
506 return DefaultGlobalAS;
509 if (AddrSpace != LangAS::Default)
512 return DefaultGlobalAS;
515void SPIRVTargetCodeGenInfo::setTargetAttributes(
516 const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &M)
const {
517 if (GV->isDeclaration())
520 const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(D);
524 llvm::Function *F = dyn_cast<llvm::Function>(GV);
525 assert(F &&
"Expected GlobalValue to be a Function");
531 if (!FD->
hasAttr<CUDAGlobalAttr>())
534 unsigned N = M.
getLangOpts().GPUMaxThreadsPerBlock;
535 if (
auto FlatWGS = FD->
getAttr<AMDGPUFlatWorkGroupSizeAttr>())
536 N = FlatWGS->getMax()->EvaluateKnownConstInt(M.
getContext()).getExtValue();
542 llvm::Metadata *AttrMDArgs[] = {
543 llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(Int32Ty, N)),
544 llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(Int32Ty, 1)),
545 llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(Int32Ty, 1))};
547 F->setMetadata(
"max_work_group_size",
552SPIRVTargetCodeGenInfo::getLLVMSyncScopeID(
const LangOptions &,
SyncScope Scope,
553 llvm::AtomicOrdering,
554 llvm::LLVMContext &Ctx)
const {
555 return Ctx.getOrInsertSyncScopeID(mapClangSyncScopeToLLVM(Scope));
560 StringRef OpenCLName,
561 unsigned AccessQualifier) {
572 if (OpenCLName.starts_with(
"image2d"))
574 else if (OpenCLName.starts_with(
"image3d"))
576 else if (OpenCLName ==
"image1d_buffer")
579 assert(OpenCLName.starts_with(
"image1d") &&
"Unknown image type");
584 if (OpenCLName.contains(
"_depth"))
586 if (OpenCLName.contains(
"_array"))
588 if (OpenCLName.contains(
"_msaa"))
592 IntParams.push_back(AccessQualifier);
594 return llvm::TargetExtType::get(Ctx, BaseType, {llvm::Type::getVoidTy(Ctx)},
598llvm::Type *CommonSPIRTargetCodeGenInfo::getOpenCLType(CodeGenModule &CGM,
599 const Type *Ty)
const {
601 if (
auto *PipeTy = dyn_cast<PipeType>(Ty))
602 return llvm::TargetExtType::get(Ctx,
"spirv.Pipe", {},
603 {!PipeTy->isReadOnly()});
604 if (
auto *BuiltinTy = dyn_cast<BuiltinType>(Ty)) {
605 enum AccessQualifier :
unsigned { AQ_ro = 0, AQ_wo = 1, AQ_rw = 2 };
606 switch (BuiltinTy->getKind()) {
607#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
608 case BuiltinType::Id: \
609 return getSPIRVImageType(Ctx, "spirv.Image", #ImgType, AQ_##Suffix);
610#include "clang/Basic/OpenCLImageTypes.def"
611 case BuiltinType::OCLSampler:
612 return llvm::TargetExtType::get(Ctx,
"spirv.Sampler");
613 case BuiltinType::OCLEvent:
614 return llvm::TargetExtType::get(Ctx,
"spirv.Event");
615 case BuiltinType::OCLClkEvent:
616 return llvm::TargetExtType::get(Ctx,
"spirv.DeviceEvent");
617 case BuiltinType::OCLQueue:
618 return llvm::TargetExtType::get(Ctx,
"spirv.Queue");
619 case BuiltinType::OCLReserveID:
620 return llvm::TargetExtType::get(Ctx,
"spirv.ReserveId");
621#define INTEL_SUBGROUP_AVC_TYPE(Name, Id) \
622 case BuiltinType::OCLIntelSubgroupAVC##Id: \
623 return llvm::TargetExtType::get(Ctx, "spirv.Avc" #Id "INTEL");
624#include "clang/Basic/OpenCLExtensionTypes.def"
636 llvm::Type *IntegralType,
643 while (
Value.ugt(0)) {
644 uint32_t Word =
Value.trunc(32).getZExtValue();
645 Value.lshrInPlace(32);
647 Words.push_back(Word);
649 if (Words.size() == 0)
653 return llvm::TargetExtType::get(Ctx,
"spirv.IntegralConstant",
654 {IntegralType}, Words);
655 return llvm::TargetExtType::get(Ctx,
"spirv.Literal", {}, Words);
659 const HLSLInlineSpirvType *SpirvType) {
664 for (
auto &Operand : SpirvType->getOperands()) {
665 using SpirvOperandKind = SpirvOperand::SpirvOperandKind;
667 llvm::Type *Result =
nullptr;
668 switch (Operand.getKind()) {
669 case SpirvOperandKind::ConstantId: {
670 llvm::Type *IntegralType =
676 case SpirvOperandKind::Literal: {
680 case SpirvOperandKind::TypeId: {
681 QualType TypeOperand = Operand.getResultType();
683 assert(RD->isCompleteDefinition() &&
684 "Type completion should have been required in Sema");
686 const FieldDecl *HandleField = RD->findFirstNamedDataMember();
689 if (ResourceType->
getAs<HLSLAttributedResourceType>()) {
690 TypeOperand = ResourceType;
698 llvm_unreachable(
"HLSLInlineSpirvType had invalid operand!");
703 Operands.push_back(Result);
706 return llvm::TargetExtType::get(Ctx,
"spirv.Type", Operands,
707 {SpirvType->getOpcode(), SpirvType->getSize(),
708 SpirvType->getAlignment()});
711llvm::Type *CommonSPIRTargetCodeGenInfo::getHLSLType(
712 CodeGenModule &CGM,
const Type *Ty,
713 const CGHLSLOffsetInfo &OffsetInfo)
const {
716 if (
auto *SpirvType = dyn_cast<HLSLInlineSpirvType>(Ty))
719 auto *ResType = dyn_cast<HLSLAttributedResourceType>(Ty);
723 const HLSLAttributedResourceType::Attributes &ResAttrs = ResType->getAttrs();
724 switch (ResAttrs.ResourceClass) {
725 case llvm::dxil::ResourceClass::UAV:
726 case llvm::dxil::ResourceClass::SRV: {
728 QualType ContainedTy = ResType->getContainedType();
732 assert(!ResAttrs.IsROV &&
733 "Rasterizer order views not implemented for SPIR-V yet");
735 if (!ResAttrs.RawBuffer) {
737 return getSPIRVImageTypeFromHLSLResource(ResAttrs, ContainedTy, CGM);
740 if (ResAttrs.IsCounter) {
741 llvm::Type *ElemType = llvm::Type::getInt32Ty(Ctx);
743 return llvm::TargetExtType::get(Ctx,
"spirv.VulkanBuffer", {ElemType},
747 llvm::ArrayType *RuntimeArrayType = llvm::ArrayType::get(ElemType, 0);
749 bool IsWritable = ResAttrs.ResourceClass == llvm::dxil::ResourceClass::UAV;
750 return llvm::TargetExtType::get(Ctx,
"spirv.VulkanBuffer",
754 case llvm::dxil::ResourceClass::CBuffer: {
755 QualType ContainedTy = ResType->getContainedType();
759 llvm::StructType *BufferLayoutTy =
760 HLSLBufferLayoutBuilder(CGM).layOutStruct(
763 return llvm::TargetExtType::get(Ctx,
"spirv.VulkanBuffer", {BufferLayoutTy},
767 case llvm::dxil::ResourceClass::Sampler:
768 return llvm::TargetExtType::get(Ctx,
"spirv.Sampler");
775 const HLSLAttributedResourceType::Attributes &attributes,
776 llvm::Type *SampledType,
QualType Ty,
unsigned NumChannels) {
781 if (LangOpts.HLSLSpvUseUnknownImageFormat ||
782 attributes.ResourceClass != llvm::dxil::ResourceClass::UAV) {
786 if (SampledType->isIntegerTy(32)) {
788 if (NumChannels == 1)
790 if (NumChannels == 2)
792 if (NumChannels == 4)
795 if (NumChannels == 1)
797 if (NumChannels == 2)
799 if (NumChannels == 4)
802 }
else if (SampledType->isIntegerTy(64)) {
803 if (NumChannels == 1) {
809 }
else if (SampledType->isFloatTy()) {
810 if (NumChannels == 1)
812 if (NumChannels == 2)
814 if (NumChannels == 4)
821llvm::Type *CommonSPIRTargetCodeGenInfo::getSPIRVImageTypeFromHLSLResource(
822 const HLSLAttributedResourceType::Attributes &attributes, QualType Ty,
823 CodeGenModule &CGM)
const {
826 unsigned NumChannels = 1;
828 if (
const VectorType *
V = dyn_cast<VectorType>(Ty)) {
829 NumChannels =
V->getNumElements();
830 Ty =
V->getElementType();
832 assert(!Ty->
isVectorType() &&
"We still have a vector type.");
836 assert((SampledType->isIntegerTy() || SampledType->isFloatingPointTy()) &&
837 "The element type for a SPIR-V resource must be a scalar integer or "
838 "floating point type.");
843 SmallVector<unsigned, 6> IntParams(6, 0);
864 attributes.ResourceClass == llvm::dxil::ResourceClass::UAV ? 2 : 1;
870 llvm::TargetExtType *ImageType =
871 llvm::TargetExtType::get(Ctx, Name, {SampledType}, IntParams);
875std::unique_ptr<TargetCodeGenInfo>
877 return std::make_unique<CommonSPIRTargetCodeGenInfo>(CGM.
getTypes());
880std::unique_ptr<TargetCodeGenInfo>
882 return std::make_unique<SPIRVTargetCodeGenInfo>(CGM.
getTypes());
static void setCUDAKernelCallingConvention(CanQualType &FTy, CodeGenModule &CGM, const FunctionDecl *FD)
Set calling convention for CUDA/HIP kernel.
static llvm::Type * getInlineSpirvType(CodeGenModule &CGM, const HLSLInlineSpirvType *SpirvType)
static llvm::Type * getSPIRVImageType(llvm::LLVMContext &Ctx, StringRef BaseType, StringRef OpenCLName, unsigned AccessQualifier)
Construct a SPIR-V target extension type for the given OpenCL image type.
static unsigned getImageFormat(const LangOptions &LangOpts, const HLSLAttributedResourceType::Attributes &attributes, llvm::Type *SampledType, QualType Ty, unsigned NumChannels)
static llvm::Type * getInlineSpirvConstant(CodeGenModule &CGM, llvm::Type *IntegralType, llvm::APInt Value)
Defines the clang::LangOptions interface.
unsigned getTargetAddressSpace(LangAS AS) const
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
static ABIArgInfo getIgnore()
static ABIArgInfo getDirect(llvm::Type *T=nullptr, unsigned Offset=0, llvm::Type *Padding=nullptr, bool CanBeFlattened=true, unsigned Align=0)
static ABIArgInfo getIndirectAliased(CharUnits Alignment, unsigned AddrSpace, bool Realign=false, llvm::Type *Padding=nullptr)
Pass this in memory using the IR byref attribute.
@ RAA_DirectInMemory
Pass it on the stack using its defined layout.
CGFunctionInfo - Class to encapsulate the information about a function definition.
ABIArgInfo & getReturnInfo()
unsigned getCallingConvention() const
getCallingConvention - Return the user specified calling convention, which has been translated into a...
CanQualType getReturnType() const
MutableArrayRef< ArgInfo > arguments()
This class organizes the cross-function state that is used while generating LLVM code.
const LangOptions & getLangOpts() const
CodeGenTypes & getTypes()
const TargetInfo & getTarget() const
const llvm::Triple & getTriple() const
ASTContext & getContext() const
llvm::LLVMContext & getLLVMContext()
llvm::Type * ConvertType(QualType T)
ConvertType - Convert type T into a llvm::Type.
llvm::Type * ConvertTypeForMem(QualType T)
ConvertTypeForMem - Convert type T into a llvm::Type.
DefaultABIInfo - The default implementation for ABI specific details.
ABIArgInfo classifyArgumentType(QualType RetTy) const
ABIArgInfo classifyReturnType(QualType RetTy) const
TargetCodeGenInfo - This class organizes various target-specific codegeneration issues,...
Represents a member of a struct/union/class.
ExtInfo withCallingConv(CallingConv cc) const
ExtInfo getExtInfo() const
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
LangAS getAddressSpace() const
Return the address space of this type.
bool hasFlexibleArrayMember() const
Scope - A scope is a transient data structure that is used while parsing the program.
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
bool isStructureType() const
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char,...
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
CanQualType getCanonicalTypeUnqualified() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isVectorType() const
const T * getAsCanonical() const
If this type is canonically the specified type, return its canonical type cast to that specified type...
const T * getAs() const
Member-template getAs<specific type>'.
const Type * getUnqualifiedDesugaredType() const
Return the specified type with any "sugar" removed from the type, removing any typedefs,...
bool isNullPtrType() const
ABIArgInfo classifyArgumentType(CodeGenModule &CGM, CanQualType type)
Classify the rules for how to pass a particular type.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
CGCXXABI::RecordArgABI getRecordArgABI(const RecordType *RT, CGCXXABI &CXXABI)
bool classifyReturnType(const CGCXXABI &CXXABI, CGFunctionInfo &FI, const ABIInfo &Info)
void computeSPIRKernelABIInfo(CodeGenModule &CGM, CGFunctionInfo &FI)
bool isAggregateTypeForABI(QualType T)
const Type * isSingleElementStruct(QualType T, ASTContext &Context)
isSingleElementStruct - Determine if a structure is a "singleelement struct", i.e.
std::unique_ptr< TargetCodeGenInfo > createSPIRVTargetCodeGenInfo(CodeGenModule &CGM)
QualType useFirstFieldIfTransparentUnion(QualType Ty)
Pass transparent unions as if they were the type of the first element.
std::unique_ptr< TargetCodeGenInfo > createCommonSPIRTargetCodeGenInfo(CodeGenModule &CGM)
bool isEmptyRecord(ASTContext &Context, QualType T, bool AllowArrays, bool AsIfNoUniqueAddr=false)
isEmptyRecord - Return true iff a structure contains only empty fields.
The JSON file list parser is used to communicate input to InstallAPI.
StorageClass
Storage classes.
const FunctionProtoType * T
@ Type
The name was classified as a type.
LangAS
Defines the address space values used by the address space qualifier of QualType.
SyncScope
Defines sync scope values used internally by clang.
LangAS getLangASFromTargetAS(unsigned TargetAS)