clang 17.0.0git
Namespaces | Macros | Functions
TargetInfo.cpp File Reference
#include "TargetInfo.h"
#include "ABIInfo.h"
#include "CGBlocks.h"
#include "CGCXXABI.h"
#include "CGValue.h"
#include "CodeGenFunction.h"
#include "clang/AST/Attr.h"
#include "clang/AST/RecordLayout.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/CodeGenOptions.h"
#include "clang/Basic/DiagnosticFrontend.h"
#include "clang/CodeGen/CGFunctionInfo.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Twine.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/IntrinsicsNVPTX.h"
#include "llvm/IR/IntrinsicsS390.h"
#include "llvm/IR/Type.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/Triple.h"
#include <algorithm>
#include "clang/Basic/OpenCLImageTypes.def"
#include "clang/Basic/OpenCLExtensionTypes.def"
Include dependency graph for TargetInfo.cpp:

Go to the source code of this file.

Namespaces

namespace  clang
 
namespace  clang::CodeGen
 

Macros

#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix)
 
#define INTEL_SUBGROUP_AVC_TYPE(Name, Id)
 

Functions

static ABIArgInfo coerceToIntArray (QualType Ty, ASTContext &Context, llvm::LLVMContext &LLVMContext)
 
static void AssignToArrayRange (CodeGen::CGBuilderTy &Builder, llvm::Value *Array, llvm::Value *Value, unsigned FirstIndex, unsigned LastIndex)
 
static bool isAggregateTypeForABI (QualType T)
 
static llvm::TypegetVAListElementType (CodeGenFunction &CGF)
 
static bool occupiesMoreThan (CodeGenTypes &cgt, ArrayRef< llvm::Type * > scalarTypes, unsigned maxAllRegisters)
 Does the given lowering require more than the given number of registers when expanded?
 
static CGCXXABI::RecordArgABI getRecordArgABI (const RecordType *RT, CGCXXABI &CXXABI)
 
static CGCXXABI::RecordArgABI getRecordArgABI (QualType T, CGCXXABI &CXXABI)
 
static bool classifyReturnType (const CGCXXABI &CXXABI, CGFunctionInfo &FI, const ABIInfo &Info)
 
static QualType useFirstFieldIfTransparentUnion (QualType Ty)
 Pass transparent unions as if they were the type of the first element.
 
static llvm::ValueemitRoundPointerUpToAlignment (CodeGenFunction &CGF, llvm::Value *Ptr, CharUnits Align)
 
static Address emitVoidPtrDirectVAArg (CodeGenFunction &CGF, Address VAListAddr, llvm::Type *DirectTy, CharUnits DirectSize, CharUnits DirectAlign, CharUnits SlotSize, bool AllowHigherAlign, bool ForceRightAdjust=false)
 Emit va_arg for a platform using the common void* representation, where arguments are simply emitted in an array of slots on the stack.
 
static Address emitVoidPtrVAArg (CodeGenFunction &CGF, Address VAListAddr, QualType ValueTy, bool IsIndirect, TypeInfoChars ValueInfo, CharUnits SlotSizeAndAlign, bool AllowHigherAlign, bool ForceRightAdjust=false)
 Emit va_arg for a platform using the common void* representation, where arguments are simply emitted in an array of slots on the stack.
 
static Address complexTempStructure (CodeGenFunction &CGF, Address VAListAddr, QualType Ty, CharUnits SlotSize, CharUnits EltSize, const ComplexType *CTy)
 
static Address emitMergePHI (CodeGenFunction &CGF, Address Addr1, llvm::BasicBlock *Block1, Address Addr2, llvm::BasicBlock *Block2, const llvm::Twine &Name="")
 
static bool isEmptyRecord (ASTContext &Context, QualType T, bool AllowArrays)
 isEmptyRecord - Return true iff a structure contains only empty fields.
 
static bool isEmptyField (ASTContext &Context, const FieldDecl *FD, bool AllowArrays)
 isEmptyField - Return true iff a the field is "empty", that is it is an unnamed bit-field or an (array of) empty record(s).
 
static const TypeisSingleElementStruct (QualType T, ASTContext &Context)
 isSingleElementStruct - Determine if a structure is a "single element struct", i.e.
 
