LLVM 24.0.0git
llvm::abi::ArgInfo Class Reference

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

#include "llvm/ABI/FunctionInfo.h"

Public Types

enum  Kind {
  Direct , Extend , Indirect , IndirectAliased ,
  Ignore , CoerceAndExpand
}

Public Member Functions

ArgInfo & setSignExt (bool SignExtend=true)
ArgInfo & setZeroExt (bool ZeroExtend=true)
ArgInfo & setCanBeFlattened (bool Flatten)
 See getCanBeFlattened.
Kind getKind () const
bool isDirect () const
bool isIndirect () const
bool isIndirectAliased () const
bool isIgnore () const
bool isExtend () const
bool isCoerceAndExpand () const
unsigned getDirectOffset () const
unsigned getNeededIntRegs () const
 How many integer and vector argument registers this argument occupies.
unsigned getNeededSseRegs () const
void setNeededRegs (unsigned IntRegs, unsigned SseRegs)
MaybeAlign getDirectAlign () const
Align getIndirectAlign () const
unsigned getIndirectAddrSpace () const
bool getIndirectByVal () const
bool getIndirectRealign () const
bool getCanBeFlattened () const
 Whether a Direct record coercion may be split into one wire argument per field.
bool isSignExt () const
bool isZeroExt () const
bool isNoExt () const
bool isConservative () const
 Whether the extension is conservative, i.e.
const Type * getCoerceToType () const
const Type * getUnpaddedCoerceAndExpandType () const

Static Public Member Functions

static ArgInfo getDirect (const Type *T=nullptr, unsigned Offset=0, MaybeAlign Align=std::nullopt, bool CanBeFlattened=true)
static ArgInfo getExtend (const Type *T)
static ArgInfo getConservativeExtend (const Type *T)
static ArgInfo getIndirect (Align Align, bool ByVal, unsigned AddrSpace=0, bool Realign=false)
 Realign: the caller couldn't guarantee sufficient alignment - the callee must copy the argument to a properly aligned temporary before use.
static ArgInfo getIndirectAliased (Align Align, unsigned AddrSpace, bool Realign=false)
 An aliased indirect argument.
static ArgInfo getIgnore ()
static ArgInfo getCoerceAndExpand (const Type *CoerceToType, const Type *UnpaddedCoerceToType)
static bool isPaddingForCoerceAndExpand (const Type *Ty)
 True if Ty is an array of i8, the padding element of a coerce-and-expand type.

Detailed Description

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

Definition at line 30 of file FunctionInfo.h.

Member Enumeration Documentation

◆ Kind

Enumerator
Direct 

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

Extend 

Valid only for integer argument types.

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

Indirect 

Pass the argument indirectly via a hidden pointer with the specified alignment and address space.

IndirectAliased 

Like Indirect, but the pointer may alias an object referenced elsewhere.

The callee must not modify it and never treats it as byval.

Ignore 

Ignore the argument (treat as void). Useful for void and empty structs.

CoerceAndExpand 

Only valid for aggregate argument types.

The value is expanded into one argument per non-padding element of CoerceToType. Arrays of i8 are assumed to be padding.

Definition at line 32 of file FunctionInfo.h.

Member Function Documentation

◆ getCanBeFlattened()

bool llvm::abi::ArgInfo::getCanBeFlattened ( ) const
inline

Whether a Direct record coercion may be split into one wire argument per field.

Mirrors clang::CodeGen::ABIArgInfo::CanBeFlattened.

Definition at line 258 of file FunctionInfo.h.

References assert(), and isDirect().

◆ getCoerceAndExpand()

ArgInfo llvm::abi::ArgInfo::getCoerceAndExpand ( const Type * CoerceToType,
const Type * UnpaddedCoerceToType )
inlinestatic
Parameters
CoerceToTypeAggregate type whose non-padding elements are the in-memory pieces of the value, in order. Padding elements are arrays of i8.
UnpaddedCoerceToTypeCoerceToType with padding elements removed. A single element is stored as that element; two or more are a packed record.

Definition at line 170 of file FunctionInfo.h.

References assert(), CoerceAndExpand, and llvm::isa().

◆ getCoerceToType()

const Type * llvm::abi::ArgInfo::getCoerceToType ( ) const
inline

Definition at line 286 of file FunctionInfo.h.

