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
44}
45
47 if (RetTy->isVoidType())
48 return ABIArgInfo::getIgnore();
49
50 if (isAggregateTypeForABI(RetTy))
51 return getNaturalAlignIndirect(RetTy);
52
53 // Treat an enum type as its underlying type.
54 if (const EnumType *EnumTy = RetTy->getAs<EnumType>())
55 RetTy = EnumTy->getDecl()->getIntegerType();
56
57 if (const auto *EIT = RetTy->getAs<BitIntType>())
58 if (EIT->getNumBits() >
59 getContext().getTypeSize(getContext().getTargetInfo().hasInt128Type()
60 ? getContext().Int128Ty
61 : getContext().LongLongTy))
62 return getNaturalAlignIndirect(RetTy);
63
66}
67
71 for (auto &I : FI.arguments())
72 I.info = classifyArgumentType(I.type);
73}
74
76 QualType Ty, AggValueSlot Slot) const {
77 return CGF.EmitLoadOfAnyValue(
79 EmitVAArgInstr(CGF, VAListAddr, Ty, classifyArgumentType(Ty)), Ty),
80 Slot);
81}
82
84 llvm::LLVMContext &LLVMContext) {
85 // Alignment and Size are measured in bits.
86 const uint64_t Size = Context.getTypeSize(Ty);
87 const uint64_t Alignment = Context.getTypeAlign(Ty);
88 llvm::Type *IntType = llvm::Type::getIntNTy(LLVMContext, Alignment);
89 const uint64_t NumElements = (Size + Alignment - 1) / Alignment;
90 return ABIArgInfo::getDirect(llvm::ArrayType::get(IntType, NumElements));
91}
92
94 llvm::Value *Array, llvm::Value *Value,
95 unsigned FirstIndex, unsigned LastIndex) {
96 // Alternatively, we could emit this as a loop in the source.
97 for (unsigned I = FirstIndex; I <= LastIndex; ++I) {
98 llvm::Value *Cell =
99 Builder.CreateConstInBoundsGEP1_32(Builder.getInt8Ty(), Array, I);
100 Builder.CreateAlignedStore(Value, Cell, CharUnits::One());
101 }
102}
103
107}
108
110 return CGF.ConvertTypeForMem(
112}
113
115 CGCXXABI &CXXABI) {
116 const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(RT->getDecl());
117 if (!RD) {
118 if (!RT->getDecl()->canPassInRegisters())
121 }
122 return CXXABI.getRecordArgABI(RD);
123}
124
126 const RecordType *RT = T->getAs<RecordType>();
127 if (!RT)
129 return getRecordArgABI(RT, CXXABI);
130}
131
133 const ABIInfo &Info) {
134 QualType Ty = FI.getReturnType();
135
136 if (const auto *RT = Ty->getAs<RecordType>())
137 if (!isa<CXXRecordDecl>(RT->getDecl()) &&
138 !RT->getDecl()->canPassInRegisters()) {
140 return true;
141 }
142
143 return CXXABI.classifyReturnType(FI);
144}
145
147 if (const RecordType *UT = Ty->getAsUnionType()) {
148 const RecordDecl *UD = UT->getDecl();
149 if (UD->hasAttr<TransparentUnionAttr>()) {
150 assert(!UD->field_empty() && "sema created an empty transparent union");
151 return UD->field_begin()->getType();
152 }
153 }
154 return Ty;
155}
156
158 llvm::Value *Ptr,
159 CharUnits Align) {
160 // OverflowArgArea = (OverflowArgArea + Align - 1) & -Align;
161 llvm::Value *RoundUp = CGF.Builder.CreateConstInBoundsGEP1_32(
162 CGF.Builder.getInt8Ty(), Ptr, Align.getQuantity() - 1);
163 return CGF.Builder.CreateIntrinsic(
164 llvm::Intrinsic::ptrmask, {Ptr->getType(), CGF.IntPtrTy},
165 {RoundUp, llvm::ConstantInt::get(CGF.IntPtrTy, -Align.getQuantity())},
166 nullptr, Ptr->getName() + ".aligned");
167}
168
171 llvm::Type *DirectTy, CharUnits DirectSize,
172 CharUnits DirectAlign, CharUnits SlotSize,
173 bool AllowHigherAlign, bool ForceRightAdjust) {
174 // Cast the element type to i8* if necessary. Some platforms define
175 // va_list as a struct containing an i8* instead of just an i8*.
176 if (VAListAddr.getElementType() != CGF.Int8PtrTy)
177 VAListAddr = VAListAddr.withElementType(CGF.Int8PtrTy);
178
179 llvm::Value *Ptr = CGF.Builder.CreateLoad(VAListAddr, "argp.cur");
180
181 // If the CC aligns values higher than the slot size, do so if needed.
182 Address Addr = Address::invalid();
183 if (AllowHigherAlign && DirectAlign > SlotSize) {
184 Addr = Address(emitRoundPointerUpToAlignment(CGF, Ptr, DirectAlign),
185 CGF.Int8Ty, DirectAlign);
186 } else {
187 Addr = Address(Ptr, CGF.Int8Ty, SlotSize);
188 }
189
190 // Advance the pointer past the argument, then store that back.
191 CharUnits FullDirectSize = DirectSize.alignTo(SlotSize);
192 Address NextPtr =
193 CGF.Builder.CreateConstInBoundsByteGEP(Addr, FullDirectSize, "argp.next");
194 CGF.Builder.CreateStore(NextPtr.emitRawPointer(CGF), VAListAddr);
195
196 // If the argument is smaller than a slot, and this is a big-endian
197 // target, the argument will be right-adjusted in its slot.
198 if (DirectSize < SlotSize && CGF.CGM.getDataLayout().isBigEndian() &&
199 (!DirectTy->isStructTy() || ForceRightAdjust)) {
200 Addr = CGF.Builder.CreateConstInBoundsByteGEP(Addr, SlotSize - DirectSize);
201 }
202
203 return Addr.withElementType(DirectTy);
204}
205
207 QualType ValueTy, bool IsIndirect,
208 TypeInfoChars ValueInfo,
209 CharUnits SlotSizeAndAlign,
210 bool AllowHigherAlign, AggValueSlot Slot,
211 bool ForceRightAdjust) {
212 // The size and alignment of the value that was passed directly.
213 CharUnits DirectSize, DirectAlign;
214 if (IsIndirect) {
215 DirectSize = CGF.getPointerSize();
216 DirectAlign = CGF.getPointerAlign();
217 } else {
218 DirectSize = ValueInfo.Width;
219 DirectAlign = ValueInfo.Align;
220 }
221
222 // Cast the address we've calculated to the right type.
223 llvm::Type *DirectTy = CGF.ConvertTypeForMem(ValueTy), *ElementTy = DirectTy;
224 if (IsIndirect) {
225 unsigned AllocaAS = CGF.CGM.getDataLayout().getAllocaAddrSpace();
226 DirectTy = llvm::PointerType::get(CGF.getLLVMContext(), AllocaAS);
227 }
228
229 Address Addr = emitVoidPtrDirectVAArg(CGF, VAListAddr, DirectTy, DirectSize,
230 DirectAlign, SlotSizeAndAlign,
231 AllowHigherAlign, ForceRightAdjust);
232
233 if (IsIndirect) {
234 Addr = Address(CGF.Builder.CreateLoad(Addr), ElementTy, ValueInfo.Align);
235 }
236
237 return CGF.EmitLoadOfAnyValue(CGF.MakeAddrLValue(Addr, ValueTy), Slot);
238}
239
241 llvm::BasicBlock *Block1, Address Addr2,
242 llvm::BasicBlock *Block2,
243 const llvm::Twine &Name) {
244 assert(Addr1.getType() == Addr2.getType());
245 llvm::PHINode *PHI = CGF.Builder.CreatePHI(Addr1.getType(), 2, Name);
246 PHI->addIncoming(Addr1.emitRawPointer(CGF), Block1);
247 PHI->addIncoming(Addr2.emitRawPointer(CGF), Block2);
248 CharUnits Align = std::min(Addr1.getAlignment(), Addr2.getAlignment());
249 return Address(PHI, Addr1.getElementType(), Align);
250}
251
253 bool AllowArrays, bool AsIfNoUniqueAddr) {
254 if (FD->isUnnamedBitField())
255 return true;
256
257 QualType FT = FD->getType();
258
259 // Constant arrays of empty records count as empty, strip them off.
260 // Constant arrays of zero length always count as empty.
261 bool WasArray = false;
262 if (AllowArrays)
263 while (const ConstantArrayType *AT = Context.getAsConstantArrayType(FT)) {
264 if (AT->isZeroSize())
265 return true;
266 FT = AT->getElementType();
267 // The [[no_unique_address]] special case below does not apply to
268 // arrays of C++ empty records, so we need to remember this fact.
269 WasArray = true;
270 }
271
272 const RecordType *RT = FT->getAs<RecordType>();
273 if (!RT)
274 return false;
275
276 // C++ record fields are never empty, at least in the Itanium ABI.
277 //
278 // FIXME: We should use a predicate for whether this behavior is true in the
279 // current ABI.
280 //
281 // The exception to the above rule are fields marked with the
282 // [[no_unique_address]] attribute (since C++20). Those do count as empty
283 // according to the Itanium ABI. The exception applies only to records,
284 // not arrays of records, so we must also check whether we stripped off an
285 // array type above.
286 if (isa<CXXRecordDecl>(RT->getDecl()) &&
287 (WasArray || (!AsIfNoUniqueAddr && !FD->hasAttr<NoUniqueAddressAttr>())))
288 return false;
289
290 return isEmptyRecord(Context, FT, AllowArrays, AsIfNoUniqueAddr);
291}
292
293bool CodeGen::isEmptyRecord(ASTContext &Context, QualType T, bool AllowArrays,
294 bool AsIfNoUniqueAddr) {
295 const RecordType *RT = T->getAs<RecordType>();
296 if (!RT)
297 return false;
298 const RecordDecl *RD = RT->getDecl();
299 if (RD->hasFlexibleArrayMember())
300 return false;
301
302 // If this is a C++ record, check the bases first.
303 if (const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD))
304 for (const auto &I : CXXRD->bases())
305 if (!isEmptyRecord(Context, I.getType(), true, AsIfNoUniqueAddr))
306 return false;
307
308 for (const auto *I : RD->fields())
309 if (!isEmptyField(Context, I, AllowArrays, AsIfNoUniqueAddr))
310 return false;
311 return true;
312}
313
315 const FieldDecl *FD) {
316 if (FD->isZeroLengthBitField(Context))
317 return true;
318
319 if (FD->isUnnamedBitField())
320 return false;
321
322 return isEmptyRecordForLayout(Context, FD->getType());
323}
324
326 const RecordType *RT = T->getAs<RecordType>();
327 if (!RT)
328 return false;
329
330 const RecordDecl *RD = RT->getDecl();
331
332 // If this is a C++ record, check the bases first.
333 if (const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD)) {
334 if (CXXRD->isDynamicClass())
335 return false;
336
337 for (const auto &I : CXXRD->bases())
338 if (!isEmptyRecordForLayout(Context, I.getType()))
339 return false;
340 }
341
342 for (const auto *I : RD->fields())
343 if (!isEmptyFieldForLayout(Context, I))
344 return false;
345
346 return true;
347}
348
350 const RecordType *RT = T->getAs<RecordType>();
351 if (!RT)
352 return nullptr;
353
354 const RecordDecl *RD = RT->getDecl();
355 if (RD->hasFlexibleArrayMember())
356 return nullptr;
357
358 const Type *Found = nullptr;
359
360 // If this is a C++ record, check the bases first.
361 if (const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD)) {
362 for (const auto &I : CXXRD->bases()) {
363 // Ignore empty records.
364 if (isEmptyRecord(Context, I.getType(), true))
365 continue;
366
367 // If we already found an element then this isn't a single-element struct.
368 if (Found)
369 return nullptr;
370
371 // If this is non-empty and not a single element struct, the composite
372 // cannot be a single element struct.
373 Found = isSingleElementStruct(I.getType(), Context);
374 if (!Found)
375 return nullptr;
376 }
377 }
378
379 // Check for single element.
380 for (const auto *FD : RD->fields()) {
381 QualType FT = FD->getType();
382
383 // Ignore empty fields.
384 if (isEmptyField(Context, FD, true))
385 continue;
386
387 // If we already found an element then this isn't a single-element
388 // struct.
389 if (Found)
390 return nullptr;
391
392 // Treat single element arrays as the element.
393 while (const ConstantArrayType *AT = Context.getAsConstantArrayType(FT)) {
394 if (AT->getZExtSize() != 1)
395 break;
396 FT = AT->getElementType();
397 }
398
399 if (!isAggregateTypeForABI(FT)) {
400 Found = FT.getTypePtr();
401 } else {
402 Found = isSingleElementStruct(FT, Context);
403 if (!Found)
404 return nullptr;
405 }
406 }
407
408 // We don't consider a struct a single-element struct if it has
409 // padding beyond the element type.
410 if (Found && Context.getTypeSize(Found) != Context.getTypeSize(T))
411 return nullptr;
412
413 return Found;
414}
415
417 QualType Ty, const ABIArgInfo &AI) {
418 // This default implementation defers to the llvm backend's va_arg
419 // instruction. It can handle only passing arguments directly
420 // (typically only handled in the backend for primitive types), or
421 // aggregates passed indirectly by pointer (NOTE: if the "byval"
422 // flag has ABI impact in the callee, this implementation cannot
423 // work.)
424
425 // Only a few cases are covered here at the moment -- those needed
426 // by the default abi.
427 llvm::Value *Val;
428
429 if (AI.isIndirect()) {
430 assert(!AI.getPaddingType() &&
431 "Unexpected PaddingType seen in arginfo in generic VAArg emitter!");
432 assert(
433 !AI.getIndirectRealign() &&
434 "Unexpected IndirectRealign seen in arginfo in generic VAArg emitter!");
435
436 auto TyInfo = CGF.getContext().getTypeInfoInChars(Ty);
437 CharUnits TyAlignForABI = TyInfo.Align;
438
439 llvm::Type *ElementTy = CGF.ConvertTypeForMem(Ty);
440 llvm::Type *BaseTy = llvm::PointerType::getUnqual(ElementTy);
441 llvm::Value *Addr =
442 CGF.Builder.CreateVAArg(VAListAddr.emitRawPointer(CGF), BaseTy);
443 return Address(Addr, ElementTy, TyAlignForABI);
444 } else {
445 assert((AI.isDirect() || AI.isExtend()) &&
446 "Unexpected ArgInfo Kind in generic VAArg emitter!");
447
448 assert(!AI.getInReg() &&
449 "Unexpected InReg seen in arginfo in generic VAArg emitter!");
450 assert(!AI.getPaddingType() &&
451 "Unexpected PaddingType seen in arginfo in generic VAArg emitter!");
452 assert(!AI.getDirectOffset() &&
453 "Unexpected DirectOffset seen in arginfo in generic VAArg emitter!");
454 assert(!AI.getCoerceToType() &&
455 "Unexpected CoerceToType seen in arginfo in generic VAArg emitter!");
456
457 Address Temp = CGF.CreateMemTemp(Ty, "varet");
458 Val = CGF.Builder.CreateVAArg(VAListAddr.emitRawPointer(CGF),
459 CGF.ConvertTypeForMem(Ty));
460 CGF.Builder.CreateStore(Val, Temp);
461 return Temp;
462 }
463}
464
466 return Ty->getAs<VectorType>() && Context.getTypeSize(Ty) == 128;
467}
468
470 const RecordType *RT = Ty->getAs<RecordType>();
471 if (!RT)
472 return false;
473 const RecordDecl *RD = RT->getDecl();
474
475 // If this is a C++ record, check the bases first.
476 if (const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD))
477 for (const auto &I : CXXRD->bases())
478 if (!isRecordWithSIMDVectorType(Context, I.getType()))
479 return false;
480
481 for (const auto *i : RD->fields()) {
482 QualType FT = i->getType();
483
484 if (isSIMDVectorType(Context, FT))
485 return true;
486
487 if (isRecordWithSIMDVectorType(Context, FT))
488 return true;
489 }
490
491 return false;
492}
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:187
const ConstantArrayType * getAsConstantArrayType(QualType T) const
Definition: ASTContext.h:2825
CanQualType Int128Ty
Definition: ASTContext.h:1128
QualType getBuiltinVaListType() const
Retrieve the type of the __builtin_va_list type.
Definition: ASTContext.h:2172
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:2394
const TargetInfo & getTargetInfo() const
Definition: ASTContext.h:779
CanQualType LongLongTy
Definition: ASTContext.h:1128
unsigned getTypeAlign(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in bits.
Definition: ASTContext.h:2425
A fixed int type of a specified bitwidth.
Definition: Type.h:7633
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::CodeGenTypes & CGT
Definition: ABIInfo.h:49
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
llvm::Type * ConvertType(QualType T)
ConvertType - Convert type T into a llvm::Type.
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:75
ABIArgInfo classifyReturnType(QualType RetTy) const
Definition: ABIInfoImpl.cpp:46
void computeInfo(CGFunctionInfo &FI) const override
Definition: ABIInfoImpl.cpp:68
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:3604
bool hasAttr() const
Definition: DeclBase.h:584
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
Definition: Type.h:5991
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:4583
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:7750
Represents a struct/union/class.
Definition: Decl.h:4145
bool canPassInRegisters() const
Determine whether this class can be passed in registers.
Definition: Decl.h:4274
bool hasFlexibleArrayMember() const
Definition: Decl.h:4178
field_range fields() const
Definition: Decl.h:4351
bool field_empty() const
Definition: Decl.h:4359
field_iterator field_begin() const
Definition: Decl.cpp:5068
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition: Type.h:5965
RecordDecl * getDecl() const
Definition: Type.h:5975
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:8319
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:8061
const T * getAs() const
Member-template getAs<specific type>'.
Definition: Type.h:8540
QualType getType() const
Definition: Decl.h:678
Represents a GCC generic vector type.
Definition: Type.h:4021
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:83
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:93
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