clang 22.0.0git
clang::CodeGen::ABIArgInfo Class Reference

ABIArgInfo - Helper class to encapsulate information about how a specific C type should be passed to or returned from a function. More...

#include "clang/CodeGen/CGFunctionInfo.h"

Public Types

enum  Kind : uint8_t {
  Direct , Extend , Indirect , IndirectAliased ,
  Ignore , Expand , CoerceAndExpand , TargetSpecific ,
  InAlloca , KindFirst = Direct , KindLast = InAlloca
}

Public Member Functions

 ABIArgInfo (Kind K=Direct)
Kind getKind () const
bool isDirect () const
bool isInAlloca () const
bool isExtend () const
bool isIgnore () const
bool isIndirect () const
bool isIndirectAliased () const
bool isExpand () const
bool isCoerceAndExpand () const
bool isTargetSpecific () const
bool canHaveCoerceToType () const
unsigned getDirectOffset () const
void setDirectOffset (unsigned Offset)
unsigned getDirectAlign () const
void setDirectAlign (unsigned Align)
bool isSignExt () const
void setSignExt (bool SExt)
bool isZeroExt () const
void setZeroExt (bool ZExt)
bool isNoExt () const
llvm::Type * getPaddingType () const
bool getPaddingInReg () const
void setPaddingInReg (bool PIR)
llvm::Type * getCoerceToType () const
void setCoerceToType (llvm::Type *T)
llvm::StructType * getCoerceAndExpandType () const
llvm::Type * getUnpaddedCoerceAndExpandType () const
ArrayRef< llvm::Type * > getCoerceAndExpandTypeSequence () const
bool getInReg () const
void setInReg (bool IR)
CharUnits getIndirectAlign () const
void setIndirectAlign (CharUnits IA)
bool getIndirectByVal () const
void setIndirectByVal (bool IBV)
unsigned getIndirectAddrSpace () const
void setIndirectAddrSpace (unsigned AddrSpace)
bool getIndirectRealign () const
void setIndirectRealign (bool IR)
bool isSRetAfterThis () const
void setSRetAfterThis (bool AfterThis)
unsigned getInAllocaFieldIndex () const
void setInAllocaFieldIndex (unsigned FieldIndex)
unsigned getInAllocaIndirect () const
void setInAllocaIndirect (bool Indirect)
bool getInAllocaSRet () const
 Return true if this field of an inalloca struct should be returned to implement a struct return calling convention.
void setInAllocaSRet (bool SRet)
bool getCanBeFlattened () const
void setCanBeFlattened (bool Flatten)
void dump () const

Static Public Member Functions

static ABIArgInfo getDirect (llvm::Type *T=nullptr, unsigned Offset=0, llvm::Type *Padding=nullptr, bool CanBeFlattened=true, unsigned Align=0)
static ABIArgInfo getDirectInReg (llvm::Type *T=nullptr)
static ABIArgInfo getSignExtend (QualType Ty, llvm::Type *T=nullptr)
static ABIArgInfo getZeroExtend (QualType Ty, llvm::Type *T=nullptr)
static ABIArgInfo getExtend (QualType Ty, llvm::Type *T=nullptr)
static ABIArgInfo getNoExtend (llvm::IntegerType *T)
static ABIArgInfo getExtendInReg (QualType Ty, llvm::Type *T=nullptr)
static ABIArgInfo getIgnore ()
static ABIArgInfo getIndirect (CharUnits Alignment, unsigned AddrSpace, bool ByVal=true, bool Realign=false, llvm::Type *Padding=nullptr)
static ABIArgInfo getIndirectAliased (CharUnits Alignment, unsigned AddrSpace, bool Realign=false, llvm::Type *Padding=nullptr)
 Pass this in memory using the IR byref attribute.
static ABIArgInfo getIndirectInReg (CharUnits Alignment, bool ByVal=true, bool Realign=false)
static ABIArgInfo getInAlloca (unsigned FieldIndex, bool Indirect=false)
static ABIArgInfo getExpand ()
static ABIArgInfo getExpandWithPadding (bool PaddingInReg, llvm::Type *Padding)
static ABIArgInfo getCoerceAndExpand (llvm::StructType *coerceToType, llvm::Type *unpaddedCoerceToType)
static ABIArgInfo getTargetSpecific (llvm::Type *T=nullptr, unsigned Offset=0, llvm::Type *Padding=nullptr, bool CanBeFlattened=true, unsigned Align=0)
static bool isPaddingForCoerceAndExpand (llvm::Type *eltType)