References assert(), isCoerceAndExpand(), isDirect(), and isExtend().

◆ getConservativeExtend()

ArgInfo llvm::abi::ArgInfo::getConservativeExtend ( const Type * T)
inlinestatic

Definition at line 133 of file FunctionInfo.h.

References getExtend(), and T.

◆ getDirect()

ArgInfo llvm::abi::ArgInfo::getDirect ( const Type * T = nullptr,
unsigned Offset = 0,
MaybeAlign Align = std::nullopt,
bool CanBeFlattened = true )
inlinestatic
Parameters
TThe type to coerce to. If null, the argument's original type is used directly.
OffsetByte offset into the memory representation at which the coerced type begins. Used when only part of a larger value is passed directly (e.g. the high word of a multi-eightbyte return value on x86-64).
AlignOverride for the argument's alignment. If absent, the default alignment for T is used.
CanBeFlattenedWhether a record coercion may be split into one wire argument per field. See getCanBeFlattened.

Definition at line 104 of file FunctionInfo.h.

References Direct, DirectAttr, llvm::Offset, and T.

Referenced by llvm::abi::DefaultTargetInfo::classifyArgumentType(), and llvm::abi::DefaultTargetInfo::classifyReturnType().

◆ getDirectAlign()

MaybeAlign llvm::abi::ArgInfo::getDirectAlign ( ) const
inline

Definition at line 228 of file FunctionInfo.h.

References assert(), isDirect(), and isExtend().

◆ getDirectOffset()

unsigned llvm::abi::ArgInfo::getDirectOffset ( ) const
inline

Definition at line 211 of file FunctionInfo.h.

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

◆ getExtend()

◆ getIgnore()

ArgInfo llvm::abi::ArgInfo::getIgnore ( )
inlinestatic

Definition at line 162 of file FunctionInfo.h.

References Ignore.

Referenced by llvm::abi::DefaultTargetInfo::classifyReturnType().

◆ getIndirect()

ArgInfo llvm::abi::ArgInfo::getIndirect ( Align Align,
bool ByVal,
unsigned AddrSpace = 0,
bool Realign = false )
inlinestatic

Realign: the caller couldn't guarantee sufficient alignment - the callee must copy the argument to a properly aligned temporary before use.

Definition at line 141 of file FunctionInfo.h.

References Indirect, and IndirectAttr.

Referenced by llvm::abi::TargetInfo::getNaturalAlignIndirect(), and llvm::abi::TargetInfo::maybeCommonClassifyReturnType().

◆ getIndirectAddrSpace()

unsigned llvm::abi::ArgInfo::getIndirectAddrSpace ( ) const
inline

Definition at line 240 of file FunctionInfo.h.

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

◆ getIndirectAliased()

ArgInfo llvm::abi::ArgInfo::getIndirectAliased ( Align Align,
unsigned AddrSpace,
bool Realign = false )
inlinestatic

An aliased indirect argument.

It carries an address space but no byval, since the pointer refers to an object the caller owns.

Definition at line 153 of file FunctionInfo.h.

References IndirectAliased, and IndirectAttr.

◆ getIndirectAlign()

Align llvm::abi::ArgInfo::getIndirectAlign ( ) const
inline

Definition at line 233 of file FunctionInfo.h.

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

◆ getIndirectByVal()

bool llvm::abi::ArgInfo::getIndirectByVal ( ) const
inline

Definition at line 245 of file FunctionInfo.h.

References assert(), and isIndirect().

◆ getIndirectRealign()

bool llvm::abi::ArgInfo::getIndirectRealign ( ) const
inline

Definition at line 251 of file FunctionInfo.h.

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

◆ getKind()

Kind llvm::abi::ArgInfo::getKind ( ) const
inline

Definition at line 203 of file FunctionInfo.h.

◆ getNeededIntRegs()

unsigned llvm::abi::ArgInfo::getNeededIntRegs ( ) const
inline

How many integer and vector argument registers this argument occupies.

Both zero means it occupies none and travels in memory, which is also what a target whose classifier does not record the demand reports.

Definition at line 219 of file FunctionInfo.h.

◆ getNeededSseRegs()

unsigned llvm::abi::ArgInfo::getNeededSseRegs ( ) const
inline

