16 #ifndef LLVM_CLANG_CODEGEN_CGFUNCTIONINFO_H
17 #define LLVM_CLANG_CODEGEN_CGFUNCTIONINFO_H
22 #include "llvm/ADT/FoldingSet.h"
85 bool PaddingInReg : 1;
86 bool InAllocaSRet : 1;
87 bool IndirectByVal : 1;
88 bool IndirectRealign : 1;
89 bool SRetAfterThis : 1;
91 bool CanBeFlattened: 1;
94 : PaddingType(nullptr), TheKind(K), PaddingInReg(
false), InReg(
false) {}
98 : TypeData(nullptr), PaddingType(nullptr),
DirectOffset(0),
103 bool CanBeFlattened =
true) {
105 AI.setCoerceToType(T);
106 AI.setDirectOffset(
Offset);
107 AI.setPaddingType(Padding);
108 AI.setCanBeFlattened(CanBeFlattened);
118 AI.setCoerceToType(T);
119 AI.setDirectOffset(0);
131 bool Realign =
false,
134 AI.setIndirectAlign(Alignment);
135 AI.setIndirectByVal(ByVal);
136 AI.setIndirectRealign(Realign);
137 AI.setSRetAfterThis(
false);
138 AI.setPaddingType(Padding);
142 bool Realign =
false) {
149 AI.setInAllocaFieldIndex(FieldIndex);
158 AI.setPaddingInReg(PaddingInReg);
159 AI.setPaddingType(Padding);
226 return IndirectByVal;
235 return IndirectRealign;
239 IndirectRealign = IR;
244 return SRetAfterThis;
248 SRetAfterThis = AfterThis;
273 assert(
isDirect() &&
"Invalid kind!");
274 return CanBeFlattened;
278 assert(
isDirect() &&
"Invalid kind!");
279 CanBeFlattened = Flatten;
290 unsigned NumRequired;
303 unsigned additional) {
317 unsigned additional) {
329 if (value == ~0U)
return All;
344 unsigned CallingConvention : 8;
348 unsigned EffectiveCallingConvention : 8;
351 unsigned ASTCallingConvention : 8;
354 unsigned InstanceMethod : 1;
357 unsigned ChainCall : 1;
360 unsigned NoReturn : 1;
363 unsigned ReturnsRetained : 1;
366 unsigned HasRegParm : 1;
367 unsigned RegParm : 3;
373 llvm::StructType *ArgStruct;
374 unsigned ArgStructAlign;
377 ArgInfo *getArgsBuffer() {
378 return reinterpret_cast<ArgInfo*
>(
this+1);
380 const ArgInfo *getArgsBuffer()
const {
381 return reinterpret_cast<const ArgInfo*
>(
this + 1);
442 return EffectiveCallingConvention;
445 EffectiveCallingConvention =
Value;
478 ID.AddBoolean(InstanceMethod);
479 ID.AddBoolean(ChainCall);
480 ID.AddBoolean(NoReturn);
481 ID.AddBoolean(ReturnsRetained);
482 ID.AddBoolean(HasRegParm);
483 ID.AddInteger(RegParm);
496 ID.AddInteger(info.
getCC());
497 ID.AddBoolean(InstanceMethod);
498 ID.AddBoolean(ChainCall);
506 i = argTypes.begin(), e = argTypes.end(); i != e; ++i) {
518 const Decl *CalleeDecl;
521 explicit CGCalleeInfo() : CalleeProtoTy(nullptr), CalleeDecl(nullptr) {}
523 : CalleeProtoTy(calleeProtoTy), CalleeDecl(calleeDecl) {}
525 : CalleeProtoTy(calleeProtoTy), CalleeDecl(nullptr) {}
527 : CalleeProtoTy(nullptr), CalleeDecl(calleeDecl) {}
530 return CalleeProtoTy;
Ignore - Ignore the argument (treat as void).
void setEffectiveCallingConvention(unsigned Value)
void setSRetAfterThis(bool AfterThis)
static ABIArgInfo getExtend(llvm::Type *T=nullptr)
CanQualType getReturnType() const
unsigned getInAllocaFieldIndex() const
static RequiredArgs getFromOpaqueData(unsigned value)
C Language Family Type Representation.
Extend - Valid only for integer argument types.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
Decl - This represents one declaration (or definition), e.g.
Direct - Pass the argument directly using the normal converted LLVM type, or by coercing to another s...
void setIndirectAlign(CharUnits IA)
static CGFunctionInfo * create(unsigned llvmCC, bool instanceMethod, bool chainCall, const FunctionType::ExtInfo &extInfo, CanQualType resultType, ArrayRef< CanQualType > argTypes, RequiredArgs required)
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
void setCanBeFlattened(bool Flatten)
void setCoerceToType(llvm::Type *T)
static void Profile(llvm::FoldingSetNodeID &ID, bool InstanceMethod, bool ChainCall, const FunctionType::ExtInfo &info, RequiredArgs required, CanQualType resultType, ArrayRef< CanQualType > argTypes)
static ABIArgInfo getIgnore()
CGCalleeInfo(const Decl *calleeDecl)
unsigned AllocaFieldIndex
const ArgInfo * const_arg_iterator
unsigned getNumParams() const
void setDirectOffset(unsigned Offset)
const_arg_iterator arg_end() const
Indirect - Pass the argument indirectly via a hidden pointer with the specified alignment (0 indicate...
static ABIArgInfo getExtendInReg(llvm::Type *T=nullptr)
bool getInAllocaSRet() const
Return true if this field of an inalloca struct should be returned to implement a struct return calli...
void setPaddingInReg(bool PIR)
llvm::StructType * getArgStruct() const
Get the struct type used to represent all the arguments in memory.
llvm::Type * getCoerceToType() const
bool getCanBeFlattened() const
unsigned getRegParm() const
static ABIArgInfo getIndirectInReg(CharUnits Alignment, bool ByVal=true, bool Realign=false)
unsigned getEffectiveCallingConvention() const
getEffectiveCallingConvention - Return the actual calling convention to use, which may depend on the ...
CharUnits getArgStructAlignment() const
const FunctionProtoType * getCalleeFunctionProtoType()
static ABIArgInfo getDirect(llvm::Type *T=nullptr, unsigned Offset=0, llvm::Type *Padding=nullptr, bool CanBeFlattened=true)
void setInAllocaFieldIndex(unsigned FieldIndex)
static ABIArgInfo getExpandWithPadding(bool PaddingInReg, llvm::Type *Padding)
CharUnits - This is an opaque type for sizes expressed in character units.
ABIArgInfo - Helper class to encapsulate information about how a specific C type should be passed to ...
bool allowsOptionalArgs() const
unsigned getCallingConvention() const
getCallingConvention - Return the user specified calling convention, which has been translated into a...
llvm::iterator_range< const_arg_iterator > arg_const_range
static ABIArgInfo getExpand()
static RequiredArgs forPrototype(CanQual< FunctionProtoType > prototype)
detail::InMemoryDirectory::const_iterator I
unsigned getOpaqueData() const
unsigned getNumRequiredArgs() const
Represents a prototype with parameter type info, e.g.
void setIndirectByVal(bool IBV)
ID
Defines the set of possible language-specific address spaces.
CGCalleeInfo(const FunctionProtoType *calleeProtoTy)
bool usesInAlloca() const
Return true if this function uses inalloca arguments.
CharUnits getIndirectAlign() const
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
A class for recording the number of arguments that a function signature requires. ...
void setPaddingType(llvm::Type *T)
void Profile(llvm::FoldingSetNodeID &ID)
unsigned getRegParm() const
void Profile(llvm::FoldingSetNodeID &ID) const
llvm::Type * getPaddingType() const
CallingConv
CallingConv - Specifies the calling convention that a function uses.
CallingConv getASTCallingConvention() const
getASTCallingConvention() - Return the AST-specified calling convention.
unsigned getNumRequiredArgs() const
The l-value was considered opaque, so the alignment was determined from a type.
FunctionType::ExtInfo getExtInfo() const
RequiredArgs getRequiredArgs() const
void setArgStruct(llvm::StructType *Ty, CharUnits Align)
bool getPaddingInReg() const
bool isReturnsRetained() const
In ARC, whether this function retains its return value.
llvm::iterator_range< arg_iterator > arg_range
InAlloca - Pass the argument directly using the LLVM inalloca attribute.
const ABIArgInfo & getReturnInfo() const
CGCalleeInfo(const FunctionProtoType *calleeProtoTy, const Decl *calleeDecl)
bool isSRetAfterThis() const
CGFunctionInfo - Class to encapsulate the information about a function definition.
bool canHaveCoerceToType() const
unsigned getDirectOffset() const
static ABIArgInfo getDirectInReg(llvm::Type *T=nullptr)
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
bool isInstanceMethod() const
bool getProducesResult() const
CallingConv getCC() const
static RequiredArgs forPrototype(const FunctionProtoType *prototype)
static RequiredArgs forPrototypePlus(const FunctionProtoType *prototype, unsigned additional)
Compute the arguments required by the given formal prototype, given that there may be some additional...
Expand - Only valid for aggregate argument types.
ABIArgInfo & getReturnInfo()
static ABIArgInfo getInAlloca(unsigned FieldIndex)
const Decl * getCalleeDecl()
bool getHasRegParm() const
const T * getTypePtr() const
Retrieve the underlying type pointer, which refers to a canonical type.
const_arg_iterator arg_begin() const
bool getIndirectByVal() const
bool getHasRegParm() const
unsigned arg_size() const
arg_const_range arguments() const
static RequiredArgs forPrototypePlus(CanQual< FunctionProtoType > prototype, unsigned additional)
bool getIndirectRealign() const
void setInAllocaSRet(bool SRet)
static ABIArgInfo getIndirect(CharUnits Alignment, bool ByVal=true, bool Realign=false, llvm::Type *Padding=nullptr)
void setIndirectRealign(bool IR)
CGCalleeInfo - Class to encapsulate the information about a callee to be used during the generation o...
A class which abstracts out some details necessary for making a call.