16 #ifndef LLVM_CLANG_CODEGEN_CGFUNCTIONINFO_H
17 #define LLVM_CLANG_CODEGEN_CGFUNCTIONINFO_H
21 #include "llvm/ADT/FoldingSet.h"
77 llvm::Type *PaddingType;
84 bool PaddingInReg : 1;
85 bool InAllocaSRet : 1;
86 bool IndirectByVal : 1;
87 bool IndirectRealign : 1;
88 bool SRetAfterThis : 1;
90 bool CanBeFlattened: 1;
93 : PaddingType(nullptr), TheKind(K), PaddingInReg(
false), InReg(
false) {}
97 : TypeData(nullptr), PaddingType(nullptr),
DirectOffset(0),
101 llvm::Type *Padding =
nullptr,
102 bool CanBeFlattened =
true) {
104 AI.setCoerceToType(T);
105 AI.setDirectOffset(
Offset);
106 AI.setPaddingType(Padding);
107 AI.setCanBeFlattened(CanBeFlattened);
117 AI.setCoerceToType(T);
118 AI.setDirectOffset(0);
130 bool Realign =
false,
131 llvm::Type *Padding =
nullptr) {
133 AI.setIndirectAlign(Alignment);
134 AI.setIndirectByVal(ByVal);
135 AI.setIndirectRealign(Realign);
136 AI.setSRetAfterThis(
false);
137 AI.setPaddingType(Padding);
141 bool Realign =
false) {
148 AI.setInAllocaFieldIndex(FieldIndex);
155 llvm::Type *Padding) {
157 AI.setPaddingInReg(PaddingInReg);
158 AI.setPaddingType(Padding);
225 return IndirectByVal;
234 return IndirectRealign;
238 IndirectRealign = IR;
243 return SRetAfterThis;
247 SRetAfterThis = AfterThis;
272 assert(
isDirect() &&
"Invalid kind!");
273 return CanBeFlattened;
277 assert(
isDirect() &&
"Invalid kind!");
278 CanBeFlattened = Flatten;
289 unsigned NumRequired;
302 unsigned additional) {
316 unsigned additional) {
328 if (value == ~0U)
return All;
343 unsigned CallingConvention : 8;
347 unsigned EffectiveCallingConvention : 8;
350 unsigned ASTCallingConvention : 8;
353 unsigned InstanceMethod : 1;
356 unsigned ChainCall : 1;
359 unsigned NoReturn : 1;
362 unsigned ReturnsRetained : 1;
365 unsigned HasRegParm : 1;
366 unsigned RegParm : 3;
372 llvm::StructType *ArgStruct;
375 ArgInfo *getArgsBuffer() {
376 return reinterpret_cast<ArgInfo*
>(
this+1);
378 const ArgInfo *getArgsBuffer()
const {
379 return reinterpret_cast<const ArgInfo*
>(
this + 1);
440 return EffectiveCallingConvention;
443 EffectiveCallingConvention =
Value;
470 ID.AddBoolean(InstanceMethod);
471 ID.AddBoolean(ChainCall);
472 ID.AddBoolean(NoReturn);
473 ID.AddBoolean(ReturnsRetained);
474 ID.AddBoolean(HasRegParm);
475 ID.AddInteger(RegParm);
488 ID.AddInteger(info.
getCC());
489 ID.AddBoolean(InstanceMethod);
490 ID.AddBoolean(ChainCall);
498 i = argTypes.begin(), e = argTypes.end(); i != e; ++i) {
void setIndirectByVal(unsigned IBV)
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)
static ABIArgInfo getIndirect(unsigned Alignment, bool ByVal=true, bool Realign=false, llvm::Type *Padding=nullptr)
static CGFunctionInfo * create(unsigned llvmCC, bool instanceMethod, bool chainCall, const FunctionType::ExtInfo &extInfo, CanQualType resultType, ArrayRef< CanQualType > argTypes, RequiredArgs required)
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()
unsigned AllocaFieldIndex
const ArgInfo * const_arg_iterator
unsigned getNumParams() const
void setDirectOffset(unsigned Offset)
const_arg_iterator arg_end() const
static ABIArgInfo getIndirectInReg(unsigned Alignment, bool ByVal=true, bool Realign=false)
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
unsigned getEffectiveCallingConvention() const
unsigned getIndirectAlign() const
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)
void setArgStruct(llvm::StructType *Ty)
bool allowsOptionalArgs() const
unsigned getCallingConvention() const
llvm::iterator_range< const_arg_iterator > arg_const_range
static ABIArgInfo getExpand()
static RequiredArgs forPrototype(CanQual< FunctionProtoType > prototype)
unsigned getOpaqueData() const
unsigned getNumRequiredArgs() const
ID
Defines the set of possible language-specific address spaces.
bool usesInAlloca() const
Return true if this function uses inalloca arguments.
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
unsigned getNumRequiredArgs() const
FunctionType::ExtInfo getExtInfo() const
RequiredArgs getRequiredArgs() const
bool getPaddingInReg() const
bool isReturnsRetained() const
llvm::iterator_range< arg_iterator > arg_range
const ABIArgInfo & getReturnInfo() const
bool isSRetAfterThis() const
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)
ABIArgInfo & getReturnInfo()
static ABIArgInfo getInAlloca(unsigned FieldIndex)
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 setIndirectAlign(unsigned IA)
void setInAllocaSRet(bool SRet)
void setIndirectRealign(bool IR)