31 Ty = EnumTy->getDecl()->getIntegerType();
35 if (EIT->getNumBits() >
55 RetTy = EnumTy->getDecl()->getIntegerType();
58 if (EIT->getNumBits() >
84 llvm::LLVMContext &LLVMContext) {
88 llvm::Type *IntType = llvm::Type::getIntNTy(LLVMContext, Alignment);
89 const uint64_t NumElements = (Size + Alignment - 1) / Alignment;
94 llvm::Value *Array, llvm::Value *
Value,
95 unsigned FirstIndex,
unsigned LastIndex) {
97 for (
unsigned I = FirstIndex; I <= LastIndex; ++I) {
99 Builder.CreateConstInBoundsGEP1_32(Builder.getInt8Ty(), Array, I);
122 return CXXABI.getRecordArgABI(RD);
137 if (!isa<CXXRecordDecl>(RT->getDecl()) &&
138 !RT->getDecl()->canPassInRegisters()) {
143 return CXXABI.classifyReturnType(FI);
149 if (UD->
hasAttr<TransparentUnionAttr>()) {
150 assert(!UD->
field_empty() &&
"sema created an empty transparent union");
161 llvm::Value *RoundUp = CGF.
Builder.CreateConstInBoundsGEP1_32(
163 return CGF.
Builder.CreateIntrinsic(
164 llvm::Intrinsic::ptrmask, {Ptr->getType(), CGF.
IntPtrTy},
166 nullptr, Ptr->getName() +
".aligned");
171 llvm::Type *DirectTy,
CharUnits DirectSize,
173 bool AllowHigherAlign,
bool ForceRightAdjust) {
183 if (AllowHigherAlign && DirectAlign > SlotSize) {
199 (!DirectTy->isStructTy() || ForceRightAdjust)) {
211 bool ForceRightAdjust) {
218 DirectSize = ValueInfo.
Width;
219 DirectAlign = ValueInfo.
Align;
226 DirectTy = llvm::PointerType::get(CGF.
getLLVMContext(), AllocaAS);
230 DirectAlign, SlotSizeAndAlign,
231 AllowHigherAlign, ForceRightAdjust);
241 llvm::BasicBlock *Block1,
Address Addr2,
242 llvm::BasicBlock *Block2,
243 const llvm::Twine &Name) {
245 llvm::PHINode *PHI = CGF.
Builder.CreatePHI(Addr1.
getType(), 2, Name);
253 bool AllowArrays,
bool AsIfNoUniqueAddr) {
261 bool WasArray =
false;
264 if (AT->isZeroSize())
266 FT = AT->getElementType();
286 if (isa<CXXRecordDecl>(RT->
getDecl()) &&
287 (WasArray || (!AsIfNoUniqueAddr && !FD->
hasAttr<NoUniqueAddressAttr>())))
290 return isEmptyRecord(Context, FT, AllowArrays, AsIfNoUniqueAddr);
294 bool AsIfNoUniqueAddr) {
303 if (
const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD))
304 for (
const auto &I : CXXRD->bases())
305 if (!
isEmptyRecord(Context, I.getType(),
true, AsIfNoUniqueAddr))
308 for (
const auto *I : RD->
fields())
309 if (!
isEmptyField(Context, I, AllowArrays, AsIfNoUniqueAddr))
333 if (
const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD)) {
334 if (CXXRD->isDynamicClass())
337 for (
const auto &I : CXXRD->bases())
342 for (
const auto *I : RD->
fields())
361 if (
const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD)) {
362 for (
const auto &I : CXXRD->bases()) {
380 for (
const auto *FD : RD->
fields()) {
394 if (AT->getZExtSize() != 1)
396 FT = AT->getElementType();
431 "Unexpected PaddingType seen in arginfo in generic VAArg emitter!");
434 "Unexpected IndirectRealign seen in arginfo in generic VAArg emitter!");
440 llvm::Type *BaseTy = llvm::PointerType::getUnqual(ElementTy);
443 return Address(Addr, ElementTy, TyAlignForABI);
446 "Unexpected ArgInfo Kind in generic VAArg emitter!");
449 "Unexpected InReg seen in arginfo in generic VAArg emitter!");
451 "Unexpected PaddingType seen in arginfo in generic VAArg emitter!");
453 "Unexpected DirectOffset seen in arginfo in generic VAArg emitter!");
455 "Unexpected CoerceToType seen in arginfo in generic VAArg emitter!");
476 if (
const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD))
477 for (
const auto &I : CXXRD->bases())
481 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::CodeGenTypes & CGT
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
LValue MakeAddrLValue(Address Addr, QualType T, AlignmentSource Source=AlignmentSource::Type)
llvm::LLVMContext & getLLVMContext()
RValue EmitLoadOfAnyValue(LValue V, AggValueSlot Slot=AggValueSlot::ignored(), SourceLocation Loc={})
Like EmitLoadOfLValue but also handles complex and aggregate types.
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.
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 isZeroLengthBitField(const ASTContext &Ctx) const
Is this a zero-length bit-field? Such bit-fields aren't really bit-fields at all and instead act as a...
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.
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...
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