26 #include "llvm/IR/DataLayout.h"
27 #include "llvm/IR/DerivedTypes.h"
28 #include "llvm/IR/Module.h"
30 using namespace clang;
31 using namespace CodeGen;
34 : CGM(cgm), Context(cgm.getContext()), TheModule(cgm.getModule()),
35 Target(cgm.getTarget()), TheCXXABI(cgm.getCXXABI()),
36 TheABIInfo(cgm.getTargetCodeGenInfo().getABIInfo()) {
37 SkippedLayout =
false;
38 LongDoubleReferenced =
false;
42 for (llvm::FoldingSet<CGFunctionInfo>::iterator
43 I = FunctionInfos.begin(),
E = FunctionInfos.end(); I !=
E; )
55 llvm::raw_svector_ostream OS(
TypeName);
76 if (TDD->getDeclContext())
77 TDD->printQualifiedName(OS, Policy);
86 Ty->setName(OS.str());
112 auto *FixedVT = cast<llvm::FixedVectorType>(R);
114 uint64_t BytePadded = std::max<uint64_t>(FixedVT->getNumElements(), 8);
115 return llvm::IntegerType::get(FixedVT->getContext(), BytePadded);
133 return llvm::ArrayType::get(CGM.
Int8Ty,
139 if (R->isIntegerTy(1))
148 llvm::Type *LLVMTy) {
155 return ASTSize != LLVMSize;
159 llvm::Type *LLVMTy) {
164 return llvm::Type::getIntNTy(
167 if (LLVMTy->isIntegerTy(1))
180 llvm::DenseMap<const Type*, llvm::StructType *>::const_iterator I =
181 RecordDeclTypes.find(Ty);
182 return I != RecordDeclTypes.end() && !I->second->isOpaque();
197 if (!TT)
return true;
215 for (
unsigned i = 0, e = FPT->getNumParams(); i != e; i++)
228 if (
const EnumDecl *ED = dyn_cast<EnumDecl>(TD)) {
230 if (TypeCache.count(ED->getTypeForDecl())) {
234 if (!
ConvertType(ED->getIntegerType())->isIntegerTy(32))
238 if (
const auto *
Attr = ED->getAttr<SYCLTypeAttr>())
239 if (
Attr->getType() == SYCLTypeAttr::SYCLType::aspect)
244 DI->completeType(ED);
261 DI->completeType(RD);
268 const Type *Ty =
T.getTypePtr();
269 if (RecordsWithOpaqueMemberPointers.count(Ty)) {
271 RecordsWithOpaqueMemberPointers.clear();
276 const llvm::fltSemantics &format,
277 bool UseNativeHalf =
false) {
278 if (&format == &llvm::APFloat::IEEEhalf()) {
280 return llvm::Type::getHalfTy(VMContext);
282 return llvm::Type::getInt16Ty(VMContext);
285 return llvm::Type::getBFloatTy(VMContext);
286 if (&format == &llvm::APFloat::IEEEsingle())
287 return llvm::Type::getFloatTy(VMContext);
288 if (&format == &llvm::APFloat::IEEEdouble())
289 return llvm::Type::getDoubleTy(VMContext);
290 if (&format == &llvm::APFloat::IEEEquad())
291 return llvm::Type::getFP128Ty(VMContext);
292 if (&format == &llvm::APFloat::PPCDoubleDouble())
293 return llvm::Type::getPPC_FP128Ty(VMContext);
294 if (&format == &llvm::APFloat::x87DoubleExtended())
295 return llvm::Type::getX86_FP80Ty(VMContext);
296 llvm_unreachable(
"Unknown float format!");
299 llvm::Type *CodeGenTypes::ConvertFunctionTypeInternal(
QualType QFT) {
313 for (
unsigned i = 0, e = FPT->getNumParams(); i != e; i++)
317 SkippedLayout =
true;
335 llvm::Type *ResultType =
nullptr;
338 if (FunctionsBeingProcessed.count(FI)) {
341 SkippedLayout =
true;
351 template <
bool NeedTypeInterpret = false>
354 const unsigned Val = 0) {
359 assert((TemplateArgs.size() == 5 || TemplateArgs.size() == 6) &&
360 "Wrong JointMatrixINTEL template parameters number");
363 std::vector<unsigned> Params;
364 for (
size_t I = 1; I != TemplateArgs.size(); ++I) {
366 "Wrong JointMatrixINTEL template parameter");
367 Params.push_back(TemplateArgs[I].getAsIntegral().getExtValue());
372 if (NeedTypeInterpret && TemplateArgs.size() != 5)
373 Params.push_back(Val);
375 return llvm::TargetExtType::get(CompTy->getContext(),
376 "spirv.JointMatrixINTEL", {CompTy}, Params);
382 assert(TemplateArgs.size() == 5 &&
383 "Wrong CooperativeMatrixKHR template parameters number");
384 std::vector<unsigned> Params;
385 for (
size_t I = 1; I != TemplateArgs.size(); ++I) {
387 "Wrong CooperativeMatrixKHR template parameter");
388 Params.push_back(TemplateArgs[I].getAsIntegral().getExtValue());
391 return llvm::TargetExtType::get(
392 CompTy->getContext(),
"spirv.CooperativeMatrixKHR", {CompTy}, Params);
402 auto *
TemplateDecl = cast<ClassTemplateSpecializationDecl>(RD);
406 "1st JointMatrixINTEL template parameter must be type");
407 llvm::Type *CompTy =
ConvertType(TemplateArgs[0].getAsType());
414 if (CompTy->isStructTy()) {
415 StringRef LlvmTyName = CompTy->getStructName();
417 if (LlvmTyName.starts_with(
"class.sycl::") ||
418 LlvmTyName.starts_with(
"class.__sycl_internal::"))
419 LlvmTyName = LlvmTyName.rsplit(
"::").second;
420 if (LlvmTyName ==
"half") {
423 }
else if (LlvmTyName ==
"tf32") {
426 return getJointMatrixINTELExtType<true>(CompTy, TemplateArgs, 0);
427 }
else if (LlvmTyName ==
"bfloat16") {
430 return getJointMatrixINTELExtType<true>(CompTy, TemplateArgs, 1);
432 llvm_unreachable(
"Wrong matrix base type!");
445 auto *
TemplateDecl = cast<ClassTemplateSpecializationDecl>(RD);
449 "1st CooperativeMatrixKHR template parameter must be type");
450 llvm::Type *CompTy =
ConvertType(TemplateArgs[0].getAsType());
452 if (CompTy->isStructTy()) {
453 StringRef LlvmTyName = CompTy->getStructName();
455 if (LlvmTyName.starts_with(
"class.sycl::") ||
456 LlvmTyName.starts_with(
"class.__sycl_internal::"))
457 LlvmTyName = LlvmTyName.rsplit(
"::").second;
458 if (LlvmTyName ==
"half") {
460 }
else if (LlvmTyName ==
"tf32") {
462 }
else if (LlvmTyName ==
"bfloat16") {
465 llvm_unreachable(
"Wrong matrix base type!");
475 const Type *Ty =
T.getTypePtr();
492 if (
const RecordType *RT = dyn_cast<RecordType>(Ty))
495 llvm::Type *CachedType =
nullptr;
496 auto TCI = TypeCache.find(Ty);
497 if (TCI != TypeCache.end())
498 CachedType = TCI->second;
501 #ifndef EXPENSIVE_CHECKS
507 llvm::Type *ResultType =
nullptr;
510 #define TYPE(Class, Base)
511 #define ABSTRACT_TYPE(Class, Base)
512 #define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
513 #define DEPENDENT_TYPE(Class, Base) case Type::Class:
514 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class:
515 #include "clang/AST/TypeNodes.inc"
516 llvm_unreachable(
"Non-canonical or dependent types aren't possible.");
518 case Type::Builtin: {
519 switch (cast<BuiltinType>(Ty)->
getKind()) {
520 case BuiltinType::Void:
521 case BuiltinType::ObjCId:
522 case BuiltinType::ObjCClass:
523 case BuiltinType::ObjCSel:
529 case BuiltinType::Bool:
534 case BuiltinType::Char_S:
535 case BuiltinType::Char_U:
536 case BuiltinType::SChar:
537 case BuiltinType::UChar:
538 case BuiltinType::Short:
539 case BuiltinType::UShort:
540 case BuiltinType::Int:
541 case BuiltinType::UInt:
542 case BuiltinType::Long:
543 case BuiltinType::ULong:
544 case BuiltinType::LongLong:
545 case BuiltinType::ULongLong:
546 case BuiltinType::WChar_S:
547 case BuiltinType::WChar_U:
548 case BuiltinType::Char8:
549 case BuiltinType::Char16:
550 case BuiltinType::Char32:
551 case BuiltinType::ShortAccum:
552 case BuiltinType::Accum:
553 case BuiltinType::LongAccum:
554 case BuiltinType::UShortAccum:
555 case BuiltinType::UAccum:
556 case BuiltinType::ULongAccum:
557 case BuiltinType::ShortFract:
558 case BuiltinType::Fract:
559 case BuiltinType::LongFract:
560 case BuiltinType::UShortFract:
561 case BuiltinType::UFract:
562 case BuiltinType::ULongFract:
563 case BuiltinType::SatShortAccum:
564 case BuiltinType::SatAccum:
565 case BuiltinType::SatLongAccum:
566 case BuiltinType::SatUShortAccum:
567 case BuiltinType::SatUAccum:
568 case BuiltinType::SatULongAccum:
569 case BuiltinType::SatShortFract:
570 case BuiltinType::SatFract:
571 case BuiltinType::SatLongFract:
572 case BuiltinType::SatUShortFract:
573 case BuiltinType::SatUFract:
574 case BuiltinType::SatULongFract:
579 case BuiltinType::Float16:
585 case BuiltinType::Half:
592 case BuiltinType::LongDouble:
593 LongDoubleReferenced =
true;
595 case BuiltinType::BFloat16:
597 case BuiltinType::Double:
598 case BuiltinType::Float128:
599 case BuiltinType::Ibm128:
605 case BuiltinType::NullPtr:
610 case BuiltinType::UInt128:
611 case BuiltinType::Int128:
615 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
616 case BuiltinType::Id:
617 #include "clang/Basic/OpenCLImageTypes.def"
618 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
619 case BuiltinType::Sampled##Id:
620 #define IMAGE_WRITE_TYPE(Type, Id, Ext)
621 #define IMAGE_READ_WRITE_TYPE(Type, Id, Ext)
622 #include "clang/Basic/OpenCLImageTypes.def"
623 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
624 case BuiltinType::Id:
625 #include "clang/Basic/OpenCLExtensionTypes.def"
626 case BuiltinType::OCLSampler:
627 case BuiltinType::OCLEvent:
628 case BuiltinType::OCLClkEvent:
629 case BuiltinType::OCLQueue:
630 case BuiltinType::OCLReserveID:
633 case BuiltinType::SveInt8:
634 case BuiltinType::SveUint8:
635 case BuiltinType::SveInt8x2:
636 case BuiltinType::SveUint8x2:
637 case BuiltinType::SveInt8x3:
638 case BuiltinType::SveUint8x3:
639 case BuiltinType::SveInt8x4:
640 case BuiltinType::SveUint8x4:
641 case BuiltinType::SveInt16:
642 case BuiltinType::SveUint16:
643 case BuiltinType::SveInt16x2:
644 case BuiltinType::SveUint16x2:
645 case BuiltinType::SveInt16x3:
646 case BuiltinType::SveUint16x3:
647 case BuiltinType::SveInt16x4:
648 case BuiltinType::SveUint16x4:
649 case BuiltinType::SveInt32:
650 case BuiltinType::SveUint32:
651 case BuiltinType::SveInt32x2:
652 case BuiltinType::SveUint32x2:
653 case BuiltinType::SveInt32x3:
654 case BuiltinType::SveUint32x3:
655 case BuiltinType::SveInt32x4:
656 case BuiltinType::SveUint32x4:
657 case BuiltinType::SveInt64:
658 case BuiltinType::SveUint64:
659 case BuiltinType::SveInt64x2:
660 case BuiltinType::SveUint64x2:
661 case BuiltinType::SveInt64x3:
662 case BuiltinType::SveUint64x3:
663 case BuiltinType::SveInt64x4:
664 case BuiltinType::SveUint64x4:
665 case BuiltinType::SveBool:
666 case BuiltinType::SveBoolx2:
667 case BuiltinType::SveBoolx4:
668 case BuiltinType::SveFloat16:
669 case BuiltinType::SveFloat16x2:
670 case BuiltinType::SveFloat16x3:
671 case BuiltinType::SveFloat16x4:
672 case BuiltinType::SveFloat32:
673 case BuiltinType::SveFloat32x2:
674 case BuiltinType::SveFloat32x3:
675 case BuiltinType::SveFloat32x4:
676 case BuiltinType::SveFloat64:
677 case BuiltinType::SveFloat64x2:
678 case BuiltinType::SveFloat64x3:
679 case BuiltinType::SveFloat64x4:
680 case BuiltinType::SveBFloat16:
681 case BuiltinType::SveBFloat16x2:
682 case BuiltinType::SveBFloat16x3:
683 case BuiltinType::SveBFloat16x4: {
687 Info.
EC.getKnownMinValue() *
690 case BuiltinType::SveCount:
691 return llvm::TargetExtType::get(
getLLVMContext(),
"aarch64.svcount");
692 #define PPC_VECTOR_TYPE(Name, Id, Size) \
693 case BuiltinType::Id: \
695 llvm::FixedVectorType::get(ConvertType(Context.BoolTy), Size); \
697 #include "clang/Basic/PPCTypes.def"
698 #define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
699 #include "clang/Basic/RISCVVTypes.def"
707 llvm::Type *EltTy = llvm::ScalableVectorType::get(
713 Info.
EC.getKnownMinValue());
715 #define WASM_REF_TYPE(Name, MangledName, Id, SingletonId, AS) \
716 case BuiltinType::Id: { \
717 if (BuiltinType::Id == BuiltinType::WasmExternRef) \
718 ResultType = CGM.getTargetCodeGenInfo().getWasmExternrefReferenceType(); \
720 llvm_unreachable("Unexpected wasm reference builtin type!"); \
722 #include "clang/Basic/WebAssemblyReferenceTypes.def"
723 #define AMDGPU_OPAQUE_PTR_TYPE(Name, MangledName, AS, Width, Align, Id, \
725 case BuiltinType::Id: \
726 return llvm::PointerType::get(getLLVMContext(), AS);
727 #include "clang/Basic/AMDGPUTypes.def"
728 #define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
729 #include "clang/Basic/HLSLIntangibleTypes.def"
732 case BuiltinType::Dependent:
733 #define BUILTIN_TYPE(Id, SingletonId)
734 #define PLACEHOLDER_TYPE(Id, SingletonId) \
735 case BuiltinType::Id:
736 #include "clang/AST/BuiltinTypes.def"
737 llvm_unreachable(
"Unexpected placeholder builtin type!");
742 case Type::DeducedTemplateSpecialization:
743 llvm_unreachable(
"Unexpected undeduced type!");
744 case Type::Complex: {
745 llvm::Type *EltTy =
ConvertType(cast<ComplexType>(Ty)->getElementType());
746 ResultType = llvm::StructType::get(EltTy, EltTy);
749 case Type::LValueReference:
750 case Type::RValueReference: {
758 case Type::Pointer: {
767 "__spv::__spirv_JointMatrixINTEL") {
771 "__spv::__spirv_CooperativeMatrixKHR") {
775 "__spv::__spirv_TaskSequenceINTEL") {
777 "spirv.TaskSequenceINTEL");
789 case Type::VariableArray: {
792 "FIXME: We only handle trivial array types so far!");
798 case Type::IncompleteArray: {
801 "FIXME: We only handle trivial array types so far!");
805 if (!ResultType->isSized()) {
806 SkippedLayout =
true;
809 ResultType = llvm::ArrayType::get(ResultType, 0);
812 case Type::ArrayParameter:
813 case Type::ConstantArray: {
819 if (!EltTy->isSized()) {
820 SkippedLayout =
true;
824 ResultType = llvm::ArrayType::get(EltTy, A->
getZExtSize());
827 case Type::ExtVector:
829 const auto *VT = cast<VectorType>(Ty);
831 llvm::Type *IRElemTy = VT->isExtVectorBoolType()
834 ResultType = llvm::FixedVectorType::get(IRElemTy, VT->getNumElements());
837 case Type::ConstantMatrix: {
844 case Type::FunctionNoProto:
845 case Type::FunctionProto:
846 ResultType = ConvertFunctionTypeInternal(
T);
848 case Type::ObjCObject:
849 ResultType =
ConvertType(cast<ObjCObjectType>(Ty)->getBaseType());
852 case Type::ObjCInterface: {
856 llvm::Type *&
T = InterfaceTypes[cast<ObjCInterfaceType>(Ty)];
863 case Type::ObjCObjectPointer: {
869 const EnumDecl *ED = cast<EnumType>(Ty)->getDecl();
879 case Type::BlockPointer: {
892 case Type::MemberPointer: {
893 auto *MPTy = cast<MemberPointerType>(Ty);
894 if (!
getCXXABI().isMemberPointerConvertible(MPTy)) {
895 auto *C = MPTy->getClass();
896 auto Insertion = RecordsWithOpaqueMemberPointers.insert({C,
nullptr});
897 if (Insertion.second)
899 ResultType = Insertion.first->second;
907 QualType valueType = cast<AtomicType>(Ty)->getValueType();
913 if (valueSize != atomicSize) {
914 assert(valueSize < atomicSize);
915 llvm::Type *elts[] = {
917 llvm::ArrayType::get(CGM.
Int8Ty, (atomicSize - valueSize) / 8)
929 const auto &EIT = cast<BitIntType>(Ty);
930 ResultType = llvm::Type::getIntNTy(
getLLVMContext(), EIT->getNumBits());
935 assert(ResultType &&
"Didn't convert a type?");
936 assert((!CachedType || CachedType == ResultType) &&
937 "Cached type doesn't match computed type");
938 TypeCache[Ty] = ResultType;
956 llvm::StructType *&Entry = RecordDeclTypes[Key];
962 if (RD->
hasAttr<SYCLUsesAspectsAttr>())
965 llvm::StructType *Ty = Entry;
974 if (
const CXXRecordDecl *CRD = dyn_cast<CXXRecordDecl>(RD)) {
975 for (
const auto &I : CRD->bases()) {
976 if (I.isVirtual())
continue;
983 CGRecordLayouts[Key] = std::move(Layout);
999 auto I = CGRecordLayouts.find(Key);
1000 if (I != CGRecordLayouts.end())
1006 I = CGRecordLayouts.find(Key);
1008 assert(I != CGRecordLayouts.end() &&
1009 "Unable to find record layout information for type");
1023 if (isa<IncompleteArrayType>(AT))
1025 if (
const auto *CAT = dyn_cast<ConstantArrayType>(AT))
Defines the clang::ASTContext interface.
static llvm::Type * getTypeForFormat(llvm::LLVMContext &VMContext, const llvm::fltSemantics &format, bool UseNativeHalf=false)
llvm::Type * getCooperativeMatrixKHRExtType(llvm::Type *CompTy, ArrayRef< TemplateArgument > TemplateArgs)
llvm::Type * getJointMatrixINTELExtType(llvm::Type *CompTy, ArrayRef< TemplateArgument > TemplateArgs, const unsigned Val=0)
static Decl::Kind getKind(const Decl *D)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
llvm::MachO::Target Target
llvm::MachO::Record Record
static CharUnits getTypeAllocSize(CodeGenModule &CGM, llvm::Type *type)
BuiltinVectorTypeInfo getBuiltinVectorTypeInfo(const BuiltinType *VecTy) const
Returns the element type, element count and number of vectors (in case of tuple) for a builtin vector...
const clang::PrintingPolicy & getPrintingPolicy() const
const llvm::fltSemantics & getFloatTypeSemantics(QualType T) const
Return the APFloat 'semantics' for the specified scalar floating point type.
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl.
QualType getRecordType(const RecordDecl *Decl) const
uint64_t getTargetNullPointerValue(QualType QT) const
Get target-dependent integer value for null pointer which is used for constant folding.
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
const LangOptions & getLangOpts() const
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
const TargetInfo & getTargetInfo() const
uint64_t getConstantArrayElementCount(const ConstantArrayType *CA) const
Return number of constant array elements.
unsigned getTargetAddressSpace(LangAS AS) const
QualType getElementType() const
unsigned getIndexTypeCVRQualifiers() const
Attr - This represents one attribute.
Represents a C++ struct/union/class.
Represents a canonical, potentially-qualified type.
const T * getTypePtr() const
Retrieve the underlying type pointer, which refers to a canonical type.
CharUnits - This is an opaque type for sizes expressed in character units.
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.
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
virtual bool isMemberPointerConvertible(const MemberPointerType *MPT) const
Return whether or not a member pointers type is convertible to an IR type.
virtual llvm::Type * ConvertMemberPointerType(const MemberPointerType *MPT)
Find the LLVM type used to represent the given member pointer type.
virtual bool isZeroInitializable(const MemberPointerType *MPT)
Return true if the given member pointer can be zero-initialized (in the C++ sense) with an LLVM zeroi...
This class gathers all debug information during compilation and is responsible for emitting to llvm g...
CGFunctionInfo - Class to encapsulate the information about a function definition.
llvm::Type * convertHLSLSpecificType(const Type *T)
virtual llvm::Type * getPipeType(const PipeType *T, StringRef Name, llvm::Type *&PipeTy)
virtual llvm::Type * convertOpenCLSpecificType(const Type *T)
CGRecordLayout - This class handles struct and union layout info while lowering AST types to LLVM typ...
bool isZeroInitializable() const
Check whether this struct can be C++ zero-initialized with a zeroinitializer.
This class organizes the cross-function state that is used while generating LLVM code.
bool isPaddedAtomicType(QualType type)
void setAspectsEnumDecl(const EnumDecl *ED)
const llvm::Triple & getTriple() const
CGOpenCLRuntime & getOpenCLRuntime()
Return a reference to the configured OpenCL runtime.
CGDebugInfo * getModuleDebugInfo()
CGHLSLRuntime & getHLSLRuntime()
Return a reference to the configured HLSL runtime.
const TargetCodeGenInfo & getTargetCodeGenInfo()
const CodeGenOptions & getCodeGenOpts() const
void addTypeWithAspects(StringRef TypeName, const RecordDecl *RD)
CodeGenTypes(CodeGenModule &cgm)
llvm::Type * ConvertType(QualType T)
ConvertType - Convert type T into a llvm::Type.
bool isPointerZeroInitializable(QualType T)
Check if the pointer type can be zero-initialized (in the C++ sense) with an LLVM zeroinitializer.
const CodeGenOptions & getCodeGenOpts() const
const CGFunctionInfo & arrangeFreeFunctionType(CanQual< FunctionProtoType > Ty)
Arrange the argument and result information for a value of the given freestanding function type.
llvm::FunctionType * GetFunctionType(const CGFunctionInfo &Info)
GetFunctionType - Get the LLVM function type for.
bool isFuncTypeConvertible(const FunctionType *FT)
isFuncTypeConvertible - Utility to check whether a function type can be converted to an LLVM type (i....
const llvm::DataLayout & getDataLayout() const
std::unique_ptr< CGRecordLayout > ComputeRecordLayout(const RecordDecl *D, llvm::StructType *Ty)
Compute a new LLVM record layout object for the given record.
llvm::Type * convertTypeForLoadStore(QualType T, llvm::Type *LLVMTy=nullptr)
Given that T is a scalar type, return the IR type that should be used for load and store operations.
const CGRecordLayout & getCGRecordLayout(const RecordDecl *)
getCGRecordLayout - Return record layout info for the given record decl.
unsigned getTargetAddressSpace(QualType T) const
llvm::StructType * ConvertRecordDeclType(const RecordDecl *TD)
ConvertRecordDeclType - Lay out a tagged decl type like struct or union.
void RefreshTypeCacheForClass(const CXXRecordDecl *RD)
Remove stale types from the type cache when an inheritance model gets assigned to a class.
bool isRecordLayoutComplete(const Type *Ty) const
isRecordLayoutComplete - Return true if the specified type is already completely laid out.
llvm::Type * ConvertTypeForMem(QualType T)
ConvertTypeForMem - Convert type T into a llvm::Type.
void UpdateCompletedType(const TagDecl *TD)
UpdateCompletedType - When we find the full definition for a TagDecl, replace the 'opaque' type we pr...
llvm::Type * ConvertSPVCooperativeMatrixType(RecordDecl *RD)
ConvertSPVCooperativeMatrixType - Convert SYCL joint_matrix type which is represented as a pointer to...
bool typeRequiresSplitIntoByteArray(QualType ASTTy, llvm::Type *LLVMTy=nullptr)
Check whether the given type needs to be laid out in memory using an opaque byte-array type because i...
ASTContext & getContext() const
bool isFuncParamTypeConvertible(QualType Ty)
isFuncParamTypeConvertible - Return true if the specified type in a function parameter or result posi...
llvm::Type * ConvertSYCLJointMatrixINTELType(RecordDecl *RD)
ConvertSYCLJointMatrixINTELType - Convert SYCL joint_matrix type which is represented as a pointer to...
bool isZeroInitializable(QualType T)
IsZeroInitializable - Return whether a type can be zero-initialized (in the C++ sense) with an LLVM z...
void addRecordTypeName(const RecordDecl *RD, llvm::StructType *Ty, StringRef suffix)
addRecordTypeName - Compute a name from the given record decl with an optional suffix and name the gi...
CGCXXABI & getCXXABI() const
llvm::LLVMContext & getLLVMContext()
virtual llvm::Type * getCUDADeviceBuiltinSurfaceDeviceType() const
Return the device-side type for the CUDA device builtin surface type.
virtual llvm::Type * getCUDADeviceBuiltinTextureDeviceType() const
Return the device-side type for the CUDA device builtin texture type.
Represents the canonical version of C arrays with a specified constant size.
uint64_t getZExtSize() const
Return the size zero-extended as a uint64_t.
Represents a concrete matrix type with constant number of rows and columns.
unsigned getNumColumns() const
Returns the number of columns in the matrix.
unsigned getNumRows() const
Returns the number of rows in the matrix.
ASTContext & getASTContext() const LLVM_READONLY
DeclContext * getDeclContext()
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a prototype with parameter type info, e.g.
FunctionType - C99 6.7.5.3 - Function Declarators.
QualType getReturnType() const
Represents a C array with an unspecified size.
QualType getElementType() const
Returns type of the elements being stored in the matrix.
A pointer to member type per C++ 8.3.3 - Pointers to members.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
std::string getQualifiedNameAsString(bool WithGlobalNsPrefix=false) const
void printQualifiedName(raw_ostream &OS) const
Returns a human-readable qualified name for this declaration, like A::B::i, for i being member of nam...
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getPointeeType() const
A (possibly-)qualified type.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
LangAS getAddressSpace() const
Return the address space of this type.
const Type * getTypePtrOrNull() const
Represents a struct/union/class.
RecordDecl * getDefinition() const
Returns the RecordDecl that actually defines this struct/union/class.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getDecl() const
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeType() const
Represents the declaration of a struct/union/class/enum.
StringRef getKindName() const
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
void printName(raw_ostream &OS, const PrintingPolicy &Policy) const override
Pretty-print the unqualified name of this declaration.
TypedefNameDecl * getTypedefNameForAnonDecl() const
bool isDependentType() const
Whether this declaration declares a type that is dependent, i.e., a type that somehow depends on temp...
virtual bool useFP16ConversionIntrinsics() const
Check whether llvm intrinsics such as llvm.convert.to.fp16 should be used to convert to and from __fp...
@ Type
The template argument is a type.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
The base class of all kinds of template declarations (e.g., class, function, etc.).
The base class of the type hierarchy.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isBlockPointerType() const
bool isConstantMatrixType() const
bool isCUDADeviceBuiltinSurfaceType() const
Check if the type is the CUDA device builtin surface type.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isExtVectorBoolType() const
bool isBitIntType() const
bool isCUDADeviceBuiltinTextureType() const
Check if the type is the CUDA device builtin texture type.
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...
bool isFunctionType() const
bool isStructureOrClassType() const
bool isAnyPointerType() const
TypeClass getTypeClass() const
const T * getAs() const
Member-template getAs<specific type>'.
Base class for declarations which introduce a typedef-name.
Represents a C array with a specified size that is not an integer-constant-expression.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
std::unique_ptr< DiagnosticConsumer > create(StringRef OutputFile, DiagnosticOptions *Diags, bool MergeChildRecords=false)
Returns a DiagnosticConsumer that serializes diagnostics to a bitcode file.
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64
Describes how types, statements, expressions, and declarations should be printed.
unsigned SuppressInlineNamespace
Suppress printing parts of scope specifiers that correspond to inline namespaces, where the name is u...