32 Ty = ED->getIntegerType();
36 if (EIT->getNumBits() >
56 RetTy = ED->getIntegerType();
59 if (EIT->getNumBits() >
86 llvm::Value *Array, llvm::Value *
Value,
87 unsigned FirstIndex,
unsigned LastIndex) {
89 for (
unsigned I = FirstIndex; I <= LastIndex; ++I) {
91 Builder.CreateConstInBoundsGEP1_32(Builder.getInt8Ty(), Array, I);
109 if (
const auto *CXXRD = dyn_cast<CXXRecordDecl>(RD))
110 return CXXABI.getRecordArgABI(CXXRD);
134 return CXXABI.classifyReturnType(FI);
140 if (UD->
hasAttr<TransparentUnionAttr>()) {
141 assert(!UD->
field_empty() &&
"sema created an empty transparent union");
152 llvm::Value *RoundUp = CGF.
Builder.CreateConstInBoundsGEP1_32(
154 return CGF.
Builder.CreateIntrinsic(
155 llvm::Intrinsic::ptrmask, {Ptr->getType(), CGF.
IntPtrTy},
157 nullptr, Ptr->getName() +
".aligned");
162 llvm::Type *DirectTy,
CharUnits DirectSize,
164 bool AllowHigherAlign,
bool ForceRightAdjust) {
174 if (AllowHigherAlign && DirectAlign > SlotSize) {
190 (!DirectTy->isStructTy() || ForceRightAdjust)) {
194 return Addr.withElementType(DirectTy);
202 bool ForceRightAdjust) {
209 DirectSize = ValueInfo.
Width;
210 DirectAlign = ValueInfo.
Align;
217 DirectTy = llvm::PointerType::get(CGF.
getLLVMContext(), AllocaAS);
221 DirectAlign, SlotSizeAndAlign,
222 AllowHigherAlign, ForceRightAdjust);
232 llvm::BasicBlock *Block1,
Address Addr2,
233 llvm::BasicBlock *Block2,
234 const llvm::Twine &Name) {
236 llvm::PHINode *PHI = CGF.
Builder.CreatePHI(Addr1.
getType(), 2, Name);
244 bool AllowArrays,
bool AsIfNoUniqueAddr) {
252 bool WasArray =
false;
255 if (AT->isZeroSize())
257 FT = AT->getElementType();
278 (WasArray || (!AsIfNoUniqueAddr && !FD->
hasAttr<NoUniqueAddressAttr>())))
281 return isEmptyRecord(Context, FT, AllowArrays, AsIfNoUniqueAddr);
285 bool AsIfNoUniqueAddr) {
289 if (RD->hasFlexibleArrayMember())
293 if (
const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD))
294 for (
const auto &I : CXXRD->bases())
295 if (!
isEmptyRecord(Context, I.getType(),
true, AsIfNoUniqueAddr))
298 for (
const auto *I : RD->fields())
299 if (!
isEmptyField(Context, I, AllowArrays, AsIfNoUniqueAddr))
321 if (
const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD)) {
322 if (CXXRD->isDynamicClass())
325 for (
const auto &I : CXXRD->bases())
330 for (
const auto *I : RD->fields())
342 if (RD->hasFlexibleArrayMember())
348 if (
const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD)) {
349 for (
const auto &I : CXXRD->bases()) {
367 for (
const auto *FD : RD->fields()) {
381 if (AT->getZExtSize() != 1)
383 FT = AT->getElementType();
418 "Unexpected PaddingType seen in arginfo in generic VAArg emitter!");
421 "Unexpected IndirectRealign seen in arginfo in generic VAArg emitter!");
427 llvm::Type *BaseTy = llvm::PointerType::getUnqual(CGF.
getLLVMContext());
433 "Unexpected ArgInfo Kind in generic VAArg emitter!");
436 "Unexpected InReg seen in arginfo in generic VAArg emitter!");
438 "Unexpected PaddingType seen in arginfo in generic VAArg emitter!");
440 "Unexpected DirectOffset seen in arginfo in generic VAArg emitter!");
442 "Unexpected CoerceToType seen in arginfo in generic VAArg emitter!");
462 if (
const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD))
463 for (
const auto &I : CXXRD->bases())
467 for (
const auto *i : RD->fields()) {
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const ConstantArrayType * getAsConstantArrayType(QualType T) const
QualType getBuiltinVaListType() const
Retrieve the type of the __builtin_va_list type.
TypeInfoChars getTypeInfoInChars(const Type *T) const
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
const TargetInfo & getTargetInfo() const
A fixed int type of a specified bitwidth.
Implements C++ ABI-specific semantic analysis functions.
Represents a C++ struct/union/class.
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 One()
One - Construct a CharUnits quantity of one.
CharUnits alignTo(const CharUnits &Align) const
alignTo - Returns the next integer (mod 2**64) that is greater than or equal to this quantity and is ...
ABIArgInfo - Helper class to encapsulate information about how a specific C type should be passed to ...
bool getIndirectRealign() const
static ABIArgInfo getIgnore()
unsigned getDirectOffset() const
llvm::Type * getPaddingType() const
static ABIArgInfo getDirect(llvm::Type *T=nullptr, unsigned Offset=0, llvm::Type *Padding=nullptr, bool CanBeFlattened=true, unsigned Align=0)
static ABIArgInfo getExtend(QualType Ty, llvm::Type *T=nullptr)
llvm::Type * getCoerceToType() const
ABIInfo - Target specific hooks for defining how a type should be passed or returned from functions.
const llvm::DataLayout & getDataLayout() const
CodeGen::ABIArgInfo getNaturalAlignIndirect(QualType Ty, unsigned AddrSpace, bool ByVal=true, bool Realign=false, llvm::Type *Padding=nullptr) const
A convenience method to return an indirect ABIArgInfo with an expected alignment equal to the ABI ali...
CodeGen::CodeGenTypes & CGT
CodeGen::CGCXXABI & getCXXABI() const
ASTContext & getContext() const
bool isPromotableIntegerTypeForABI(QualType Ty) const
Like RawAddress, an abstract representation of an aligned address, but the pointer contained in this ...
llvm::Value * emitRawPointer(CodeGenFunction &CGF) const
Return the pointer contained in this class after authenticating it and adding offset to it if necessa...
CharUnits getAlignment() const
llvm::Type * getElementType() const
Return the type of the values stored in this address.
Address withElementType(llvm::Type *ElemTy) const
Return address with different element type, but same pointer and alignment.
llvm::PointerType * getType() const
Return the type of the pointer value.
llvm::StoreInst * CreateStore(llvm::Value *Val, Address Addr, bool IsVolatile=false)
Address CreateConstInBoundsByteGEP(Address Addr, CharUnits Offset, const llvm::Twine &Name="")
Given a pointer to i8, adjust it by a given constant offset.
llvm::LoadInst * CreateLoad(Address Addr, const llvm::Twine &Name="")
Implements C++ ABI-specific code generation functions.
RecordArgABI
Specify how one should pass an argument of a record type.
@ RAA_Default
Pass it using the normal C aggregate rules for the ABI, potentially introducing extra copies and pass...
@ RAA_Indirect
Pass it as a pointer to temporary memory.
@ RAA_DirectInMemory
Pass it on the stack using its defined layout.
CGFunctionInfo - Class to encapsulate the information about a function definition.
ABIArgInfo & getReturnInfo()
CanQualType getReturnType() const
MutableArrayRef< ArgInfo > arguments()
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
static bool hasScalarEvaluationKind(QualType T)
RValue EmitLoadOfAnyValue(LValue V, AggValueSlot Slot=AggValueSlot::ignored(), SourceLocation Loc={})
Like EmitLoadOfLValue but also handles complex and aggregate types.
ASTContext & getContext() const
llvm::Type * ConvertTypeForMem(QualType T)
RawAddress CreateMemTemp(QualType T, const Twine &Name="tmp", RawAddress *Alloca=nullptr)
CreateMemTemp - Create a temporary memory object of the given type, with appropriate alignmen and cas...
LValue MakeAddrLValue(Address Addr, QualType T, AlignmentSource Source=AlignmentSource::Type)
llvm::LLVMContext & getLLVMContext()
const llvm::DataLayout & getDataLayout() const
llvm::Type * ConvertType(QualType T)
ConvertType - Convert type T into a llvm::Type.
ABIArgInfo classifyArgumentType(QualType RetTy) const
RValue EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty, AggValueSlot Slot) const override
EmitVAArg - Emit the target dependent code to load a value of.
ABIArgInfo classifyReturnType(QualType RetTy) const
virtual ~DefaultABIInfo()
void computeInfo(CGFunctionInfo &FI) const override
RValue - This trivial value class is used to represent the result of an expression that is evaluated.
Represents the canonical version of C arrays with a specified constant size.
Represents a member of a struct/union/class.
bool isUnnamedBitField() const
Determines whether this is an unnamed bitfield.
bool isZeroLengthBitField() const
Is this a zero-length bit-field? Such bit-fields aren't really bit-fields at all and instead act as a...
A (possibly-)qualified type.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Represents a struct/union/class.
bool canPassInRegisters() const
Determine whether this class can be passed in registers.
RecordDecl * getDefinitionOrSelf() const
field_iterator field_begin() const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getOriginalDecl() const
virtual bool hasInt128Type() const
Determine whether the __int128 type is supported on this target.
The base class of the type hierarchy.
const RecordType * getAsUnionType() const
NOTE: getAs*ArrayType are methods on ASTContext.
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
EnumDecl * getAsEnumDecl() const
Retrieves the EnumDecl this type refers to.
bool isMemberFunctionPointerType() 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>'.
Represents a GCC generic vector type.
bool isEmptyRecordForLayout(const ASTContext &Context, QualType T)
isEmptyRecordForLayout - Return true iff a structure contains only empty base classes (per isEmptyRec...
CGCXXABI::RecordArgABI getRecordArgABI(const RecordType *RT, CGCXXABI &CXXABI)
bool classifyReturnType(const CGCXXABI &CXXABI, CGFunctionInfo &FI, const ABIInfo &Info)
Address EmitVAArgInstr(CodeGenFunction &CGF, Address VAListAddr, QualType Ty, const ABIArgInfo &AI)
bool isEmptyFieldForLayout(const ASTContext &Context, const FieldDecl *FD)
isEmptyFieldForLayout - Return true iff the field is "empty", that is, either a zero-width bit-field ...
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 ...
bool isRecordWithSIMDVectorType(ASTContext &Context, QualType Ty)
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 ...
Address emitMergePHI(CodeGenFunction &CGF, Address Addr1, llvm::BasicBlock *Block1, Address Addr2, llvm::BasicBlock *Block2, const llvm::Twine &Name="")
bool isEmptyField(ASTContext &Context, const FieldDecl *FD, bool AllowArrays, bool AsIfNoUniqueAddr=false)
isEmptyField - Return true iff a the field is "empty", that is it is an unnamed bit-field or an (arra...
llvm::Value * emitRoundPointerUpToAlignment(CodeGenFunction &CGF, llvm::Value *Ptr, CharUnits Align)
bool isAggregateTypeForABI(QualType T)
const Type * isSingleElementStruct(QualType T, ASTContext &Context)
isSingleElementStruct - Determine if a structure is a "single element struct", i.e.
llvm::Type * getVAListElementType(CodeGenFunction &CGF)
void AssignToArrayRange(CodeGen::CGBuilderTy &Builder, llvm::Value *Array, llvm::Value *Value, unsigned FirstIndex, unsigned LastIndex)
QualType useFirstFieldIfTransparentUnion(QualType Ty)
Pass transparent unions as if they were the type of the first element.
bool isEmptyRecord(ASTContext &Context, QualType T, bool AllowArrays, bool AsIfNoUniqueAddr=false)
isEmptyRecord - Return true iff a structure contains only empty fields.
bool isSIMDVectorType(ASTContext &Context, QualType Ty)
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
llvm::IntegerType * Int8Ty
i8, i16, i32, and i64
CharUnits getPointerSize() const
llvm::IntegerType * IntPtrTy
llvm::PointerType * Int8PtrTy
CharUnits getPointerAlign() const