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;
39 RValue EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty,
40 AggValueSlot Slot)
const override;
43 ABIArgInfo classifyKernelArgumentType(QualType Ty)
const;
46class AMDGCNSPIRVABIInfo :
public SPIRVABIInfo {
49 static constexpr unsigned MaxNumRegsForArgsRet = 16;
50 mutable unsigned NumRegsLeft = 0;
52 uint64_t numRegsForType(QualType Ty)
const;
54 bool isHomogeneousAggregateBaseType(QualType Ty)
const override {
57 bool isHomogeneousAggregateSmallEnough(
const Type *Base,
58 uint64_t Members)
const override {
59 uint32_t NumRegs = (getContext().getTypeSize(Base) + 31) / 32;
62 return Members * NumRegs <= MaxNumRegsForArgsRet;
66 llvm::Type *coerceKernelArgumentType(llvm::Type *Ty,
unsigned FromAS,
70 ABIArgInfo classifyKernelArgumentType(QualType Ty)
const;
74 AMDGCNSPIRVABIInfo(CodeGenTypes &CGT) : SPIRVABIInfo(CGT) {}
75 void computeInfo(CGFunctionInfo &FI)
const override;
77 llvm::FixedVectorType *
78 getOptimalVectorMemoryType(llvm::FixedVectorType *Ty,
79 const LangOptions &LangOpt)
const override;
85 CommonSPIRTargetCodeGenInfo(CodeGen::CodeGenTypes &CGT)
86 : TargetCodeGenInfo(std::make_unique<CommonSPIRABIInfo>(CGT)) {}
87 CommonSPIRTargetCodeGenInfo(std::unique_ptr<ABIInfo> ABIInfo)
88 : TargetCodeGenInfo(std::move(ABIInfo)) {}
90 LangAS getASTAllocaAddressSpace()
const override {
92 getABIInfo().getDataLayout().getAllocaAddrSpace());
95 unsigned getDeviceKernelCallingConv()
const override;
96 llvm::Type *getOpenCLType(CodeGenModule &CGM,
const Type *
T)
const override;
97 llvm::Type *getHLSLType(CodeGenModule &CGM,
const Type *Ty,
98 const CGHLSLOffsetInfo &OffsetInfo)
const override;
100 llvm::Type *getHLSLPadding(CodeGenModule &CGM,
101 CharUnits NumBytes)
const override {
103 return llvm::TargetExtType::get(CGM.
getLLVMContext(),
"spirv.Padding", {},
107 bool isHLSLPadding(llvm::Type *Ty)
const override {
108 if (
auto *TET = dyn_cast<llvm::TargetExtType>(Ty))
109 return TET->getName() ==
"spirv.Padding";
113 llvm::Type *getSPIRVImageTypeFromHLSLResource(
114 const HLSLAttributedResourceType::Attributes &attributes,
115 QualType SampledType, CodeGenModule &CGM)
const;
117 setOCLKernelStubCallingConvention(
const FunctionType *&FT)
const override;
118 llvm::Constant *getNullPointer(
const CodeGen::CodeGenModule &CGM,
119 llvm::PointerType *
T,
120 QualType QT)
const override;
122class SPIRVTargetCodeGenInfo :
public CommonSPIRTargetCodeGenInfo {
124 SPIRVTargetCodeGenInfo(CodeGen::CodeGenTypes &CGT)
125 : CommonSPIRTargetCodeGenInfo(
126 (CGT.getTarget().getTriple().getVendor() == llvm::Triple::AMD)
127 ? std::make_unique<AMDGCNSPIRVABIInfo>(CGT)
128 : std::make_unique<SPIRVABIInfo>(CGT)) {}
130 LangAS getGlobalVarAddressSpace(CodeGenModule &CGM,
131 const VarDecl *D)
const override;
132 void setTargetAttributes(
const Decl *D, llvm::GlobalValue *GV,
133 CodeGen::CodeGenModule &M)
const override;
134 llvm::SyncScope::ID getLLVMSyncScopeID(
const LangOptions &LangOpts,
136 llvm::AtomicOrdering Ordering,
137 llvm::LLVMContext &Ctx)
const override;
138 bool supportsLibCall()
const override {
139 return getABIInfo().getTarget().getTriple().getVendor() !=
148 return "singlethread";
172void CommonSPIRABIInfo::setCCs() {
173 assert(getRuntimeCC() == llvm::CallingConv::C);
174 RuntimeCC = llvm::CallingConv::SPIR_FUNC;
177ABIArgInfo SPIRVABIInfo::classifyKernelArgumentType(QualType Ty)
const {
178 if (getContext().getLangOpts().isTargetDevice()) {
183 llvm::Type *LTy = CGT.ConvertType(Ty);
184 auto DefaultAS = getContext().getTargetAddressSpace(LangAS::Default);
185 auto GlobalAS = getContext().getTargetAddressSpace(LangAS::opencl_global);
186 auto *PtrTy = llvm::dyn_cast<llvm::PointerType>(LTy);
187 if (PtrTy && PtrTy->getAddressSpace() == DefaultAS) {
188 LTy = llvm::PointerType::get(PtrTy->getContext(), GlobalAS);
201 return getNaturalAlignIndirect(Ty, 0,
true);
207void SPIRVABIInfo::computeInfo(CGFunctionInfo &FI)
const {
212 for (
auto &&[ArgumentsCount, I] : llvm::enumerate(FI.
arguments()))
215 : ABIArgInfo::getDirect();
221 if (CC == llvm::CallingConv::SPIR_KERNEL) {
222 I.info = classifyKernelArgumentType(I.type);
224 I.info = classifyArgumentType(I.type);
229RValue SPIRVABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
230 QualType Ty, AggValueSlot Slot)
const {
232 getContext().getTypeInfoInChars(Ty),
237uint64_t AMDGCNSPIRVABIInfo::numRegsForType(QualType Ty)
const {
241 if (
const VectorType *VT = Ty->
getAs<VectorType>()) {
244 QualType EltTy = VT->getElementType();
245 uint64_t EltSize = getContext().getTypeSize(EltTy);
249 return (VT->getNumElements() + 1) / 2;
251 uint64_t EltNumRegs = (EltSize + 31) / 32;
252 return EltNumRegs * VT->getNumElements();
256 assert(!RD->hasFlexibleArrayMember());
258 for (
const FieldDecl *Field : RD->fields()) {
259 QualType FieldTy =
Field->getType();
260 NumRegs += numRegsForType(FieldTy);
266 return (getContext().getTypeSize(Ty) + 31) / 32;
269llvm::Type *AMDGCNSPIRVABIInfo::coerceKernelArgumentType(llvm::Type *Ty,
271 unsigned ToAS)
const {
273 auto *PtrTy = llvm::dyn_cast<llvm::PointerType>(Ty);
274 if (PtrTy && PtrTy->getAddressSpace() == FromAS)
275 return llvm::PointerType::get(Ty->getContext(), ToAS);
279ABIArgInfo AMDGCNSPIRVABIInfo::classifyReturnType(QualType RetTy)
const {
306 llvm::Type *I32Ty = llvm::Type::getInt32Ty(getVMContext());
310 if (numRegsForType(RetTy) <= MaxNumRegsForArgsRet)
317ABIArgInfo AMDGCNSPIRVABIInfo::classifyKernelArgumentType(QualType Ty)
const {
323 Ty = QualType(SeltTy, 0);
325 llvm::Type *OrigLTy = CGT.ConvertType(Ty);
326 llvm::Type *LTy = OrigLTy;
327 if (getContext().getLangOpts().isTargetDevice()) {
328 LTy = coerceKernelArgumentType(
329 OrigLTy, getContext().getTargetAddressSpace(LangAS::Default),
330 getContext().getTargetAddressSpace(LangAS::opencl_global));
338 getContext().getTypeAlignInChars(Ty),
339 getContext().getTargetAddressSpace(LangAS::opencl_constant),
348ABIArgInfo AMDGCNSPIRVABIInfo::classifyArgumentType(QualType Ty)
const {
349 assert(NumRegsLeft <= MaxNumRegsForArgsRet &&
"register estimate underflow");
358 uint64_t NumRegs = numRegsForType(Ty);
359 NumRegsLeft -= std::min(NumRegs, uint64_t{NumRegsLeft});
368 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace(),
388 unsigned NumRegs = (
Size + 31) / 32;
389 NumRegsLeft -= std::min(NumRegsLeft, NumRegs);
399 llvm::Type *I32Ty = llvm::Type::getInt32Ty(getVMContext());
403 if (NumRegsLeft > 0) {
404 uint64_t NumRegs = numRegsForType(Ty);
405 if (NumRegsLeft >= NumRegs) {
406 NumRegsLeft -= NumRegs;
414 getContext().getTypeAlignInChars(Ty),
415 getContext().getTargetAddressSpace(LangAS::opencl_private));
418void AMDGCNSPIRVABIInfo::computeInfo(CGFunctionInfo &FI)
const {
424 NumRegsLeft = MaxNumRegsForArgsRet;
426 if (CC == llvm::CallingConv::SPIR_KERNEL)
427 I.info = classifyKernelArgumentType(I.type);
433llvm::FixedVectorType *AMDGCNSPIRVABIInfo::getOptimalVectorMemoryType(
434 llvm::FixedVectorType *Ty,
const LangOptions &LangOpt)
const {
436 if (Ty->getNumElements() == 3 && getDataLayout().getTypeSizeInBits(Ty) == 96)
438 return DefaultABIInfo::getOptimalVectorMemoryType(Ty, LangOpt);
446 AMDGCNSPIRVABIInfo(CGM.
getTypes()).computeInfo(FI);
448 SPIRVABIInfo(CGM.
getTypes()).computeInfo(FI);
450 CommonSPIRABIInfo(CGM.
getTypes()).computeInfo(FI);
456unsigned CommonSPIRTargetCodeGenInfo::getDeviceKernelCallingConv()
const {
457 return llvm::CallingConv::SPIR_KERNEL;
460void SPIRVTargetCodeGenInfo::setCUDAKernelCallingConvention(
461 const FunctionType *&FT)
const {
463 if (getABIInfo().getContext().getLangOpts().
HIP) {
464 FT = getABIInfo().getContext().adjustFunctionType(
470void CommonSPIRTargetCodeGenInfo::setOCLKernelStubCallingConvention(
471 const FunctionType *&FT)
const {
472 FT = getABIInfo().getContext().adjustFunctionType(
483CommonSPIRTargetCodeGenInfo::getNullPointer(
const CodeGen::CodeGenModule &CGM,
484 llvm::PointerType *PT,
489 unsigned ASAsInt =
static_cast<unsigned>(AS);
490 unsigned FirstTargetASAsInt =
491 static_cast<unsigned>(LangAS::FirstTargetAddressSpace);
492 unsigned CodeSectionINTELAS = FirstTargetASAsInt + 9;
495 bool IsFunctionPtrAS =
496 CGM.
getTriple().isSPIRV() && ASAsInt == CodeSectionINTELAS;
497 if (AS == LangAS::Default || AS == LangAS::opencl_generic ||
498 AS == LangAS::opencl_constant || IsFunctionPtrAS)
499 return llvm::ConstantPointerNull::get(PT);
502 auto NPT = llvm::PointerType::get(
503 PT->getContext(), Ctx.getTargetAddressSpace(LangAS::opencl_generic));
504 return llvm::ConstantExpr::getAddrSpaceCast(
505 llvm::ConstantPointerNull::get(NPT), PT);
509SPIRVTargetCodeGenInfo::getGlobalVarAddressSpace(CodeGenModule &CGM,
510 const VarDecl *D)
const {
513 "Address space agnostic languages only");
521 return DefaultGlobalAS;
524 if (AddrSpace != LangAS::Default)
527 return DefaultGlobalAS;
530void SPIRVTargetCodeGenInfo::setTargetAttributes(
531 const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &M)
const {
532 if (GV->isDeclaration())
535 const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(D);
539 llvm::Function *F = dyn_cast<llvm::Function>(GV);
540 assert(F &&
"Expected GlobalValue to be a Function");
546 if (!FD->
hasAttr<CUDAGlobalAttr>())
549 unsigned N = M.
getLangOpts().GPUMaxThreadsPerBlock;
550 if (
auto FlatWGS = FD->
getAttr<AMDGPUFlatWorkGroupSizeAttr>())
551 N = FlatWGS->getMax()->EvaluateKnownConstInt(M.
getContext()).getExtValue();
557 llvm::Metadata *AttrMDArgs[] = {
558 llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(Int32Ty, N)),
559 llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(Int32Ty, 1)),
560 llvm::ConstantAsMetadata::get(llvm::ConstantInt::get(Int32Ty, 1))};
562 F->setMetadata(
"max_work_group_size",
567SPIRVTargetCodeGenInfo::getLLVMSyncScopeID(
const LangOptions &,
SyncScope Scope,
568 llvm::AtomicOrdering,
569 llvm::LLVMContext &Ctx)
const {
570 return Ctx.getOrInsertSyncScopeID(mapClangSyncScopeToLLVM(Scope));
575 StringRef OpenCLName,
576 unsigned AccessQualifier) {
587 if (OpenCLName.starts_with(
"image2d"))
589 else if (OpenCLName.starts_with(
"image3d"))
591 else if (OpenCLName ==
"image1d_buffer")
594 assert(OpenCLName.starts_with(
"image1d") &&
"Unknown image type");
599 if (OpenCLName.contains(
"_depth"))
601 if (OpenCLName.contains(
"_array"))
603 if (OpenCLName.contains(
"_msaa"))
607 IntParams.push_back(AccessQualifier);
609 return llvm::TargetExtType::get(Ctx, BaseType, {llvm::Type::getVoidTy(Ctx)},
613llvm::Type *CommonSPIRTargetCodeGenInfo::getOpenCLType(CodeGenModule &CGM,
614 const Type *Ty)
const {
616 if (
auto *PipeTy = dyn_cast<PipeType>(Ty))
617 return llvm::TargetExtType::get(Ctx,
"spirv.Pipe", {},
618 {!PipeTy->isReadOnly()});
619 if (
auto *BuiltinTy = dyn_cast<BuiltinType>(Ty)) {
620 enum AccessQualifier :
unsigned { AQ_ro = 0, AQ_wo = 1, AQ_rw = 2 };
621 switch (BuiltinTy->getKind()) {
622#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
623 case BuiltinType::Id: \
624 return getSPIRVImageType(Ctx, "spirv.Image", #ImgType, AQ_##Suffix);
625#include "clang/Basic/OpenCLImageTypes.def"
626 case BuiltinType::OCLSampler:
627 return llvm::TargetExtType::get(Ctx,
"spirv.Sampler");
628 case BuiltinType::OCLEvent:
629 return llvm::TargetExtType::get(Ctx,
"spirv.Event");
630 case BuiltinType::OCLClkEvent:
631 return llvm::TargetExtType::get(Ctx,
"spirv.DeviceEvent");
632 case BuiltinType::OCLQueue:
633 return llvm::TargetExtType::get(Ctx,
"spirv.Queue");
634 case BuiltinType::OCLReserveID:
635 return llvm::TargetExtType::get(Ctx,
"spirv.ReserveId");
636#define INTEL_SUBGROUP_AVC_TYPE(Name, Id) \
637 case BuiltinType::OCLIntelSubgroupAVC##Id: \
638 return llvm::TargetExtType::get(Ctx, "spirv.Avc" #Id "INTEL");
639#include "clang/Basic/OpenCLExtensionTypes.def"
651 llvm::Type *IntegralType,
658 while (
Value.ugt(0)) {
659 uint32_t Word =
Value.trunc(32).getZExtValue();
660 Value.lshrInPlace(32);
662 Words.push_back(Word);
664 if (Words.size() == 0)
668 return llvm::TargetExtType::get(Ctx,
"spirv.IntegralConstant",
669 {IntegralType}, Words);
670 return llvm::TargetExtType::get(Ctx,
"spirv.Literal", {}, Words);
674 const HLSLInlineSpirvType *SpirvType) {
679 for (
auto &Operand : SpirvType->getOperands()) {
680 using SpirvOperandKind = SpirvOperand::SpirvOperandKind;
682 llvm::Type *Result =
nullptr;
683 switch (Operand.getKind()) {
684 case SpirvOperandKind::ConstantId: {
685 llvm::Type *IntegralType =
691 case SpirvOperandKind::Literal: {
695 case SpirvOperandKind::TypeId: {
696 QualType TypeOperand = Operand.getResultType();
698 assert(RD->isCompleteDefinition() &&
699 "Type completion should have been required in Sema");
701 const FieldDecl *HandleField = RD->findFirstNamedDataMember();
704 if (ResourceType->
getAs<HLSLAttributedResourceType>()) {
705 TypeOperand = ResourceType;
713 llvm_unreachable(
"HLSLInlineSpirvType had invalid operand!");
718 Operands.push_back(Result);
721 return llvm::TargetExtType::get(Ctx,
"spirv.Type", Operands,
722 {SpirvType->getOpcode(), SpirvType->getSize(),
723 SpirvType->getAlignment()});
726llvm::Type *CommonSPIRTargetCodeGenInfo::getHLSLType(
727 CodeGenModule &CGM,
const Type *Ty,
728 const CGHLSLOffsetInfo &OffsetInfo)
const {
731 if (
auto *SpirvType = dyn_cast<HLSLInlineSpirvType>(Ty))
734 auto *ResType = dyn_cast<HLSLAttributedResourceType>(Ty);
738 const HLSLAttributedResourceType::Attributes &ResAttrs = ResType->getAttrs();
739 switch (ResAttrs.ResourceClass) {
740 case llvm::dxil::ResourceClass::UAV:
741 case llvm::dxil::ResourceClass::SRV: {
743 QualType ContainedTy = ResType->getContainedType();
747 assert(!ResAttrs.IsROV &&
748 "Rasterizer order views not implemented for SPIR-V yet");
750 if (!ResAttrs.RawBuffer) {
752 return getSPIRVImageTypeFromHLSLResource(ResAttrs, ContainedTy, CGM);
755 if (ResAttrs.IsCounter) {
756 llvm::Type *ElemType = llvm::Type::getInt32Ty(Ctx);
758 return llvm::TargetExtType::get(Ctx,
"spirv.VulkanBuffer", {ElemType},
762 llvm::ArrayType *RuntimeArrayType = llvm::ArrayType::get(ElemType, 0);
764 bool IsWritable = ResAttrs.ResourceClass == llvm::dxil::ResourceClass::UAV;
765 return llvm::TargetExtType::get(Ctx,
"spirv.VulkanBuffer",
769 case llvm::dxil::ResourceClass::CBuffer: {
770 QualType ContainedTy = ResType->getContainedType();
774 llvm::StructType *BufferLayoutTy =
775 HLSLBufferLayoutBuilder(CGM).layOutStruct(
778 return llvm::TargetExtType::get(Ctx,
"spirv.VulkanBuffer", {BufferLayoutTy},
782 case llvm::dxil::ResourceClass::Sampler:
783 return llvm::TargetExtType::get(Ctx,
"spirv.Sampler");
790 const HLSLAttributedResourceType::Attributes &attributes,
791 llvm::Type *SampledType,
QualType Ty,
unsigned NumChannels) {
796 if (LangOpts.HLSLSpvUseUnknownImageFormat ||
797 attributes.ResourceClass != llvm::dxil::ResourceClass::UAV) {
801 if (SampledType->isIntegerTy(32)) {
803 if (NumChannels == 1)
805 if (NumChannels == 2)
807 if (NumChannels == 4)
810 if (NumChannels == 1)
812 if (NumChannels == 2)
814 if (NumChannels == 4)
817 }
else if (SampledType->isIntegerTy(64)) {
818 if (NumChannels == 1) {
824 }
else if (SampledType->isFloatTy()) {
825 if (NumChannels == 1)
827 if (NumChannels == 2)
829 if (NumChannels == 4)
836llvm::Type *CommonSPIRTargetCodeGenInfo::getSPIRVImageTypeFromHLSLResource(
837 const HLSLAttributedResourceType::Attributes &attributes, QualType Ty,
838 CodeGenModule &CGM)
const {
841 unsigned NumChannels = 1;
843 if (
const VectorType *
V = dyn_cast<VectorType>(Ty)) {
844 NumChannels =
V->getNumElements();
845 Ty =
V->getElementType();
847 assert(!Ty->
isVectorType() &&
"We still have a vector type.");
851 assert((SampledType->isIntegerTy() || SampledType->isFloatingPointTy()) &&
852 "The element type for a SPIR-V resource must be a scalar integer or "
853 "floating point type.");
858 SmallVector<unsigned, 6> IntParams(6, 0);
879 attributes.ResourceClass == llvm::dxil::ResourceClass::UAV ? 2 : 1;
885 llvm::TargetExtType *ImageType =
886 llvm::TargetExtType::get(Ctx, Name, {SampledType}, IntParams);
890std::unique_ptr<TargetCodeGenInfo>
892 return std::make_unique<CommonSPIRTargetCodeGenInfo>(CGM.
getTypes());
895std::unique_ptr<TargetCodeGenInfo>
897 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 CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
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()
unsigned getNumRequiredArgs() const
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)
RValue emitVoidPtrVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType ValueTy, bool IsIndirect, TypeInfoChars ValueInfo, CharUnits SlotSizeAndAlign, bool AllowHigherAlign, AggValueSlot Slot, bool ForceRightAdjust=false)
Emit va_arg for a platform using the common void* representation, where arguments are simply emitted ...
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.
for(const auto &A :T->param_types())
SyncScope
Defines sync scope values used internally by clang.
LangAS getLangASFromTargetAS(unsigned TargetAS)