10#include "TargetInfo.h"
27 RValue EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty,
28 AggValueSlot Slot)
const override;
30 void updateState(
const ABIArgInfo &Info, QualType Ty, CCState &State)
const {
36 unsigned sz = (getContext().getTypeSize(Ty) + 31) / 32;
37 if (sz < State.FreeRegs)
44 void computeInfo(CGFunctionInfo &FI)
const override {
54 updateState(I.info, I.type, State);
58 ABIArgInfo getIndirectByRef(QualType Ty,
bool HasFreeRegs)
const;
59 ABIArgInfo getIndirectByValue(QualType Ty)
const;
66 ARCTargetCodeGenInfo(CodeGenTypes &CGT)
67 : TargetCodeGenInfo(std::make_unique<ARCABIInfo>(CGT)) {}
72 return HasFreeRegs ? getNaturalAlignIndirectInReg(Ty)
73 : getNaturalAlignIndirect(
74 Ty, getDataLayout().getAllocaAddrSpace(),
false);
77ABIArgInfo ARCABIInfo::getIndirectByValue(QualType Ty)
const {
79 const unsigned MinABIStackAlignInBytes = 4;
80 unsigned TypeAlign = getContext().getTypeAlign(Ty) / 8;
83 getDataLayout().getAllocaAddrSpace(),
84 true, TypeAlign > MinABIStackAlignInBytes);
87RValue ARCABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
88 QualType Ty, AggValueSlot Slot)
const {
90 getContext().getTypeInfoInChars(Ty),
94ABIArgInfo ARCABIInfo::classifyArgumentType(QualType Ty,
95 uint8_t FreeRegs)
const {
101 return getIndirectByRef(Ty, FreeRegs > 0);
104 return getIndirectByValue(Ty);
109 Ty = ED->getIntegerType();
111 auto SizeInRegs = llvm::alignTo(getContext().getTypeSize(Ty), 32) / 32;
116 RT->getOriginalDecl()->getDefinitionOrSelf()->hasFlexibleArrayMember())
117 return getIndirectByValue(Ty);
123 llvm::LLVMContext &LLVMContext = getVMContext();
125 llvm::IntegerType *
Int32 = llvm::Type::getInt32Ty(LLVMContext);
126 SmallVector<llvm::Type *, 3> Elements(SizeInRegs, Int32);
127 llvm::Type *
Result = llvm::StructType::get(LLVMContext, Elements);
129 return FreeRegs >= SizeInRegs ?
134 if (
const auto *EIT = Ty->
getAs<BitIntType>())
135 if (EIT->getNumBits() > 64)
136 return getIndirectByValue(Ty);
138 return isPromotableIntegerTypeForABI(Ty)
140 : ABIArgInfo::getExtend(Ty))
141 : (FreeRegs >= SizeInRegs ? ABIArgInfo::getDirectInReg()
142 : ABIArgInfo::getDirect());
145ABIArgInfo ARCABIInfo::classifyReturnType(QualType RetTy)
const {
150 auto RetSize = llvm::alignTo(getContext().getTypeSize(RetTy), 32) / 32;
152 return getIndirectByRef(RetTy,
true);
159std::unique_ptr<TargetCodeGenInfo>
161 return std::make_unique<ARCTargetCodeGenInfo>(CGM.
getTypes());
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
ABIArgInfo - Helper class to encapsulate information about how a specific C type should be passed to ...
static ABIArgInfo getIgnore()
static ABIArgInfo getExtendInReg(QualType Ty, llvm::Type *T=nullptr)
static ABIArgInfo getIndirect(CharUnits Alignment, unsigned AddrSpace, bool ByVal=true, bool Realign=false, llvm::Type *Padding=nullptr)
static ABIArgInfo getDirectInReg(llvm::Type *T=nullptr)
RecordArgABI
Specify how one should pass an argument of a record type.
@ RAA_Indirect
Pass it as a pointer to temporary memory.
@ RAA_DirectInMemory
Pass it on the stack using its defined layout.
ABIArgInfo & getReturnInfo()
CanQualType getReturnType() const
MutableArrayRef< ArgInfo > arguments()
This class organizes the cross-function state that is used while generating LLVM code.
CodeGenTypes & getTypes()
DefaultABIInfo - The default implementation for ABI specific details.
DefaultABIInfo(CodeGen::CodeGenTypes &CGT)
ABIArgInfo classifyReturnType(QualType RetTy) const
TargetCodeGenInfo - This class organizes various target-specific codegeneration issues,...
A (possibly-)qualified type.
bool isAnyComplexType() const
EnumDecl * getAsEnumDecl() const
Retrieves the EnumDecl this type refers to.
const T * getAsCanonical() const
If this type is canonically the specified type, return its canonical type cast to that specified type...
const T * getAs() const
Member-template getAs<specific type>'.
ABIArgInfo classifyArgumentType(CodeGenModule &CGM, CanQualType type)
Classify the rules for how to pass a particular type.
CGCXXABI::RecordArgABI getRecordArgABI(const RecordType *RT, CGCXXABI &CXXABI)
bool classifyReturnType(const CGCXXABI &CXXABI, CGFunctionInfo &FI, const ABIInfo &Info)
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 ...
bool isAggregateTypeForABI(QualType T)
std::unique_ptr< TargetCodeGenInfo > createARCTargetCodeGenInfo(CodeGenModule &CGM)
bool isEmptyRecord(ASTContext &Context, QualType T, bool AllowArrays, bool AsIfNoUniqueAddr=false)
isEmptyRecord - Return true iff a structure contains only empty fields.
The JSON file list parser is used to communicate input to InstallAPI.
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
@ Result
The result type of a method or function.