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;
114 AVRTargetCodeGenInfo(CodeGenTypes &CGT,
unsigned NPR,
unsigned NRR)
115 : TargetCodeGenInfo(std::make_unique<AVRABIInfo>(CGT, NPR, NRR)) {}
117 LangAS getGlobalVarAddressSpace(CodeGenModule &CGM,
118 const VarDecl *D)
const override {
127 diag::err_verify_nonconst_addrspace)
133 void setTargetAttributes(
const Decl *D, llvm::GlobalValue *GV,
134 CodeGen::CodeGenModule &CGM)
const override {
135 if (GV->isDeclaration())
137 const auto *FD = dyn_cast_or_null<FunctionDecl>(D);
141 if (FD->getAttr<AVRInterruptAttr>())
142 Fn->addFnAttr(
"interrupt");
144 if (FD->getAttr<AVRSignalAttr>())
145 Fn->addFnAttr(
"signal");
150std::unique_ptr<TargetCodeGenInfo>
153 return std::make_unique<AVRTargetCodeGenInfo>(CGM.
getTypes(), NPR, NRR);
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)
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)
bool isAggregateTypeForABI(QualType T)
std::unique_ptr< TargetCodeGenInfo > createAVRTargetCodeGenInfo(CodeGenModule &CGM, unsigned NPR, unsigned NRR)
The JSON file list parser is used to communicate input to InstallAPI.
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)