clang 20.0.0git
ABIInfoImpl.cpp
Go to the documentation of this file.
1//===- ABIInfoImpl.cpp ----------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "ABIInfoImpl.h"
10
11using namespace clang;
12using namespace clang::CodeGen;
13
14// Pin the vtable to this file.
16
19
20 if (isAggregateTypeForABI(Ty)) {
21 // Records with non-trivial destructors/copy-constructors should not be
22 // passed by value.
25
26 return getNaturalAlignIndirect(Ty);
27 }
28
29 // Treat an enum type as its underlying type.
30 if (const EnumType *EnumTy = Ty->getAs<EnumType>())
31 Ty = EnumTy->getDecl()->getIntegerType();
32
33 ASTContext &Context = getContext();
34 if (const auto *EIT = Ty->getAs<BitIntType>())
35 if (EIT->getNumBits() >
36 Context.getTypeSize(Context.getTargetInfo().hasInt128Type()
37 ? Context.Int128Ty
38 : Context.LongLongTy))
39 return getNaturalAlignIndirect(Ty);
40
43}
44
46 if (RetTy->isVoidType())
47 return ABIArgInfo::getIgnore();
48
49 if (isAggregateTypeForABI(RetTy))
50 return getNaturalAlignIndirect(RetTy);
51
52 // Treat an enum type as its underlying type.
53 if (const EnumType *EnumTy = RetTy->getAs<EnumType>())
54 RetTy = EnumTy->getDecl()->getIntegerType();
55
56 if (const auto *EIT = RetTy->getAs<BitIntType>())
57 if (EIT->getNumBits() >
58 getContext().getTypeSize(getContext().getTargetInfo().hasInt128Type()
59 ? getContext().Int128Ty
60 : getContext().LongLongTy))
61 return getNaturalAlignIndirect(RetTy);
62
65}
66
70 for (auto &I : FI.arguments())
71 I.info = classifyArgumentType(I.type);
72}
73
75 QualType Ty, AggValueSlot Slot) const {
76 return CGF.EmitLoadOfAnyValue(
78 EmitVAArgInstr(CGF, VAListAddr, Ty, classifyArgumentType(Ty)), Ty),
79 Slot);
80}
81
83 llvm::LLVMContext &LLVMContext) {
84 // Alignment and Size are measured in bits.
85 const uint64_t Size = Context.getTypeSize(Ty);
86 const uint64_t Alignment = Context.getTypeAlign(Ty);
87 llvm::Type *IntType = llvm::Type::getIntNTy(LLVMContext, Alignment);
88 const uint64_t NumElements = (Size + Alignment - 1) / Alignment;
89 return ABIArgInfo::getDirect(llvm::ArrayType::get(IntType, NumElements));
90}
91
93 llvm::Value *Array, llvm::Value *Value,
94 unsigned FirstIndex, unsigned LastIndex) {
95 // Alternatively, we could emit this as a loop in the source.
96 for (unsigned I = FirstIndex; I <= LastIndex; ++I) {
97 llvm::Value *Cell =
98 Builder.CreateConstInBoundsGEP1_32(Builder.getInt8Ty(), Array, I);
99 Builder.CreateAlignedStore(Value, Cell, CharUnits::One());
100 }
101}
102
106}
107
109 return CGF.ConvertTypeForMem(
111}
112
114 CGCXXABI &CXXABI) {
115 const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(RT->getDecl());
116 if (!RD) {
117 if (!RT->getDecl()->canPassInRegisters())
120 }
121 return CXXABI.getRecordArgABI(RD);
122}
123
125 const RecordType *RT = T->getAs<RecordType>();
126 if (!RT)
128 return getRecordArgABI(RT, CXXABI);
129}
130
132 const ABIInfo &Info) {
133 QualType Ty = FI.getReturnType();
134
135 if (const auto *RT = Ty->getAs<RecordType>())
136 if (!isa<CXXRecordDecl>(RT->getDecl()) &&
137 !RT->getDecl()->canPassInRegisters()) {
139 return true;
140 }
141
142 return CXXABI.classifyReturnType(FI);
143}
144
146 if (const RecordType *UT = Ty->getAsUnionType()) {
147 const RecordDecl *UD = UT->getDecl();
148 if (UD->hasAttr<TransparentUnionAttr>()) {
149 assert(!UD->field_empty() && "sema created an empty transparent union");
150 return UD->field_begin()->getType();
151 }
152 }
153 return Ty;
154}
155
157 llvm::Value *Ptr,
158 CharUnits Align) {
159 // OverflowArgArea = (OverflowArgArea + Align - 1) & -Align;
160 llvm::Value *RoundUp = CGF.Builder.CreateConstInBoundsGEP1_32(
161 CGF.Builder.getInt8Ty(), Ptr, Align.getQuantity() - 1);
162 return CGF.Builder.CreateIntrinsic(
163 llvm::Intrinsic::ptrmask, {Ptr->getType(), CGF.IntPtrTy},
164 {RoundUp, llvm::ConstantInt::get(CGF.IntPtrTy, -Align.getQuantity())},
165 nullptr, Ptr->getName() + ".aligned");
166}
167
170 llvm::Type *DirectTy, CharUnits DirectSize,
171 CharUnits DirectAlign, CharUnits SlotSize,
172 bool AllowHigherAlign, bool ForceRightAdjust) {
173 // Cast the element type to i8* if necessary. Some platforms define
174 // va_list as a struct containing an i8* instead of just an i8*.
175 if (VAListAddr.getElementType() != CGF.Int8PtrTy)
176 VAListAddr = VAListAddr.withElementType(CGF.Int8PtrTy);
177
178 llvm::Value *Ptr = CGF.Builder.CreateLoad(VAListAddr, "argp.cur");
179
180 // If the CC aligns values higher than the slot size, do so if needed.
181 Address Addr = Address::invalid();
182 if (AllowHigherAlign && DirectAlign > SlotSize) {
183 Addr = Address(emitRoundPointerUpToAlignment(CGF, Ptr, DirectAlign),
184 CGF.Int8Ty, DirectAlign);
185 } else {
186 Addr = Address(Ptr, CGF.Int8Ty, SlotSize);
187 }
188
189 // Advance the pointer past the argument, then store that back.
190 CharUnits FullDirectSize = DirectSize.alignTo(SlotSize);
191 Address NextPtr =
192 CGF.Builder.CreateConstInBoundsByteGEP(Addr, FullDirectSize, "argp.next");
193 CGF.Builder.CreateStore(NextPtr.emitRawPointer(CGF), VAListAddr);
194
195 // If the argument is smaller than a slot, and this is a big-endian
196 // target, the argument will be right-adjusted in its slot.
197 if (DirectSize < SlotSize && CGF.CGM.getDataLayout().isBigEndian() &&
198 (!DirectTy->isStructTy() || ForceRightAdjust)) {
199 Addr = CGF.Builder.CreateConstInBoundsByteGEP(Addr, SlotSize - DirectSize);
200 }
201
202 return Addr.withElementType(DirectTy);
203}
204
206 QualType ValueTy, bool IsIndirect,
207 TypeInfoChars ValueInfo,
208 CharUnits SlotSizeAndAlign,
209 bool AllowHigherAlign, AggValueSlot Slot,
210 bool ForceRightAdjust) {
211 // The size and alignment of the value that was passed directly.
212 CharUnits DirectSize, DirectAlign;
213 if (IsIndirect) {
214 DirectSize = CGF.getPointerSize();
215 DirectAlign = CGF.getPointerAlign();
216 } else {
217 DirectSize = ValueInfo.Width;
218 DirectAlign = ValueInfo.Align;
219 }
220
221 // Cast the address we've calculated to the right type.
222 llvm::Type *DirectTy = CGF.ConvertTypeForMem(ValueTy), *ElementTy = DirectTy;
223 if (IsIndirect) {
224 unsigned AllocaAS = CGF.CGM.getDataLayout().getAllocaAddrSpace();
225 DirectTy = llvm::PointerType::get(CGF.getLLVMContext(), AllocaAS);
226 }
227
228 Address Addr = emitVoidPtrDirectVAArg(CGF, VAListAddr, DirectTy, DirectSize,
229 DirectAlign, SlotSizeAndAlign,
230 AllowHigherAlign, ForceRightAdjust);
231
232 if (IsIndirect) {
233 Addr = Address(CGF.Builder.CreateLoad(Addr), ElementTy, ValueInfo.Align);
234 }
235
236 return CGF.EmitLoadOfAnyValue(CGF.MakeAddrLValue(Addr, ValueTy), Slot);
237}
238
240 llvm::BasicBlock *Block1, Address Addr2,
241 llvm::BasicBlock *Block2,
242 const llvm::Twine &Name) {
243 assert(Addr1.getType() == Addr2.getType());
244 llvm::PHINode *PHI = CGF.Builder.CreatePHI(Addr1.getType(), 2, Name);
245 PHI->addIncoming(Addr1.emitRawPointer(CGF), Block1);
246 PHI->addIncoming(Addr2.emitRawPointer(CGF), Block2);
247 CharUnits Align = std::min(Addr1.getAlignment(), Addr2.getAlignment());
248 return Address(PHI, Addr1.getElementType(), Align);
249}
250
252 bool AllowArrays, bool AsIfNoUniqueAddr) {
253 if (FD->isUnnamedBitField())
254 return true;
255
256 QualType FT = FD->getType();
257
258 // Constant arrays of empty records count as empty, strip them off.
259 // Constant arrays of zero length always count as empty.
260 bool WasArray = false;
261 if (AllowArrays)
262 while (const ConstantArrayType *AT = Context.getAsConstantArrayType(FT)) {
263 if (AT->isZeroSize())
264 return true;
265 FT = AT->getElementType();
266 // The [[no_unique_address]] special case below does not apply to
267 // arrays of C++ empty records, so we need to remember this fact.
268 WasArray = true;
269 }
270
271 const RecordType *RT = FT->getAs<RecordType>();
272 if (!RT)
273 return false;
274
275 // C++ record fields are never empty, at least in the Itanium ABI.
276 //
277 // FIXME: We should use a predicate for whether this behavior is true in the
278 // current ABI.
279 //
280 // The exception to the above rule are fields marked with the
281 // [[no_unique_address]] attribute (since C++20). Those do count as empty
282 // according to the Itanium ABI. The exception applies only to records,
283 // not arrays of records, so we must also check whether we stripped off an
284 // array type above.
285 if (isa<CXXRecordDecl>(RT->getDecl()) &&
286 (WasArray || (!AsIfNoUniqueAddr && !FD->hasAttr<NoUniqueAddressAttr>())))
287 return false;
288
289 return isEmptyRecord(Context, FT, AllowArrays, AsIfNoUniqueAddr);
290}
291
292bool CodeGen::isEmptyRecord(ASTContext &Context, QualType T, bool AllowArrays,
293 bool AsIfNoUniqueAddr) {
294 const RecordType *RT = T->getAs<RecordType>();
295 if (!RT)
296 return false;
297 const RecordDecl *RD = RT->getDecl();
298 if (RD->hasFlexibleArrayMember())
299 return false;
300
301 // If this is a C++ record, check the bases first.
302 if (const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD))
303 for (const auto &I : CXXRD->bases())
304 if (!isEmptyRecord(Context, I.getType(), true, AsIfNoUniqueAddr))
305 return false;
306
307 for (const auto *I : RD->fields())
308 if (!isEmptyField(Context, I, AllowArrays, AsIfNoUniqueAddr))
309 return false;
310 return true;
311}
312
314 const FieldDecl *FD) {
315 if (FD->isZeroLengthBitField(Context))
316 return true;
317
318 if (FD->isUnnamedBitField())
319 return false;
320
321 return isEmptyRecordForLayout(Context, FD->getType());
322}
323
325 const RecordType *RT = T->getAs<RecordType>();
326 if (!RT)
327 return false;
328
329 const RecordDecl *RD = RT->getDecl();
330
331 // If this is a C++ record, check the bases first.
332 if (const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD)) {
333 if (CXXRD->isDynamicClass())
334 return false;
335
336 for (const auto &I : CXXRD->bases())
337 if (!isEmptyRecordForLayout(Context, I.getType()))
338 return false;
339 }
340
341 for (const auto *I : RD->fields())
342 if (!isEmptyFieldForLayout(Context, I))
343 return false;
344
345 return true;
346}
347
349 const RecordType *RT = T->getAs<RecordType>();
350 if (!RT)
351 return nullptr;
352
353 const RecordDecl *RD = RT->getDecl();
354 if (RD->hasFlexibleArrayMember())
355 return nullptr;
356
357 const Type *Found = nullptr;
358
359 // If this is a C++ record, check the bases first.
360 if (const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD)) {
361 for (const auto &I : CXXRD->bases()) {
362 // Ignore empty records.
363 if (isEmptyRecord(Context, I.getType(), true))
364 continue;
365
366 // If we already found an element then this isn't a single-element struct.
367 if (Found)
368 return nullptr;
369
370 // If this is non-empty and not a single element struct, the composite
371 // cannot be a single element struct.
372 Found = isSingleElementStruct(I.getType(), Context);
373 if (!Found)
374 return nullptr;
375 }
376 }
377
378 // Check for single element.
379 for (const auto *FD : RD->fields()) {
380 QualType FT = FD->getType();
381
382 // Ignore empty fields.
383 if (isEmptyField(Context, FD, true))
384 continue;
385
386 // If we already found an element then this isn't a single-element
387 // struct.
388 if (Found)
389 return nullptr;
390
391 // Treat single element arrays as the element.
392 while (const ConstantArrayType *AT = Context.getAsConstantArrayType(FT)) {
393 if (AT->getZExtSize() != 1)
394 break;
395 FT = AT->getElementType();
396 }
397
398 if (!isAggregateTypeForABI(FT)) {
399 Found = FT.getTypePtr();
400 } else {
401 Found = isSingleElementStruct(FT, Context);
402 if (!Found)
403 return nullptr;
404 }
405 }
406
407 // We don't consider a struct a single-element struct if it has
408 // padding beyond the element type.
409 if (Found && Context.getTypeSize(Found) != Context.getTypeSize(T))
410 return nullptr;
411
412 return Found;
413}
414
416 QualType Ty, const ABIArgInfo &AI) {
417 // This default implementation defers to the llvm backend's va_arg
418 // instruction. It can handle only passing arguments directly
419 // (typically only handled in the backend for primitive types), or
420 // aggregates passed indirectly by pointer (NOTE: if the "byval"
421 // flag has ABI impact in the callee, this implementation cannot
422 // work.)
423
424 // Only a few cases are covered here at the moment -- those needed
425 // by the default abi.
426 llvm::Value *Val;
427
428 if (AI.isIndirect()) {
429 assert(!AI.getPaddingType() &&
430 "Unexpected PaddingType seen in arginfo in generic VAArg emitter!");
431 assert(
432 !AI.getIndirectRealign() &&
433 "Unexpected IndirectRealign seen in arginfo in generic VAArg emitter!");
434
435 auto TyInfo = CGF.getContext().getTypeInfoInChars(Ty);
436 CharUnits TyAlignForABI = TyInfo.Align;
437
438 llvm::Type *ElementTy = CGF.ConvertTypeForMem(Ty);
439 llvm::Type *BaseTy = llvm::PointerType::getUnqual(ElementTy);
440 llvm::Value *Addr =
441 CGF.Builder.CreateVAArg(VAListAddr.emitRawPointer(CGF), BaseTy);
442 return Address(Addr, ElementTy, TyAlignForABI);
443 } else {
444 assert((AI.isDirect() || AI.isExtend()) &&
445 "Unexpected ArgInfo Kind in generic VAArg emitter!");
446
447 assert(!AI.getInReg() &&
448 "Unexpected InReg seen in arginfo in generic VAArg emitter!");
449 assert(!AI.getPaddingType() &&
450 "Unexpected PaddingType seen in arginfo in generic VAArg emitter!");
451 assert(!AI.getDirectOffset() &&
452 "Unexpected DirectOffset seen in arginfo in generic VAArg emitter!");
453 assert(!AI.getCoerceToType() &&
454 "Unexpected CoerceToType seen in arginfo in generic VAArg emitter!");
455
456 Address Temp = CGF.CreateMemTemp(Ty, "varet");
457 Val = CGF.Builder.CreateVAArg(VAListAddr.emitRawPointer(CGF),
458 CGF.ConvertTypeForMem(Ty));
459 CGF.Builder.CreateStore(Val, Temp);
460 return Temp;
461 }
462}
463
465 return Ty->getAs<VectorType>() && Context.getTypeSize(Ty) == 128;
466}
467
469 const RecordType *RT = Ty->getAs<RecordType>();
470 if (!RT)
471 return false;
472 const RecordDecl *RD = RT->getDecl();
473
474 // If this is a C++ record, check the bases first.
475 if (const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD))
476 for (const auto &I : CXXRD->bases())
477 if (!isRecordWithSIMDVectorType(Context, I.getType()))
478 return false;
479
480 for (const auto *i : RD->fields()) {
481 QualType FT = i->getType();
482
483 if (isSIMDVectorType(Context, FT))
484 return true;
485
486 if (isRecordWithSIMDVectorType(Context, FT))
487 return true;
488 }
489
490 return false;
491}
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:186
const ConstantArrayType * getAsConstantArrayType(QualType T) const
Definition: ASTContext.h:2822
CanQualType Int128Ty
Definition: ASTContext.h:1127
QualType getBuiltinVaListType() const
Retrieve the type of the __builtin_va_list type.
Definition: ASTContext.h:2169
TypeInfoChars getTypeInfoInChars(const Type *T) const
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
Definition: ASTContext.h:2391
const TargetInfo & getTargetInfo() const
Definition: ASTContext.h:778
CanQualType LongLongTy
Definition: ASTContext.h:1127
unsigned getTypeAlign(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in bits.
Definition: ASTContext.h:2422
A fixed int type of a specified bitwidth.
Definition: Type.h:7626
Implements C++ ABI-specific semantic analysis functions.
Definition: CXXABI.h:29
Represents a C++ struct/union/class.
Definition: DeclCXX.h:258
CharUnits - This is an opaque type for sizes expressed in character units.
Definition: CharUnits.h:38
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
Definition: CharUnits.h:185
static CharUnits One()
One - Construct a CharUnits quantity of one.
Definition: CharUnits.h:58
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 ...
Definition: CharUnits.h:201
ABIArgInfo - Helper class to encapsulate information about how a specific C type should be passed to ...
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.
Definition: ABIInfo.h:47
CodeGen::CGCXXABI & getCXXABI() const
Definition: ABIInfo.cpp:18
ASTContext & getContext() const
Definition: ABIInfo.cpp:20
bool isPromotableIntegerTypeForABI(QualType Ty) const
Definition: ABIInfo.cpp:163
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...
Definition: ABIInfo.cpp:174
Like RawAddress, an abstract representation of an aligned address, but the pointer contained in this ...
Definition: Address.h:128
static Address invalid()
Definition: Address.h:176
llvm::Value * emitRawPointer(CodeGenFunction &CGF) const
Return the pointer contained in this class after authenticating it and adding offset to it if necessa...
Definition: Address.h:251
CharUnits getAlignment() const
Definition: Address.h:189
llvm::Type * getElementType() const
Return the type of the values stored in this address.
Definition: Address.h:207
Address withElementType(llvm::Type *ElemTy) const
Return address with different element type, but same pointer and alignment.
Definition: Address.h:274
llvm::PointerType * getType() const
Return the type of the pointer value.
Definition: Address.h:199
An aggregate value slot.
Definition: CGValue.h:504
llvm::StoreInst * CreateStore(llvm::Value *Val, Address Addr, bool IsVolatile=false)
Definition: CGBuilder.h:135
Address CreateConstInBoundsByteGEP(Address Addr, CharUnits Offset, const llvm::Twine &Name="")
Given a pointer to i8, adjust it by a given constant offset.
Definition: CGBuilder.h:304
llvm::LoadInst * CreateLoad(Address Addr, const llvm::Twine &Name="")
Definition: CGBuilder.h:107
Implements C++ ABI-specific code generation functions.
Definition: CGCXXABI.h:43
RecordArgABI
Specify how one should pass an argument of a record type.
Definition: CGCXXABI.h:150
@ RAA_Default
Pass it using the normal C aggregate rules for the ABI, potentially introducing extra copies and pass...
Definition: CGCXXABI.h:153
@ RAA_Indirect
Pass it as a pointer to temporary memory.
Definition: CGCXXABI.h:161
@ RAA_DirectInMemory
Pass it on the stack using its defined layout.
Definition: CGCXXABI.h:158
CGFunctionInfo - Class to encapsulate the information about a function definition.
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...
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
ABIArgInfo classifyArgumentType(QualType RetTy) const
Definition: ABIInfoImpl.cpp:17
RValue EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty, AggValueSlot Slot) const override
EmitVAArg - Emit the target dependent code to load a value of.
Definition: ABIInfoImpl.cpp:74
ABIArgInfo classifyReturnType(QualType RetTy) const
Definition: ABIInfoImpl.cpp:45
void computeInfo(CGFunctionInfo &FI) const override
Definition: ABIInfoImpl.cpp:67
RValue - This trivial value class is used to represent the result of an expression that is evaluated.
Definition: CGValue.h:42
Represents the canonical version of C arrays with a specified constant size.
Definition: Type.h:3578
bool hasAttr() const
Definition: DeclBase.h:583
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
Definition: Type.h:5962
Represents a member of a struct/union/class.
Definition: Decl.h:3030
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...
Definition: Decl.cpp:4585
bool isUnnamedBitField() const
Determines whether this is an unnamed bitfield.
Definition: Decl.h:3124
A (possibly-)qualified type.
Definition: Type.h:941
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Definition: Type.h:7743
Represents a struct/union/class.
Definition: Decl.h:4141
bool canPassInRegisters() const
Determine whether this class can be passed in registers.
Definition: Decl.h:4270
bool hasFlexibleArrayMember() const
Definition: Decl.h:4174
field_range fields() const
Definition: Decl.h:4347
bool field_empty() const
Definition: Decl.h:4355
field_iterator field_begin() const
Definition: Decl.cpp:5057
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition: Type.h:5936
RecordDecl * getDecl() const
Definition: Type.h:5946
virtual bool hasInt128Type() const
Determine whether the __int128 type is supported on this target.
Definition: TargetInfo.h:655
The base class of the type hierarchy.
Definition: Type.h:1829
bool isVoidType() const
Definition: Type.h:8295
const RecordType * getAsUnionType() const
NOTE: getAs*ArrayType are methods on ASTContext.
Definition: Type.cpp:740
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
Definition: Type.cpp:705
bool isMemberFunctionPointerType() const
Definition: Type.h:8050
const T * getAs() const
Member-template getAs<specific type>'.
Definition: Type.h:8516
QualType getType() const
Definition: Decl.h:678
Represents a GCC generic vector type.
Definition: Type.h:3991
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)
Definition: ABIInfoImpl.cpp:82
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)
Definition: ABIInfoImpl.cpp:92
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