10 #include "TargetInfo.h"
13 using namespace clang;
27 const unsigned ParamRegs;
30 const unsigned RetRegs;
33 AVRABIInfo(
CodeGenTypes &CGT,
unsigned NPR,
unsigned NRR)
42 getContext().getTypeSize(Ty) <= RetRegs * 8)
46 if (getContext().getTypeSize(Ty) > RetRegs * 8) {
48 return getNaturalAlignIndirect(Ty);
59 unsigned TySize = getContext().getTypeSize(Ty);
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)
133 void setTargetAttributes(
const Decl *D, llvm::GlobalValue *GV,
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");
150 std::unique_ptr<TargetCodeGenInfo>
153 return std::make_unique<AVRTargetCodeGenInfo>(CGM.
getTypes(), NPR, NRR);
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)
CGFunctionInfo - Class to encapsulate the information about a function definition.
CanQualType getReturnType() const
MutableArrayRef< ArgInfo > arguments()
ABIArgInfo & getReturnInfo()
This class organizes the cross-function state that is used while generating LLVM code.
CodeGenTypes & getTypes()
DiagnosticsEngine & getDiags() const
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 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.
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.
ABIArgInfo classifyArgumentType(CodeGenModule &CGM, CanQualType type)
Classify the rules for how to pass a particular type.
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.