31 Ty = EnumTy->getDecl()->getIntegerType();
35 if (EIT->getNumBits() >
55 RetTy = EnumTy->getDecl()->getIntegerType();
58 if (EIT->getNumBits() >
84 llvm::Value *Array, llvm::Value *
Value,
85 unsigned FirstIndex,
unsigned LastIndex) {
87 for (
unsigned I = FirstIndex; I <= LastIndex; ++I) {
89 Builder.CreateConstInBoundsGEP1_32(Builder.getInt8Ty(), Array, I);
112 return CXXABI.getRecordArgABI(RD);
127 if (!isa<CXXRecordDecl>(RT->getDecl()) &&
128 !RT->getDecl()->canPassInRegisters()) {
133 return CXXABI.classifyReturnType(FI);
139 if (UD->
hasAttr<TransparentUnionAttr>()) {
140 assert(!UD->
field_empty() &&
"sema created an empty transparent union");
151 llvm::Value *RoundUp = CGF.
Builder.CreateConstInBoundsGEP1_32(
153 return CGF.
Builder.CreateIntrinsic(
154 llvm::Intrinsic::ptrmask, {Ptr->getType(), CGF.
IntPtrTy},
156 nullptr, Ptr->getName() +
".aligned");
161 llvm::Type *DirectTy,
CharUnits DirectSize,
163 bool AllowHigherAlign,
bool ForceRightAdjust) {
173 if (AllowHigherAlign && DirectAlign > SlotSize) {
189 (!DirectTy->isStructTy() || ForceRightAdjust)) {
201 bool ForceRightAdjust) {
208 DirectSize = ValueInfo.
Width;
209 DirectAlign = ValueInfo.
Align;
216 DirectTy = llvm::PointerType::get(CGF.
getLLVMContext(), AllocaAS);
220 DirectAlign, SlotSizeAndAlign,
221 AllowHigherAlign, ForceRightAdjust);
231 llvm::BasicBlock *Block1,
Address Addr2,
232 llvm::BasicBlock *Block2,
233 const llvm::Twine &Name) {
235 llvm::PHINode *PHI = CGF.
Builder.CreatePHI(Addr1.
getType(), 2, Name);
243 bool AllowArrays,
bool AsIfNoUniqueAddr) {
251 bool WasArray =
false;
254 if (AT->isZeroSize())
256 FT = AT->getElementType();
276 if (isa<CXXRecordDecl>(RT->
getDecl()) &&
277 (WasArray || (!AsIfNoUniqueAddr && !FD->
hasAttr<NoUniqueAddressAttr>())))
280 return isEmptyRecord(Context, FT, AllowArrays, AsIfNoUniqueAddr);
284 bool AsIfNoUniqueAddr) {
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))
323 if (
const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD)) {
324 if (CXXRD->isDynamicClass())
327 for (
const auto &I : CXXRD->bases())
332 for (
const auto *I : RD->
fields())
351 if (
const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD)) {
352 for (
const auto &I : CXXRD->bases()) {
370 for (
const auto *FD : RD->
fields()) {
384 if (AT->getZExtSize() != 1)
386 FT = AT->getElementType();
421 "Unexpected PaddingType seen in arginfo in generic VAArg emitter!");
424 "Unexpected IndirectRealign seen in arginfo in generic VAArg emitter!");
430 llvm::Type *BaseTy = llvm::PointerType::getUnqual(ElementTy);
433 return Address(Addr, ElementTy, TyAlignForABI);
436 "Unexpected ArgInfo Kind in generic VAArg emitter!");
439 "Unexpected InReg seen in arginfo in generic VAArg emitter!");
441 "Unexpected PaddingType seen in arginfo in generic VAArg emitter!");
443 "Unexpected DirectOffset seen in arginfo in generic VAArg emitter!");
445 "Unexpected CoerceToType seen in arginfo in generic VAArg emitter!");
466 if (
const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD))
467 for (
const auto &I : CXXRD->bases())
471 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.
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...
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