static void rewriteInputConstraintReferences (unsigned FirstIn, unsigned NumNewOuts, std::string &AsmString)
 Rewrite input constraint references after adding some output constraints.
 
static bool is32Or64BitBasicType (QualType Ty, ASTContext &Context)
 
static bool addFieldSizes (ASTContext &Context, const RecordDecl *RD, uint64_t &Size)
 
static bool addBaseAndFieldSizes (ASTContext &Context, const CXXRecordDecl *RD, uint64_t &Size)
 
static bool isSIMDVectorType (ASTContext &Context, QualType Ty)
 
static bool isRecordWithSIMDVectorType (ASTContext &Context, QualType Ty)
 
static bool isArgInAlloca (const ABIArgInfo &Info)
 
static void addX86InterruptAttrs (const FunctionDecl *FD, llvm::GlobalValue *GV, CodeGen::CodeGenModule &CGM)
 
static bool BitsContainNoUserData (QualType Ty, unsigned StartBit, unsigned EndBit, ASTContext &Context)
 BitsContainNoUserData - Return true if the specified [start,end) bit range is known to either be off the end of the specified type or being in alignment padding.
 
static llvm::TypegetFPTypeAtOffset (llvm::Type *IRType, unsigned IROffset, const llvm::DataLayout &TD)
 getFPTypeAtOffset - Return a floating point type at the specified offset.
 
static llvm::TypeGetX86_64ByValArgumentPair (llvm::Type *Lo, llvm::Type *Hi, const llvm::DataLayout &TD)
 GetX86_64ByValArgumentPair - Given a high and low type that can ideally be used as elements of a two register pair to pass or return, return a first class aggregate to represent them.
 
static Address EmitX86_64VAArgFromMemory (CodeGenFunction &CGF, Address VAListAddr, QualType Ty)
 
static bool PPC_initDwarfEHRegSizeTable (CodeGen::CodeGenFunction &CGF, llvm::Value *Address, bool Is64Bit, bool IsAIX)
 
static bool isIntegerLikeType (QualType Ty, ASTContext &Context, llvm::LLVMContext &VMContext)
 
static bool HexagonAdjustRegsLeft (uint64_t Size, unsigned *RegsLeft)
 
static bool requiresAMDGPUProtectedVisibility (const Decl *D, llvm::GlobalValue *GV)
 
static bool getTypeString (SmallStringEnc &Enc, const Decl *D, const CodeGen::CodeGenModule &CGM, TypeStringCache &TSC)
 The XCore ABI includes a type information section that communicates symbol type information to the linker.
 
void clang::CodeGen::computeSPIRKernelABIInfo (CodeGenModule &CGM, CGFunctionInfo &FI)
 
static bool appendType (SmallStringEnc &Enc, QualType QType, const CodeGen::CodeGenModule &CGM, TypeStringCache &TSC)
 Handles the type's qualifier before dispatching a call to handle specific type encodings.
 
static bool extractFieldType (SmallVectorImpl< FieldEncoding > &FE, const RecordDecl *RD, const CodeGen::CodeGenModule &CGM, TypeStringCache &TSC)
 Helper function for appendRecordType().
 
static bool appendRecordType (SmallStringEnc &Enc, const RecordType *RT, const CodeGen::CodeGenModule &CGM, TypeStringCache &TSC, const IdentifierInfo *ID)
 Appends structure and union types to Enc and adds encoding to cache.
 
static bool appendEnumType (SmallStringEnc &Enc, const EnumType *ET, TypeStringCache &TSC, const IdentifierInfo *ID)
 Appends enum types to Enc and adds the encoding to the cache.
 
static void appendQualifier (SmallStringEnc &Enc, QualType QT)
 Appends type's qualifier to Enc.
 
static bool appendBuiltinType (SmallStringEnc &Enc, const BuiltinType *BT)
 Appends built-in types to Enc.
 
static bool appendPointerType (SmallStringEnc &Enc, const PointerType *PT, const CodeGen::CodeGenModule &CGM, TypeStringCache &TSC)
 Appends a pointer encoding to Enc before calling appendType for the pointee.
 