Detailed Description

ABIArgInfo - Helper class to encapsulate information about how a specific C type should be passed to or returned from a function.

Definition at line 32 of file CGFunctionInfo.h.

Member Enumeration Documentation

◆ Kind

Enumerator
Direct 

Direct - Pass the argument directly using the normal converted LLVM type, or by coercing to another specified type stored in 'CoerceToType').

If an offset is specified (in UIntData), then the argument passed is offset by some number of bytes in the memory representation. A dummy argument is emitted before the real argument if the specified type stored in "PaddingType" is not zero.

Extend 

Extend - Valid only for integer argument types.

Same as 'direct' but also emit a zero/sign extension attribute.

Indirect 

Indirect - Pass the argument indirectly via a hidden pointer with the specified alignment (0 indicates default alignment) and address space.

IndirectAliased 

IndirectAliased - Similar to Indirect, but the pointer may be to an object that is otherwise referenced.

The object is known to not be modified through any other references for the duration of the call, and the callee must not itself modify the object. Because C allows parameter variables to be modified and guarantees that they have unique addresses, the callee must defensively copy the object into a local variable if it might be modified or its address might be compared. Since those are uncommon, in principle this convention allows programs to avoid copies in more situations. However, it may introduce extra copies if the callee fails to prove that a copy is unnecessary and the caller naturally produces an unaliased object for the argument.

Ignore 

Ignore - Ignore the argument (treat as void).

Useful for void and empty structs.

Expand 

Expand - Only valid for aggregate argument types.

The structure should be expanded into consecutive arguments for its constituent fields. Currently expand is only allowed on structures whose fields are all scalar types or are themselves expandable types.

CoerceAndExpand 

CoerceAndExpand - Only valid for aggregate argument types.

The structure should be expanded into consecutive arguments corresponding to the non-array elements of the type stored in CoerceToType. Array elements in the type are assumed to be padding and skipped.

TargetSpecific 

TargetSpecific - Some argument types are passed as target specific types such as RISC-V's tuple type, these need to be handled in the target hook.

InAlloca 

InAlloca - Pass the argument directly using the LLVM inalloca attribute.

This is similar to indirect with byval, except it only applies to arguments stored in memory and forbids any implicit copies. When applied to a return type, it means the value is returned indirectly via an implicit sret parameter stored in the argument struct.

KindFirst 
KindLast 

Definition at line 34 of file CGFunctionInfo.h.

Constructor & Destructor Documentation

◆ ABIArgInfo()

Member Function Documentation

◆ canHaveCoerceToType()

bool clang::CodeGen::ABIArgInfo::canHaveCoerceToType ( ) const
inline

◆ dump()

◆ getCanBeFlattened()

◆ getCoerceAndExpand()

ABIArgInfo clang::CodeGen::ABIArgInfo::getCoerceAndExpand ( llvm::StructType * coerceToType,
llvm::Type * unpaddedCoerceToType )
inlinestatic
Parameters
unpaddedCoerceToTypeThe coerce-to type with padding elements removed, canonicalized to a single element if it would otherwise have exactly one element.

Definition at line 267 of file CGFunctionInfo.h.

References ABIArgInfo(), CoerceAndExpand, and isPaddingForCoerceAndExpand().

Referenced by classifyExpandedType().

◆ getCoerceAndExpandType()

llvm::StructType * clang::CodeGen::ABIArgInfo::getCoerceAndExpandType ( ) const
inline

◆ getCoerceAndExpandTypeSequence()

ArrayRef< llvm::Type * > clang::CodeGen::ABIArgInfo::getCoerceAndExpandTypeSequence ( ) const
inline

◆ getCoerceToType()

◆ getDirect()

