14#ifndef LLVM_ABI_FUNCTIONINFO_H
15#define LLVM_ABI_FUNCTIONINFO_H
47 const Type *CoercionType =
nullptr;
56 struct DirectAttrInfo {
60 struct IndirectAttrInfo {
72 bool IndirectByVal : 1;
73 bool IndirectRealign : 1;
77 IndirectRealign(
false) {}
98 assert(
T &&
"Type cannot be null");
99 assert(
T->isInteger() &&
"Unexpected type - only integers can be extended");
103 AI.Alignment = std::nullopt;
107 if (IntTy->isSigned())
118 bool Realign =
false) {
120 AI.Alignment =
Align;
122 AI.IndirectByVal = ByVal;
123 AI.IndirectRealign = Realign;
130 this->SignExt = SignExtend;
132 this->ZeroExt =
false;
137 this->ZeroExt = ZeroExtend;
139 this->SignExt =
false;
161 assert(Alignment.has_value() &&
162 "Indirect arguments must have an alignment");
173 return IndirectByVal;
178 return IndirectRealign;
193 return !SignExt && !ZeroExt;
212 const Type *ReturnType;
216 std::optional<unsigned> NumRequired;
219 std::optional<unsigned> NumRequired)
221 NumArgs(NumArguments), CC(CC), NumRequired(NumRequired) {}
229 void operator delete(
void *p) { ::operator
delete(p); }
240 std::optional<unsigned> NumRequired = std::nullopt);
263 assert(Index < NumArgs &&
"Invalid argument index");
268 assert(Index < NumArgs &&
"Invalid argument index");
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
This header defines support for implementing classes that have some trailing object (or arrays of obj...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
const T * getTrailingObjects() const
Helper class to encapsulate information about how a specific type should be passed to or returned fro...
static ArgInfo getDirect(const Type *T=nullptr, unsigned Offset=0, MaybeAlign Align=std::nullopt)
const Type * getCoerceToType() const
Align getIndirectAlign() const
DirectAttrInfo DirectAttr
ArgInfo & setZeroExt(bool ZeroExtend=true)
static ArgInfo getIgnore()
unsigned getIndirectAddrSpace() const
IndirectAttrInfo IndirectAttr
@ Extend
Valid only for integer argument types.
@ Direct
Pass the argument directly using the normal converted LLVM type, or by coercing to another specified ...
@ Ignore
Ignore the argument (treat as void). Useful for void and empty structs.
@ Indirect
Pass the argument indirectly via a hidden pointer with the specified alignment and address space.
static ArgInfo getExtend(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 ...
MaybeAlign getDirectAlign() const
bool getIndirectRealign() const
ArgInfo & setSignExt(bool SignExtend=true)
bool getIndirectByVal() const
unsigned getDirectOffset() const
ArrayRef< ArgEntry > arguments() const
unsigned getNumRequiredArgs() const
static FunctionInfo * create(CallingConv::ID CC, const Type *ReturnType, ArrayRef< const Type * > ArgTypes, std::optional< unsigned > NumRequired=std::nullopt)
const ArgInfo & getReturnInfo() const
const ArgEntry * const_arg_iterator
MutableArrayRef< ArgEntry > arguments()
CallingConv::ID getCallingConvention() const
ArgInfo & getReturnInfo()
const_arg_iterator arg_begin() const
const ArgEntry & getArgInfo(unsigned Index) const
friend class TrailingObjects
const_arg_iterator arg_end() const
unsigned arg_size() const
ArgEntry & getArgInfo(unsigned Index)
const Type * getReturnType() const
Represents the ABI-specific view of a type in LLVM.
This file defines the type system for the LLVMABI library, which mirrors ABI-relevant aspects of fron...
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
This struct is a compact representation of a valid (non-zero power of two) alignment.
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
ArgEntry(const Type *T, ArgInfo A)