31 Ty = EnumTy->getDecl()->getIntegerType();
35 if (EIT->getNumBits() >
54 RetTy = EnumTy->getDecl()->getIntegerType();
57 if (EIT->getNumBits() >
80 llvm::LLVMContext &LLVMContext) {
84 llvm::Type *IntType = llvm::Type::getIntNTy(LLVMContext, Alignment);
85 const uint64_t NumElements = (Size + Alignment - 1) / Alignment;
90 llvm::Value *Array, llvm::Value *
Value,
91 unsigned FirstIndex,
unsigned LastIndex) {
93 for (
unsigned I = FirstIndex; I <= LastIndex; ++I) {
95 Builder.CreateConstInBoundsGEP1_32(Builder.getInt8Ty(), Array, I);
118 return CXXABI.getRecordArgABI(RD);
133 if (!isa<CXXRecordDecl>(RT->getDecl()) &&
134 !RT->getDecl()->canPassInRegisters()) {
139 return CXXABI.classifyReturnType(FI);
145 if (UD->
hasAttr<TransparentUnionAttr>()) {
146 assert(!UD->
field_empty() &&
"sema created an empty transparent union");
157 llvm::Value *RoundUp = CGF.
Builder.CreateConstInBoundsGEP1_32(
159 return CGF.
Builder.CreateIntrinsic(
160 llvm::Intrinsic::ptrmask, {Ptr->getType(), CGF.
IntPtrTy},
162 nullptr, Ptr->getName() +
".aligned");
167 llvm::Type *DirectTy,
CharUnits DirectSize,
169 bool AllowHigherAlign,
bool ForceRightAdjust) {
179 if (AllowHigherAlign && DirectAlign > SlotSize) {
195 (!DirectTy->isStructTy() || ForceRightAdjust)) {
206 bool AllowHigherAlign,
207 bool ForceRightAdjust) {
214 DirectSize = ValueInfo.
Width;
215 DirectAlign = ValueInfo.
Align;
222 DirectTy = llvm::PointerType::get(CGF.
getLLVMContext(), AllocaAS);
226 DirectAlign, SlotSizeAndAlign,
227 AllowHigherAlign, ForceRightAdjust);
237 llvm::BasicBlock *Block1,
Address Addr2,
238 llvm::BasicBlock *Block2,
239 const llvm::Twine &Name) {
241 llvm::PHINode *PHI = CGF.
Builder.CreatePHI(Addr1.
getType(), 2, Name);
249 bool AllowArrays,
bool AsIfNoUniqueAddr) {
257 bool WasArray =
false;
260 if (AT->isZeroSize())
262 FT = AT->getElementType();
282 if (isa<CXXRecordDecl>(RT->
getDecl()) &&
283 (WasArray || (!AsIfNoUniqueAddr && !FD->
hasAttr<NoUniqueAddressAttr>())))
286 return isEmptyRecord(Context, FT, AllowArrays, AsIfNoUniqueAddr);
290 bool AsIfNoUniqueAddr) {
299 if (
const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD))
300 for (
const auto &I : CXXRD->bases())
301 if (!
isEmptyRecord(Context, I.getType(),
true, AsIfNoUniqueAddr))
304 for (
const auto *I : RD->
fields())
305 if (!
isEmptyField(Context, I, AllowArrays, AsIfNoUniqueAddr))
319 const Type *Found =
nullptr;
322 if (
const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD)) {
323 for (
const auto &I : CXXRD->bases()) {
341 for (
const auto *FD : RD->
fields()) {
355 if (AT->getZExtSize() != 1)
357 FT = AT->getElementType();
392 "Unexpected PaddingType seen in arginfo in generic VAArg emitter!");
395 "Unexpected IndirectRealign seen in arginfo in generic VAArg emitter!");
401 llvm::Type *BaseTy = llvm::PointerType::getUnqual(ElementTy);
404 return Address(Addr, ElementTy, TyAlignForABI);
407 "Unexpected ArgInfo Kind in generic VAArg emitter!");
410 "Unexpected InReg seen in arginfo in generic VAArg emitter!");
412 "Unexpected PaddingType seen in arginfo in generic VAArg emitter!");
414 "Unexpected DirectOffset seen in arginfo in generic VAArg emitter!");
416 "Unexpected CoerceToType seen in arginfo in generic VAArg emitter!");
437 if (
const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD))
438 for (
const auto &I : CXXRD->bases())
442 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
unsigned getTypeAlign(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in bits.
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.
CodeGen::CGCXXABI & getCXXABI() const
ASTContext & getContext() const
bool isPromotableIntegerTypeForABI(QualType Ty) const
CodeGen::ABIArgInfo getNaturalAlignIndirect(QualType Ty, 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...
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)
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...
ASTContext & getContext() const
llvm::LLVMContext & getLLVMContext()
const llvm::DataLayout & getDataLayout() const
ABIArgInfo classifyArgumentType(QualType RetTy) const
ABIArgInfo classifyReturnType(QualType RetTy) const
virtual ~DefaultABIInfo()
void computeInfo(CGFunctionInfo &FI) const override
Address EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty) const override
EmitVAArg - Emit the target dependent code to load a value of.
Represents the canonical version of C arrays with a specified constant size.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
Represents a member of a struct/union/class.
bool isUnnamedBitField() const
Determines whether this is an unnamed bitfield.
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.
bool hasFlexibleArrayMember() const
field_range fields() 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 * getDecl() 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.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isMemberFunctionPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
Represents a GCC generic vector type.
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)
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 ...
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 ...
bool isRecordWithSIMDVectorType(ASTContext &Context, QualType Ty)
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...
ABIArgInfo coerceToIntArray(QualType Ty, ASTContext &Context, llvm::LLVMContext &LLVMContext)
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