ABIArgInfo clang::CodeGen::ABIArgInfo::getDirect ( llvm::Type * T = nullptr,
unsigned Offset = 0,
llvm::Type * Padding = nullptr,
bool CanBeFlattened = true,
unsigned Align = 0 )
inlinestatic

◆ getDirectAlign()

unsigned clang::CodeGen::ABIArgInfo::getDirectAlign ( ) const
inline

◆ getDirectInReg()

ABIArgInfo clang::CodeGen::ABIArgInfo::getDirectInReg ( llvm::Type * T = nullptr)
inlinestatic

Definition at line 159 of file CGFunctionInfo.h.

References ABIArgInfo(), getDirect(), and clang::T.

◆ getDirectOffset()

◆ getExpand()

ABIArgInfo clang::CodeGen::ABIArgInfo::getExpand ( )
inlinestatic

Definition at line 251 of file CGFunctionInfo.h.

References ABIArgInfo(), and Expand.

Referenced by classifyType(), and getExpandWithPadding().

◆ getExpandWithPadding()

ABIArgInfo clang::CodeGen::ABIArgInfo::getExpandWithPadding ( bool PaddingInReg,
llvm::Type * Padding )
inlinestatic

Definition at line 256 of file CGFunctionInfo.h.

References ABIArgInfo(), and getExpand().

◆ getExtend()

◆ getExtendInReg()

ABIArgInfo clang::CodeGen::ABIArgInfo::getExtendInReg ( QualType Ty,
llvm::Type * T = nullptr )
inlinestatic

Definition at line 206 of file CGFunctionInfo.h.

References ABIArgInfo(), getExtend(), and clang::T.

◆ getIgnore()

ABIArgInfo clang::CodeGen::ABIArgInfo::getIgnore ( )
inlinestatic

◆ getInAlloca()

ABIArgInfo clang::CodeGen::ABIArgInfo::getInAlloca ( unsigned FieldIndex,
bool Indirect = false )
inlinestatic

Definition at line 245 of file CGFunctionInfo.h.

References ABIArgInfo(), InAlloca, and Indirect.

◆ getInAllocaFieldIndex()

unsigned clang::CodeGen::ABIArgInfo::getInAllocaFieldIndex ( ) const
inline

◆ getInAllocaIndirect()

unsigned clang::CodeGen::ABIArgInfo::getInAllocaIndirect ( ) const
inline

◆ getInAllocaSRet()

bool clang::CodeGen::ABIArgInfo::getInAllocaSRet ( ) const
inline

Return true if this field of an inalloca struct should be returned to implement a struct return calling convention.

Definition at line 500 of file CGFunctionInfo.h.

References isInAlloca().

Referenced by clang::CodeGen::CodeGenFunction::EmitFunctionEpilog(), and clang::CodeGen::CodeGenTypes::GetFunctionType().

◆ getIndirect()

ABIArgInfo clang::CodeGen::ABIArgInfo::getIndirect ( CharUnits Alignment,
unsigned AddrSpace,
bool ByVal = true,
bool Realign = false,
llvm::Type * Padding = nullptr )
inlinestatic

◆ getIndirectAddrSpace()

unsigned clang::CodeGen::ABIArgInfo::getIndirectAddrSpace ( ) const
inline

◆ getIndirectAliased()

ABIArgInfo clang::CodeGen::ABIArgInfo::getIndirectAliased ( CharUnits Alignment,
unsigned AddrSpace,
bool Realign = false,
llvm::Type * Padding = nullptr )
inlinestatic

Pass this in memory using the IR byref attribute.

Definition at line 228 of file CGFunctionInfo.h.

References ABIArgInfo(), and IndirectAliased.

◆ getIndirectAlign()

◆ getIndirectByVal()

bool clang::CodeGen::ABIArgInfo::getIndirectByVal ( ) const
inline

◆ getIndirectInReg()

ABIArgInfo clang::CodeGen::ABIArgInfo::getIndirectInReg ( CharUnits Alignment,
bool ByVal = true,
bool Realign = false )
inlinestatic

Definition at line 239 of file CGFunctionInfo.h.

References ABIArgInfo(), and getIndirect().

Referenced by clang::CodeGen::ABIInfo::getNaturalAlignIndirectInReg().