Definition at line 220 of file FunctionInfo.h.

◆ getUnpaddedCoerceAndExpandType()

const Type * llvm::abi::ArgInfo::getUnpaddedCoerceAndExpandType ( ) const
inline

Definition at line 292 of file FunctionInfo.h.

References assert(), and isCoerceAndExpand().

◆ isCoerceAndExpand()

bool llvm::abi::ArgInfo::isCoerceAndExpand ( ) const
inline

Definition at line 209 of file FunctionInfo.h.

References CoerceAndExpand.

Referenced by getCoerceToType(), and getUnpaddedCoerceAndExpandType().

◆ isConservative()

bool llvm::abi::ArgInfo::isConservative ( ) const
inline

Whether the extension is conservative, i.e.

the sender extends, but the receiver does not assume the extension. Currently only supported for arguments, i.e. caller extends, but callee does not assume extension.

Definition at line 281 of file FunctionInfo.h.

References assert(), and isExtend().

◆ isDirect()

bool llvm::abi::ArgInfo::isDirect ( ) const
inline

◆ isExtend()

bool llvm::abi::ArgInfo::isExtend ( ) const
inline

◆ isIgnore()

bool llvm::abi::ArgInfo::isIgnore ( ) const
inline

Definition at line 207 of file FunctionInfo.h.

References Ignore.

◆ isIndirect()

bool llvm::abi::ArgInfo::isIndirect ( ) const
inline

Definition at line 205 of file FunctionInfo.h.

References Indirect.

Referenced by getIndirectAddrSpace(), getIndirectAlign(), getIndirectByVal(), and getIndirectRealign().

◆ isIndirectAliased()

bool llvm::abi::ArgInfo::isIndirectAliased ( ) const
inline

Definition at line 206 of file FunctionInfo.h.

References IndirectAliased.

Referenced by getIndirectAddrSpace(), getIndirectAlign(), and getIndirectRealign().

◆ isNoExt()

bool llvm::abi::ArgInfo::isNoExt ( ) const
inline

Definition at line 273 of file FunctionInfo.h.

References assert(), and isExtend().

◆ isPaddingForCoerceAndExpand()

bool llvm::abi::ArgInfo::isPaddingForCoerceAndExpand ( const Type * Ty)
inlinestatic

True if Ty is an array of i8, the padding element of a coerce-and-expand type.

A matrix is an array in this type system and lowers to a vector, so it is not padding.

Definition at line 300 of file FunctionInfo.h.

References llvm::dyn_cast().

◆ isSignExt()

bool llvm::abi::ArgInfo::isSignExt ( ) const
inline

Definition at line 263 of file FunctionInfo.h.

References assert(), and isExtend().

◆ isZeroExt()

bool llvm::abi::ArgInfo::isZeroExt ( ) const
inline

Definition at line 268 of file FunctionInfo.h.

References assert(), and isExtend().

◆ setCanBeFlattened()

ArgInfo & llvm::abi::ArgInfo::setCanBeFlattened ( bool Flatten)
inline

See getCanBeFlattened.

Definition at line 197 of file FunctionInfo.h.

References assert(), and isDirect().

◆ setNeededRegs()

void llvm::abi::ArgInfo::setNeededRegs ( unsigned IntRegs,
unsigned SseRegs )
inline

Definition at line 222 of file FunctionInfo.h.

References assert(), and IntRegs.

◆ setSignExt()

ArgInfo & llvm::abi::ArgInfo::setSignExt ( bool SignExtend = true)
inline

Definition at line 182 of file FunctionInfo.h.

Referenced by getExtend().

◆ setZeroExt()

ArgInfo & llvm::abi::ArgInfo::setZeroExt ( bool ZeroExtend = true)
inline

Definition at line 189 of file FunctionInfo.h.

Referenced by getExtend().

Member Data Documentation

◆ DirectAttr

DirectAttrInfo llvm::abi::ArgInfo::DirectAttr

Definition at line 74 of file FunctionInfo.h.

Referenced by getDirect(), getDirectOffset(), and getExtend().

◆ IndirectAttr

IndirectAttrInfo llvm::abi::ArgInfo::IndirectAttr

Definition at line 75 of file FunctionInfo.h.

Referenced by getIndirect(), getIndirectAddrSpace(), and getIndirectAliased().


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