static bool appendArrayType (SmallStringEnc &Enc, QualType QT, const ArrayType *AT, const CodeGen::CodeGenModule &CGM, TypeStringCache &TSC, StringRef NoSizeEnc)
 Appends array encoding to Enc before calling appendType for the element.
 
static bool appendFunctionType (SmallStringEnc &Enc, const FunctionType *FT, const CodeGen::CodeGenModule &CGM, TypeStringCache &TSC)
 Appends a function encoding to Enc, calling appendType for the return type and the arguments.
 
static llvm::TypegetSPIRVImageType (llvm::LLVMContext &Ctx, StringRef BaseType, StringRef OpenCLName, unsigned AccessQualifier)
 Construct a SPIR-V target extension type for the given OpenCL image type.
 

Macro Definition Documentation

◆ IMAGE_TYPE

#define IMAGE_TYPE (   ImgType,
  Id,
  SingletonId,
  Access,
  Suffix 
)
Value:
case BuiltinType::Id: \
return getSPIRVImageType(Ctx, "spirv.Image", #ImgType, AQ_##Suffix);
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.

◆ INTEL_SUBGROUP_AVC_TYPE

#define INTEL_SUBGROUP_AVC_TYPE (   Name,
  Id 
)
Value:
case BuiltinType::OCLIntelSubgroupAVC##Id: \
return llvm::TargetExtType::get(Ctx, "spirv.Avc" #Id "INTEL");
int Id
Definition: ASTDiff.cpp:190

Function Documentation

◆ addBaseAndFieldSizes()

static bool addBaseAndFieldSizes ( ASTContext Context,
const CXXRecordDecl RD,
uint64_t &  Size 
)
static

◆ addFieldSizes()

static bool addFieldSizes ( ASTContext Context,
const RecordDecl RD,
uint64_t &  Size 
)
static

◆ addX86InterruptAttrs()

static void addX86InterruptAttrs ( const FunctionDecl FD,
llvm::GlobalValue *  GV,
CodeGen::CodeGenModule CGM 
)
static

◆ appendArrayType()

static bool appendArrayType ( SmallStringEnc &  Enc,
QualType  QT,
const ArrayType AT,
const CodeGen::CodeGenModule CGM,
TypeStringCache &  TSC,
StringRef  NoSizeEnc 
)
static

Appends array encoding to Enc before calling appendType for the element.

Definition at line 10874 of file TargetInfo.cpp.

References appendQualifier(), appendType(), clang::ArrayType::getElementType(), clang::ArrayType::getSizeModifier(), and clang::ArrayType::Normal.

Referenced by appendType(), and getTypeString().

◆ appendBuiltinType()

static bool appendBuiltinType ( SmallStringEnc &  Enc,
const BuiltinType BT 
)
static

Appends built-in types to Enc.

Definition at line 10804 of file TargetInfo.cpp.

References clang::BuiltinType::getKind().

Referenced by appendType().

◆ appendEnumType()

static bool appendEnumType ( SmallStringEnc &  Enc,
const EnumType ET,
TypeStringCache &  TSC,
const IdentifierInfo ID 
)
static

Appends enum types to Enc and adds the encoding to the cache.

Definition at line 10746 of file TargetInfo.cpp.

References clang::EnumType::getDecl(), and clang::EnumDecl::getDefinition().

Referenced by appendType().

◆ appendFunctionType()

static bool appendFunctionType ( SmallStringEnc &  Enc,
const FunctionType FT,
const CodeGen::CodeGenModule CGM,
TypeStringCache &  TSC 
)
static

Appends a function encoding to Enc, calling appendType for the return type and the arguments.

Definition at line 10896 of file TargetInfo.cpp.

References appendType(), clang::Type::getAs(), and clang::FunctionType::getReturnType().

Referenced by appendType().

◆ appendPointerType()

static bool appendPointerType ( SmallStringEnc &  Enc,
const PointerType PT,
const CodeGen::CodeGenModule CGM,
TypeStringCache &  TSC 
)
static

Appends a pointer encoding to Enc before calling appendType for the pointee.

Definition at line 10863 of file TargetInfo.cpp.

References appendType(), and clang::PointerType::getPointeeType().

Referenced by appendType().

◆ appendQualifier()

static void appendQualifier ( SmallStringEnc &  Enc,
QualType  QT 
)
static

Appends type's qualifier to Enc.

This is done prior to appending the type's encoding.

Definition at line 10790 of file TargetInfo.cpp.

References clang::QualType::isConstQualified(), clang::QualType::isRestrictQualified(), and clang::QualType::isVolatileQualified().

Referenced by appendArrayType(), and appendType().

◆ appendRecordType()

static bool appendRecordType ( SmallStringEnc &  Enc,
const RecordType RT,
const CodeGen::CodeGenModule CGM,
TypeStringCache &  TSC,
const IdentifierInfo ID 
)
static

Appends structure and union types to Enc and adds encoding to cache.

Recursively calls appendType (via extractFieldType) for each field. Union types have their fields ordered according to the ABI.

Definition at line 10694 of file TargetInfo.cpp.

References extractFieldType(), clang::RecordDecl::field_empty(), clang::RecordType::getDecl(), clang::RecordDecl::getDefinition(), and clang::Type::isUnionType().

Referenced by appendType().

◆ appendType()

static bool appendType ( SmallStringEnc &  Enc,
QualType  QType,
const CodeGen::CodeGenModule CGM,
TypeStringCache &  TSC 
)
static

◆ AssignToArrayRange()

static void AssignToArrayRange ( CodeGen::CGBuilderTy Builder,
llvm::Value Array,
llvm::Value Value,
unsigned  FirstIndex,
unsigned  LastIndex 
)
static

Definition at line 67 of file TargetInfo.cpp.

References clang::CharUnits::One().

Referenced by PPC_initDwarfEHRegSizeTable().

◆ BitsContainNoUserData()

static bool BitsContainNoUserData ( QualType  Ty,
unsigned  StartBit,
unsigned  EndBit,
ASTContext Context 
)
static

BitsContainNoUserData - Return true if the specified [start,end) bit range is known to either be off the end of the specified type or being in alignment padding.

The user type specified is known to be at most 128 bits in size, and have passed through X86_64ABIInfo::classify with a successful classification that put one of the two halves in the INTEGER class.

It is conservatively correct to return false.

Definition at line 3359 of file TargetInfo.cpp.

References BitsContainNoUserData(), clang::RecordDecl::field_begin(), clang::RecordDecl::field_end(), clang::Type::getAs(), clang::ASTContext::getAsConstantArrayType(), clang::ASTContext::getASTRecordLayout(), clang::ASTRecordLayout::getBaseClassOffset(), clang::RecordType::getDecl(), clang::ASTRecordLayout::getFieldOffset(), clang::ASTContext::getTypeSize(), and clang::ASTContext::toBits().

Referenced by BitsContainNoUserData().

◆ classifyReturnType()

static bool classifyReturnType ( const CGCXXABI CXXABI,
CGFunctionInfo FI,
const ABIInfo Info 
)
static

◆ coerceToIntArray()

static ABIArgInfo coerceToIntArray ( QualType  Ty,
ASTContext Context,
llvm::LLVMContext &  LLVMContext 
)
static

◆ complexTempStructure()

static Address complexTempStructure ( CodeGenFunction CGF,
Address  VAListAddr,
QualType  Ty,
CharUnits  SlotSize,
CharUnits  EltSize,
const ComplexType CTy 
)
static

◆ emitMergePHI()

static Address emitMergePHI ( CodeGenFunction CGF,
Address  Addr1,
llvm::BasicBlock *  Block1,
Address  Addr2,
llvm::BasicBlock *  Block2,
const llvm::Twine &  Name = "" 
)
static

◆ emitRoundPointerUpToAlignment()

static llvm::Value * emitRoundPointerUpToAlignment ( CodeGenFunction CGF,
llvm::Value Ptr,
CharUnits  Align 
)
static

◆ emitVoidPtrDirectVAArg()

static Address emitVoidPtrDirectVAArg ( CodeGenFunction CGF,
Address  VAListAddr,
llvm::Type DirectTy,
CharUnits  DirectSize,
CharUnits  DirectAlign,
CharUnits  SlotSize,
bool  AllowHigherAlign,
bool  ForceRightAdjust = false 
)
static

Emit va_arg for a platform using the common void* representation, where arguments are simply emitted in an array of slots on the stack.

This version implements the core direct-value passing rules.

Parameters
SlotSize- The size and alignment of a stack slot. Each argument will be allocated to a multiple of this number of slots, and all the slots will be aligned to this value.
AllowHigherAlign- The slot alignment is not a cap; an argument type with an alignment greater than the slot size will be emitted on a higher-alignment address, potentially leaving one or more empty slots behind as padding. If this is false, the returned address might be less-aligned than DirectAlign.
ForceRightAdjust- Default is false. On big-endian platform and if the argument is smaller than a slot, set this flag will force right-adjust the argument in its slot irrespective of the type.

Definition at line 328 of file TargetInfo.cpp.

References clang::CharUnits::alignTo(), clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CGBuilderTy::CreateConstInBoundsByteGEP(), clang::CodeGen::CGBuilderTy::CreateElementBitCast(), clang::CodeGen::CGBuilderTy::CreateLoad(), clang::CodeGen::CGBuilderTy::CreateStore(), emitRoundPointerUpToAlignment(), clang::CodeGen::CodeGenModule::getDataLayout(), clang::CodeGen::Address::getElementType(), clang::CodeGen::Address::getPointer(), clang::CodeGen::CodeGenTypeCache::Int8PtrTy, clang::CodeGen::CodeGenTypeCache::Int8Ty, and clang::CodeGen::Address::invalid().

Referenced by complexTempStructure(), and emitVoidPtrVAArg().

◆ emitVoidPtrVAArg()

static Address emitVoidPtrVAArg ( CodeGenFunction CGF,
Address  VAListAddr,
QualType  ValueTy,
bool  IsIndirect,
TypeInfoChars  ValueInfo,
CharUnits  SlotSizeAndAlign,
bool  AllowHigherAlign,
bool  ForceRightAdjust = false 
)
static

Emit va_arg for a platform using the common void* representation, where arguments are simply emitted in an array of slots on the stack.

Parameters
IsIndirect- Values of this type are passed indirectly.
ValueInfo- The size and alignment of this type, generally computed with getContext().getTypeInfoInChars(ValueTy).
SlotSizeAndAlign- The size and alignment of a stack slot. Each argument will be allocated to a multiple of this number of slots, and all the slots will be aligned to this value.
AllowHigherAlign- The slot alignment is not a cap; an argument type with an alignment greater than the slot size will be emitted on a higher-alignment address, potentially leaving one or more empty slots behind as padding.
ForceRightAdjust- Default is false. On big-endian platform and if the argument is smaller than a slot, set this flag will force right-adjust the argument in its slot irrespective of the type.

Definition at line 385 of file TargetInfo.cpp.

References clang::TypeInfoChars::Align, clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::ConvertTypeForMem(), clang::CodeGen::CGBuilderTy::CreateLoad(), emitVoidPtrDirectVAArg(), clang::CodeGen::CodeGenTypeCache::getPointerAlign(), clang::CodeGen::CodeGenTypeCache::getPointerSize(), and clang::TypeInfoChars::Width.

◆ EmitX86_64VAArgFromMemory()

static Address EmitX86_64VAArgFromMemory ( CodeGenFunction CGF,
Address  VAListAddr,
QualType  Ty 
)
static

◆ extractFieldType()

static bool extractFieldType ( SmallVectorImpl< FieldEncoding > &  FE,
const RecordDecl RD,
const CodeGen::CodeGenModule CGM,
TypeStringCache &  TSC 
)
static

Helper function for appendRecordType().

Builds a SmallVector containing the encoded field types in declaration order.

Definition at line 10666 of file TargetInfo.cpp.

References appendType(), clang::RecordDecl::fields(), clang::CodeGen::CodeGenModule::getContext(), and OS.

Referenced by appendRecordType().

◆ getFPTypeAtOffset()

static llvm::Type * getFPTypeAtOffset ( llvm::Type IRType,
unsigned  IROffset,
const llvm::DataLayout &  TD 
)
static

getFPTypeAtOffset - Return a floating point type at the specified offset.

Definition at line 3437 of file TargetInfo.cpp.

References getFPTypeAtOffset().

Referenced by getFPTypeAtOffset().

◆ getRecordArgABI() [1/2]

static CGCXXABI::RecordArgABI getRecordArgABI ( const RecordType RT,
CGCXXABI CXXABI 
)
static

◆ getRecordArgABI() [2/2]

static CGCXXABI::RecordArgABI getRecordArgABI ( QualType  T,
CGCXXABI CXXABI 
)
static

◆ getSPIRVImageType()

static llvm::Type * getSPIRVImageType ( llvm::LLVMContext &  Ctx,
StringRef  BaseType,
StringRef  OpenCLName,
unsigned  AccessQualifier 
)
static

Construct a SPIR-V target extension type for the given OpenCL image type.

Definition at line 10992 of file TargetInfo.cpp.

◆ getTypeString()

static bool getTypeString ( SmallStringEnc &  Enc,
const Decl D,
const CodeGen::CodeGenModule CGM,
TypeStringCache &  TSC 
)
static

The XCore ABI includes a type information section that communicates symbol type information to the linker.

The linker uses this information to verify safety/correctness of things such as array bound and pointers et al. The ABI only requires C (and XC) language modules to emit TypeStrings. This type information (TypeString) is emitted into meta data for all global symbols: definitions, declarations, functions & variables.

The TypeString carries type, qualifier, name, size & value details. Please see 'Tools Development Guide' section 2.16.2 for format details: https://www.xmos.com/download/public/Tools-Development-Guide%28X9114A%29.pdf The output is tested by test/CodeGen/xcore-stringtype.c.

Definition at line 10964 of file TargetInfo.cpp.

References appendArrayType(), appendType(), clang::CLanguageLinkage, clang::Type::getAsArrayTypeUnsafe(), clang::QualType::getCanonicalType(), clang::VarDecl::getLanguageLinkage(), clang::FunctionDecl::getLanguageLinkage(), and clang::ValueDecl::getType().

◆ getVAListElementType()

static llvm::Type * getVAListElementType ( CodeGenFunction CGF)
static

◆ GetX86_64ByValArgumentPair()

static llvm::Type * GetX86_64ByValArgumentPair ( llvm::Type Lo,
llvm::Type Hi,
const llvm::DataLayout &  TD 
)
static

GetX86_64ByValArgumentPair - Given a high and low type that can ideally be used as elements of a two register pair to pass or return, return a first class aggregate to represent them.

For example, if the low part of a by-value argument should be passed as i32* and the high part as float, return {i32*, float}.

Definition at line 3595 of file TargetInfo.cpp.

References clang::Result.

◆ HexagonAdjustRegsLeft()

static bool HexagonAdjustRegsLeft ( uint64_t  Size,
unsigned RegsLeft 
)
static

Definition at line 8716 of file TargetInfo.cpp.

◆ is32Or64BitBasicType()

static bool is32Or64BitBasicType ( QualType  Ty,
ASTContext Context 
)
static

◆ isAggregateTypeForABI()

static bool isAggregateTypeForABI ( QualType  T)
static

Definition at line 80 of file TargetInfo.cpp.

References clang::Type::isMemberFunctionPointerType().

Referenced by isSingleElementStruct().

◆ isArgInAlloca()

static bool isArgInAlloca ( const ABIArgInfo Info)
static

◆ isEmptyField()

static bool isEmptyField ( ASTContext Context,
const FieldDecl FD,
bool  AllowArrays 
)
static

isEmptyField - Return true iff a the field is "empty", that is it is an unnamed bit-field or an (array of) empty record(s).

Definition at line 555 of file TargetInfo.cpp.

References clang::Type::getAs(), clang::ASTContext::getAsConstantArrayType(), clang::RecordType::getDecl(), clang::ValueDecl::getType(), clang::Decl::hasAttr(), isEmptyRecord(), and clang::FieldDecl::isUnnamedBitfield().

Referenced by isEmptyRecord(), and isSingleElementStruct().

◆ isEmptyRecord()

static bool isEmptyRecord ( ASTContext Context,
QualType  T,
bool  AllowArrays 
)
static

isEmptyRecord - Return true iff a structure contains only empty fields.

Note that a structure with a flexible array member is not considered empty.

Definition at line 599 of file TargetInfo.cpp.

References clang::RecordDecl::fields(), clang::Type::getAs(), clang::RecordType::getDecl(), clang::RecordDecl::hasFlexibleArrayMember(), isEmptyField(), and isEmptyRecord().

Referenced by isEmptyField(), isEmptyRecord(), clang::CodeGen::ABIInfo::isHomogeneousAggregate(), and isSingleElementStruct().

◆ isIntegerLikeType()

static bool isIntegerLikeType ( QualType  Ty,
ASTContext Context,
llvm::LLVMContext &  VMContext 
)
static

◆ isRecordWithSIMDVectorType()

static bool isRecordWithSIMDVectorType ( ASTContext Context,
QualType  Ty 
)
static

◆ isSIMDVectorType()

static bool isSIMDVectorType ( ASTContext Context,
QualType  Ty 
)
static

Definition at line 1634 of file TargetInfo.cpp.

References clang::Type::getAs(), and clang::ASTContext::getTypeSize().

Referenced by isRecordWithSIMDVectorType().

◆ isSingleElementStruct()

static const Type * isSingleElementStruct ( QualType  T,
ASTContext Context 
)
static

isSingleElementStruct - Determine if a structure is a "single element struct", i.e.

it has exactly one non-empty field or exactly one field which is itself a single element struct. Structures with flexible array members are never considered single element structs.

Returns
The field declaration for the single non-empty field, if it exists.

Definition at line 627 of file TargetInfo.cpp.

References clang::RecordDecl::fields(), clang::Type::getAs(), clang::ASTContext::getAsConstantArrayType(), clang::RecordType::getDecl(), clang::QualType::getTypePtr(), clang::ASTContext::getTypeSize(), clang::RecordDecl::hasFlexibleArrayMember(), isAggregateTypeForABI(), isEmptyField(), isEmptyRecord(), and isSingleElementStruct().

Referenced by isSingleElementStruct().

◆ occupiesMoreThan()

static bool occupiesMoreThan ( CodeGenTypes cgt,
ArrayRef< llvm::Type * >  scalarTypes,
unsigned  maxAllRegisters 
)
static

Does the given lowering require more than the given number of registers when expanded?

This is intended to be the basis of a reasonable basic implementation of should{Pass,Return}IndirectlyForSwift.

For most targets, a limit of four total registers is reasonable; this limits the amount of code required in order to move around the value in case it wasn't produced immediately prior to the call by the caller (or wasn't produced in exactly the right registers) or isn't used immediately within the callee. But some targets may need to further limit the register count due to an inability to support that many return registers.

Definition at line 136 of file TargetInfo.cpp.

References clang::Default, clang::TargetInfo::getPointerWidth(), clang::CodeGen::CodeGenTypes::getTarget(), and clang::ast_matchers::type.

Referenced by clang::CodeGen::SwiftABIInfo::shouldPassIndirectly().

◆ PPC_initDwarfEHRegSizeTable()

static bool PPC_initDwarfEHRegSizeTable ( CodeGen::CodeGenFunction CGF,
llvm::Value Address,
bool  Is64Bit,
bool  IsAIX 
)
static

◆ requiresAMDGPUProtectedVisibility()

static bool requiresAMDGPUProtectedVisibility ( const Decl D,
llvm::GlobalValue *  GV 
)
static

Definition at line 9482 of file TargetInfo.cpp.

References clang::Decl::hasAttr().

◆ rewriteInputConstraintReferences()

static void rewriteInputConstraintReferences ( unsigned  FirstIn,
unsigned  NumNewOuts,
std::string &  AsmString 
)
static

Rewrite input constraint references after adding some output constraints.

In the case where there is one output and one input and we add one output, we need to replace all operand references greater than or equal to 1: mov $0, $1 mov eax, $1 The result will be: mov $0, $2 mov eax, $2

Definition at line 1318 of file TargetInfo.cpp.

References OS.

◆ useFirstFieldIfTransparentUnion()

static QualType useFirstFieldIfTransparentUnion ( QualType  Ty)
static

Pass transparent unions as if they were the type of the first element.

Sema should ensure that all elements of the union have the same "machine type".

Definition at line 202 of file TargetInfo.cpp.

References clang::RecordDecl::field_begin(), clang::RecordDecl::field_empty(), clang::Type::getAsUnionType(), and clang::Decl::hasAttr().