◆ getIndirectRealign()

bool clang::CodeGen::ABIArgInfo::getIndirectRealign ( ) const
inline

◆ getInReg()

◆ getKind()

◆ getNoExtend()

ABIArgInfo clang::CodeGen::ABIArgInfo::getNoExtend ( llvm::IntegerType * T)
inlinestatic

Definition at line 197 of file CGFunctionInfo.h.

References ABIArgInfo(), Extend, and clang::T.

◆ getPaddingInReg()

bool clang::CodeGen::ABIArgInfo::getPaddingInReg ( ) const
inline

◆ getPaddingType()

llvm::Type * clang::CodeGen::ABIArgInfo::getPaddingType ( ) const
inline

◆ getSignExtend()

ABIArgInfo clang::CodeGen::ABIArgInfo::getSignExtend ( QualType Ty,
llvm::Type * T = nullptr )
inlinestatic

Definition at line 165 of file CGFunctionInfo.h.

References ABIArgInfo(), Extend, clang::Type::isIntegralOrEnumerationType(), and clang::T.

Referenced by getExtend().

◆ getTargetSpecific()

ABIArgInfo clang::CodeGen::ABIArgInfo::getTargetSpecific ( llvm::Type * T = nullptr,
unsigned Offset = 0,
llvm::Type * Padding = nullptr,
bool CanBeFlattened = true,
unsigned Align = 0 )
inlinestatic

Definition at line 299 of file CGFunctionInfo.h.

References ABIArgInfo(), clang::T, and TargetSpecific.

◆ getUnpaddedCoerceAndExpandType()

◆ getZeroExtend()

ABIArgInfo clang::CodeGen::ABIArgInfo::getZeroExtend ( QualType Ty,
llvm::Type * T = nullptr )
inlinestatic

Definition at line 176 of file CGFunctionInfo.h.

References ABIArgInfo(), Extend, clang::Type::isIntegralOrEnumerationType(), and clang::T.

Referenced by getExtend().

◆ isCoerceAndExpand()

bool clang::CodeGen::ABIArgInfo::isCoerceAndExpand ( ) const
inline

◆ isDirect()

◆ isExpand()

bool clang::CodeGen::ABIArgInfo::isExpand ( ) const
inline

Definition at line 325 of file CGFunctionInfo.h.

References Expand.

◆ isExtend()

◆ isIgnore()

bool clang::CodeGen::ABIArgInfo::isIgnore ( ) const
inline

Definition at line 322 of file CGFunctionInfo.h.

References Ignore.

◆ isInAlloca()

◆ isIndirect()

◆ isIndirectAliased()

◆ isNoExt()

bool clang::CodeGen::ABIArgInfo::isNoExt ( ) const
inline

Definition at line 375 of file CGFunctionInfo.h.

References isExtend().

Referenced by DetermineNoUndef().

◆ isPaddingForCoerceAndExpand()

bool clang::CodeGen::ABIArgInfo::isPaddingForCoerceAndExpand ( llvm::Type * eltType)
inlinestatic

◆ isSignExt()

bool clang::CodeGen::ABIArgInfo::isSignExt ( ) const
inline

Definition at line 357 of file CGFunctionInfo.h.

References isExtend().

Referenced by clang::CodeGen::CodeGenModule::ConstructAttributeList().

◆ isSRetAfterThis()

bool clang::CodeGen::ABIArgInfo::isSRetAfterThis ( ) const
inline

◆ isTargetSpecific()

bool clang::CodeGen::ABIArgInfo::isTargetSpecific ( ) const
inline

◆ isZeroExt()

bool clang::CodeGen::ABIArgInfo::isZeroExt ( ) const
inline

Definition at line 366 of file CGFunctionInfo.h.

References isExtend().

Referenced by clang::CodeGen::CodeGenModule::ConstructAttributeList().

◆ setCanBeFlattened()

void clang::CodeGen::ABIArgInfo::setCanBeFlattened ( bool Flatten)
inline

Definition at line 515 of file CGFunctionInfo.h.

References isDirect(), and isTargetSpecific().

◆ setCoerceToType()

void clang::CodeGen::ABIArgInfo::setCoerceToType ( llvm::Type * T)
inline

