10#include "TargetInfo.h"
27 const unsigned ParamRegs;
30 const unsigned RetRegs;
33 AVRABIInfo(CodeGenTypes &CGT,
unsigned NPR,
unsigned NRR)
34 : DefaultABIInfo(CGT), ParamRegs(NPR), RetRegs(NRR) {}
42 getContext().getTypeSize(Ty) <= RetRegs * 8)
46 if (getContext().getTypeSize(Ty) > RetRegs * 8) {
48 return getNaturalAlignIndirect(Ty, getDataLayout().getAllocaAddrSpace());
59 unsigned TySize = getContext().getTypeSize(Ty);
69 TySize = llvm::alignTo(TySize, 16);
73 if (TySize <= NumRegs * 8) {
74 NumRegs -= TySize / 8;
89 void computeInfo(CGFunctionInfo &FI)
const override {
91 bool LargeRet =
false;
102 unsigned NumRegs = ParamRegs;
111 RValue EmitVAArg(CodeGenFunction &CGF, Address VAListAddr, QualType Ty,
112 AggValueSlot Slot)
const override {
116 auto TInfo = getContext().getTypeInfoInChars(Ty);
118 SlotSize,
false, Slot);
124 AVRTargetCodeGenInfo(CodeGenTypes &CGT,
unsigned NPR,
unsigned NRR)
125 : TargetCodeGenInfo(std::make_unique<AVRABIInfo>(CGT, NPR, NRR)) {}
127 LangAS getGlobalVarAddressSpace(CodeGenModule &CGM,
128 const VarDecl *D)
const override {
137 diag::err_verify_nonconst_addrspace)
143 void setTargetAttributes(
const Decl *D, llvm::GlobalValue *GV,
144 CodeGen::CodeGenModule &CGM)
const override {
145 if (GV->isDeclaration())
147 const auto *FD = dyn_cast_or_null<FunctionDecl>(D);
151 if (FD->getAttr<AVRInterruptAttr>())
152 Fn->addFnAttr(
"interrupt");
154 if (FD->getAttr<AVRSignalAttr>())
155 Fn->addFnAttr(
"signal");
160std::unique_ptr<TargetCodeGenInfo>
163 return std::make_unique<AVRTargetCodeGenInfo>(CGM.
getTypes(), NPR, NRR);
static CharUnits One()
Construct a CharUnits quantity of one.
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 *Padding=nullptr)
ABIArgInfo & getReturnInfo()
CanQualType getReturnType() const
MutableArrayRef< ArgInfo > arguments()
This class organizes the cross-function state that is used while generating LLVM code.
DiagnosticsEngine & getDiags() const
CodeGenTypes & getTypes()
DefaultABIInfo - The default implementation for ABI specific details.
ABIArgInfo classifyReturnType(QualType RetTy) const
TargetCodeGenInfo - This class organizes various target-specific codegeneration issues,...
virtual LangAS getGlobalVarAddressSpace(CodeGenModule &CGM, const VarDecl *D) const
Get target favored AST address space of a global variable for languages other than OpenCL and CUDA.
SourceLocation getLocation() const
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
LangAS getAddressSpace() const
Return the address space of this type.
bool isConstQualified() const
Determine whether this type is const-qualified.
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
ABIArgInfo classifyArgumentType(CodeGenModule &CGM, CanQualType type)
Classify the rules for how to pass a particular type.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
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 > createAVRTargetCodeGenInfo(CodeGenModule &CGM, unsigned NPR, unsigned NRR)
Top level wrappers for InstallAPI frontend operations.
bool isTargetAddressSpace(LangAS AS)
unsigned toTargetAddressSpace(LangAS AS)
LangAS
Defines the address space values used by the address space qualifier of QualType.
U cast(CodeGen::Address addr)