10#include "TargetInfo.h"
28 bool shouldUseInReg(
QualType Ty, CCState &State)
const;
51bool LanaiABIInfo::shouldUseInReg(
QualType Ty, CCState &State)
const {
52 unsigned Size = getContext().getTypeSize(Ty);
53 unsigned SizeInRegs = llvm::alignTo(Size, 32U) / 32U;
58 if (SizeInRegs > State.FreeRegs) {
63 State.FreeRegs -= SizeInRegs;
69 CCState &State)
const {
73 return getNaturalAlignIndirectInReg(Ty);
75 return getNaturalAlignIndirect(Ty,
false);
79 const unsigned MinABIStackAlignInBytes = 4;
80 unsigned TypeAlign = getContext().getTypeAlign(Ty) / 8;
83 MinABIStackAlignInBytes);
87 CCState &State)
const {
93 return getIndirectResult(Ty,
false, State);
95 return getNaturalAlignIndirect(Ty,
true);
102 return getIndirectResult(Ty,
true, State);
108 llvm::LLVMContext &LLVMContext = getVMContext();
109 unsigned SizeInRegs = (getContext().getTypeSize(Ty) + 31) / 32;
110 if (SizeInRegs <= State.FreeRegs) {
111 llvm::IntegerType *
Int32 = llvm::Type::getInt32Ty(LLVMContext);
113 llvm::Type *Result = llvm::StructType::get(LLVMContext, Elements);
114 State.FreeRegs -= SizeInRegs;
119 return getIndirectResult(Ty,
true, State);
124 Ty = EnumTy->getDecl()->getIntegerType();
126 bool InReg = shouldUseInReg(Ty, State);
130 if (EIT->getNumBits() > 64)
131 return getIndirectResult(Ty,
true, State);
133 if (isPromotableIntegerTypeForABI(Ty)) {
151std::unique_ptr<TargetCodeGenInfo>
153 return std::make_unique<LanaiTargetCodeGenInfo>(CGM.
getTypes());
A fixed int type of a specified bitwidth.
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 getIndirect(CharUnits Alignment, bool ByVal=true, bool Realign=false, llvm::Type *Padding=nullptr)
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)
static ABIArgInfo getDirectInReg(llvm::Type *T=nullptr)
CodeGen::CGCXXABI & getCXXABI() const
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.
CGFunctionInfo - Class to encapsulate the information about a function definition.
ABIArgInfo & getReturnInfo()
unsigned getRegParm() const
CanQualType getReturnType() const
bool getHasRegParm() const
MutableArrayRef< ArgInfo > arguments()
This class organizes the cross-function state that is used while generating LLVM code.
CodeGenTypes & getTypes()
This class organizes the cross-module state that is used while lowering AST types to LLVM types.
DefaultABIInfo - The default implementation for ABI specific details.
ABIArgInfo classifyArgumentType(QualType RetTy) const
ABIArgInfo classifyReturnType(QualType RetTy) const
void computeInfo(CGFunctionInfo &FI) const override
TargetCodeGenInfo - This class organizes various target-specific codegeneration issues,...
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
A (possibly-)qualified type.
bool hasFlexibleArrayMember() const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getDecl() const
const T * getAs() const
Member-template getAs<specific type>'.
CGCXXABI::RecordArgABI getRecordArgABI(const RecordType *RT, CGCXXABI &CXXABI)
bool isAggregateTypeForABI(QualType T)
bool isEmptyRecord(ASTContext &Context, QualType T, bool AllowArrays, bool AsIfNoUniqueAddr=false)
isEmptyRecord - Return true iff a structure contains only empty fields.
std::unique_ptr< TargetCodeGenInfo > createLanaiTargetCodeGenInfo(CodeGenModule &CGM)
The JSON file list parser is used to communicate input to InstallAPI.