◆ setDirectAlign()

void clang::CodeGen::ABIArgInfo::setDirectAlign ( unsigned Align)
inline

Definition at line 351 of file CGFunctionInfo.h.

References DirectAttr, isDirect(), isExtend(), and isTargetSpecific().

◆ setDirectOffset()

void clang::CodeGen::ABIArgInfo::setDirectOffset ( unsigned Offset)
inline

Definition at line 340 of file CGFunctionInfo.h.

References DirectAttr, isDirect(), isExtend(), and isTargetSpecific().

◆ setInAllocaFieldIndex()

void clang::CodeGen::ABIArgInfo::setInAllocaFieldIndex ( unsigned FieldIndex)
inline

Definition at line 484 of file CGFunctionInfo.h.

References AllocaFieldIndex, and isInAlloca().

◆ setInAllocaIndirect()

void clang::CodeGen::ABIArgInfo::setInAllocaIndirect ( bool Indirect)
inline

Definition at line 493 of file CGFunctionInfo.h.

References Indirect, and isInAlloca().

◆ setInAllocaSRet()

void clang::CodeGen::ABIArgInfo::setInAllocaSRet ( bool SRet)
inline

Definition at line 505 of file CGFunctionInfo.h.

References isInAlloca().

◆ setIndirectAddrSpace()

void clang::CodeGen::ABIArgInfo::setIndirectAddrSpace ( unsigned AddrSpace)
inline

Definition at line 457 of file CGFunctionInfo.h.

References IndirectAttr, isIndirect(), and isIndirectAliased().

◆ setIndirectAlign()

void clang::CodeGen::ABIArgInfo::setIndirectAlign ( CharUnits IA)
inline

◆ setIndirectByVal()

void clang::CodeGen::ABIArgInfo::setIndirectByVal ( bool IBV)
inline

Definition at line 447 of file CGFunctionInfo.h.

References isIndirect().

◆ setIndirectRealign()

void clang::CodeGen::ABIArgInfo::setIndirectRealign ( bool IR)
inline

Definition at line 466 of file CGFunctionInfo.h.

References isIndirect(), and isIndirectAliased().

◆ setInReg()

void clang::CodeGen::ABIArgInfo::setInReg ( bool IR)
inline

Definition at line 427 of file CGFunctionInfo.h.

References isDirect(), isExtend(), isIndirect(), and isTargetSpecific().

◆ setPaddingInReg()

void clang::CodeGen::ABIArgInfo::setPaddingInReg ( bool PIR)
inline

Definition at line 387 of file CGFunctionInfo.h.

◆ setSignExt()

void clang::CodeGen::ABIArgInfo::setSignExt ( bool SExt)
inline

Definition at line 361 of file CGFunctionInfo.h.

References isExtend().

◆ setSRetAfterThis()

void clang::CodeGen::ABIArgInfo::setSRetAfterThis ( bool AfterThis)
inline

Definition at line 475 of file CGFunctionInfo.h.

References isIndirect().

◆ setZeroExt()

void clang::CodeGen::ABIArgInfo::setZeroExt ( bool ZExt)
inline

Definition at line 370 of file CGFunctionInfo.h.

References isExtend().

Member Data Documentation

◆ AllocaFieldIndex

unsigned clang::CodeGen::ABIArgInfo::AllocaFieldIndex

Definition at line 112 of file CGFunctionInfo.h.

Referenced by getInAllocaFieldIndex(), and setInAllocaFieldIndex().

◆ DirectAttr

DirectAttrInfo clang::CodeGen::ABIArgInfo::DirectAttr

◆ IndirectAttr

IndirectAttrInfo clang::CodeGen::ABIArgInfo::IndirectAttr

◆ PaddingType

llvm::Type* clang::CodeGen::ABIArgInfo::PaddingType

Definition at line 98 of file CGFunctionInfo.h.

Referenced by ABIArgInfo(), and getPaddingType().

◆ UnpaddedCoerceAndExpandType

llvm::Type* clang::CodeGen::ABIArgInfo::UnpaddedCoerceAndExpandType

The documentation for this class was generated from the following files: