10#include "TargetInfo.h"
27 const unsigned ParamRegs;
30 const unsigned RetRegs;
33 AVRABIInfo(
CodeGenTypes &CGT,
unsigned NPR,
unsigned NRR)
46 if (
getContext().getTypeSize(Ty) > RetRegs * 8) {
62 if (TySize == 8 && NumRegs >= 2) {
69 TySize = llvm::alignTo(TySize, 16);
73 if (TySize <= NumRegs * 8) {
74 NumRegs -= TySize / 8;
91 bool LargeRet =
false;
102 unsigned NumRegs = ParamRegs;
114 AVRTargetCodeGenInfo(
CodeGenTypes &CGT,
unsigned NPR,
unsigned NRR)
118 const VarDecl *D)
const override {
127 diag::err_verify_nonconst_addrspace)
135 if (GV->isDeclaration())
137 const auto *FD = dyn_cast_or_null<FunctionDecl>(D);
139 auto *Fn = cast<llvm::Function>(GV);
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);
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
ABIArgInfo - Helper class to encapsulate information about how a specific C type should be passed to ...
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)
CodeGen::CGCXXABI & getCXXABI() const
ASTContext & getContext() const
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...
CGFunctionInfo - Class to encapsulate the information about a function definition.
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()
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,...
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.
virtual void setTargetAttributes(const Decl *D, llvm::GlobalValue *GV, CodeGen::CodeGenModule &M) const
setTargetAttributes - Provides a convenient hook to handle extra target-specific attributes for the g...
Decl - This represents one declaration (or definition), e.g.
SourceLocation getLocation() const
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
A (possibly-)qualified type.
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.
Represents a variable declaration or definition.
bool isAggregateTypeForABI(QualType T)
std::unique_ptr< TargetCodeGenInfo > createAVRTargetCodeGenInfo(CodeGenModule &CGM, unsigned NPR, unsigned NRR)
bool isTargetAddressSpace(LangAS AS)
unsigned toTargetAddressSpace(LangAS AS)
LangAS
Defines the address space values used by the address space qualifier of QualType.