LLVM API Documentation
LLVM Argument representation. More...
#include <Argument.h>
Public Member Functions | |
Argument (Type *Ty, const Twine &Name="", Function *F=nullptr) | |
Constructor. | |
const Function * | getParent () const |
Function * | getParent () |
unsigned | getArgNo () const |
Return the index of this formal argument in its containing function. | |
bool | hasNonNullAttr () const |
Return true if this argument has the nonnull attribute on it in its containing function. Also returns true if at least one byte is known to be dereferenceable and the pointer is in addrspace(0). | |
uint64_t | getDereferenceableBytes () const |
If this argument has the dereferenceable attribute on it in its containing function, return the number of bytes known to be dereferenceable. Otherwise, zero is returned. | |
bool | hasByValAttr () const |
Return true if this argument has the byval attribute on it in its containing function. | |
bool | hasByValOrInAllocaAttr () const |
Return true if this argument has the byval attribute or inalloca attribute on it in its containing function. These attributes both represent arguments being passed by value. | |
unsigned | getParamAlignment () const |
If this is a byval or inalloca argument, return its alignment. | |
bool | hasNestAttr () const |
Return true if this argument has the nest attribute on it in its containing function. | |
bool | hasNoAliasAttr () const |
Return true if this argument has the noalias attribute on it in its containing function. | |
bool | hasNoCaptureAttr () const |
Return true if this argument has the nocapture attribute on it in its containing function. | |
bool | hasStructRetAttr () const |
Return true if this argument has the sret attribute on it in its containing function. | |
bool | hasReturnedAttr () const |
Return true if this argument has the returned attribute on it in its containing function. | |
bool | onlyReadsMemory () const |
Return true if this argument has the readonly or readnone attribute on it in its containing function. | |
bool | hasInAllocaAttr () const |
Return true if this argument has the inalloca attribute on it in its containing function. | |
bool | hasZExtAttr () const |
Return true if this argument has the zext attribute on it in its containing function. | |
bool | hasSExtAttr () const |
Return true if this argument has the sext attribute on it in its containing function. | |
void | addAttr (AttributeSet AS) |
Add a Attribute to an argument. | |
void | removeAttr (AttributeSet AS) |
Remove a Attribute from an argument. | |
Static Public Member Functions | |
static bool | classof (const Value *V) |
Method for support type inquiry through isa, cast, and dyn_cast. | |
Friends | |
class | SymbolTableListTraits< Argument, Function > |
LLVM Argument representation.
This class represents an incoming formal argument to a Function. A formal argument, since it is ``formal'', does not contain an actual value but instead represents the type, argument number, and attributes of an argument for a specific function. When used in the body of said function, the argument of course represents the value of the actual argument that the function was called with.
Definition at line 35 of file Argument.h.
Argument::Argument | ( | Type * | Ty, |
const Twine & | Name = "" , |
||
Function * | F = nullptr |
||
) | [explicit] |
Constructor.
If F
is specified, the argument is inserted at the end of the argument list for F
.
Definition at line 45 of file Function.cpp.
References llvm::LeakDetector::addGarbageObject(), llvm::Function::getArgumentList(), llvm::iplist< NodeTy, Traits >::push_back(), and llvm::Value::setName().
void Argument::addAttr | ( | AttributeSet | AS | ) |
Add a Attribute to an argument.
addAttr - Add attributes to an argument.
Definition at line 193 of file Function.cpp.
References llvm::Function::addAttributes(), getArgNo(), llvm::Function::getContext(), llvm::AttributeSet::getNumSlots(), getParent(), and llvm::AttributeSet::getSlotIndex().
Referenced by LLVMAddAttribute(), and LLVMSetParamAlignment().
static bool llvm::Argument::classof | ( | const Value * | V | ) | [inline, static] |
Method for support type inquiry through isa, cast, and dyn_cast.
Definition at line 124 of file Argument.h.
References llvm::Value::ArgumentVal, and llvm::Value::getValueID().
unsigned Argument::getArgNo | ( | ) | const |
Return the index of this formal argument in its containing function.
For example in "void foo(int a, float b)" a is 0 and b is 1.
getArgNo - Return the index of this formal argument in its containing function. For example in "void foo(int a, float b)" a is 0 and b is 1.
Definition at line 67 of file Function.cpp.
References llvm::Function::arg_begin(), F(), and getParent().
Referenced by addAttr(), AllCallersPassInValidPointerForArgument(), getDereferenceableBytes(), getParamAlignment(), hasByValAttr(), hasByValOrInAllocaAttr(), hasInAllocaAttr(), hasNestAttr(), hasNoAliasAttr(), hasNoCaptureAttr(), hasNonNullAttr(), hasReturnedAttr(), hasSExtAttr(), hasZExtAttr(), LLVMAddAttribute(), LLVMGetAttribute(), LLVMRemoveAttribute(), LLVMSetParamAlignment(), onlyReadsMemory(), and removeAttr().
uint64_t Argument::getDereferenceableBytes | ( | ) | const |
If this argument has the dereferenceable attribute on it in its containing function, return the number of bytes known to be dereferenceable. Otherwise, zero is returned.
Definition at line 122 of file Function.cpp.
References getArgNo(), llvm::Function::getDereferenceableBytes(), getParent(), and llvm::Value::getType().
Referenced by hasNonNullAttr().
unsigned Argument::getParamAlignment | ( | ) | const |
If this is a byval or inalloca argument, return its alignment.
Definition at line 116 of file Function.cpp.
References getArgNo(), llvm::Function::getParamAlignment(), getParent(), and llvm::Value::getType().
Referenced by llvm::ObjectSizeOffsetVisitor::visitArgument().
const Function* llvm::Argument::getParent | ( | ) | const [inline] |
Definition at line 49 of file Argument.h.
Referenced by addAttr(), AllCallersPassInValidPointerForArgument(), getArgNo(), getDereferenceableBytes(), getParamAlignment(), hasByValAttr(), hasByValOrInAllocaAttr(), hasInAllocaAttr(), hasNestAttr(), hasNoAliasAttr(), hasNoCaptureAttr(), hasNonNullAttr(), hasReturnedAttr(), hasSExtAttr(), hasStructRetAttr(), hasZExtAttr(), isOnlyUsedInEntryBlock(), LLVMGetAttribute(), LLVMGetNextParam(), LLVMGetPreviousParam(), onlyReadsMemory(), and removeAttr().
Function* llvm::Argument::getParent | ( | ) | [inline] |
Definition at line 50 of file Argument.h.
bool Argument::hasByValAttr | ( | ) | const |
Return true if this argument has the byval attribute on it in its containing function.
hasByValAttr - Return true if this argument has the byval attribute on it in its containing function.
Definition at line 95 of file Function.cpp.
References llvm::Attribute::ByVal, getArgNo(), llvm::Function::getAttributes(), getParent(), and llvm::Value::getType().
bool Argument::hasByValOrInAllocaAttr | ( | ) | const |
Return true if this argument has the byval attribute or inalloca attribute on it in its containing function. These attributes both represent arguments being passed by value.
Definition at line 109 of file Function.cpp.
References llvm::Attribute::ByVal, getArgNo(), llvm::Function::getAttributes(), getParent(), llvm::Value::getType(), llvm::AttributeSet::hasAttribute(), and llvm::Attribute::InAlloca.
Referenced by llvm::ObjectSizeOffsetVisitor::visitArgument().
bool Argument::hasInAllocaAttr | ( | ) | const |
Return true if this argument has the inalloca attribute on it in its containing function.
Definition at line 103 of file Function.cpp.
References getArgNo(), llvm::Function::getAttributes(), getParent(), llvm::Value::getType(), and llvm::Attribute::InAlloca.
Referenced by determinePointerReadAttrs().
bool Argument::hasNestAttr | ( | ) | const |
Return true if this argument has the nest attribute on it in its containing function.
hasNestAttr - Return true if this argument has the nest attribute on it in its containing function.
Definition at line 130 of file Function.cpp.
References getArgNo(), llvm::Function::getAttributes(), getParent(), llvm::Value::getType(), and llvm::Attribute::Nest.
bool Argument::hasNoAliasAttr | ( | ) | const |
Return true if this argument has the noalias attribute on it in its containing function.
hasNoAliasAttr - Return true if this argument has the noalias attribute on it in its containing function.
Definition at line 138 of file Function.cpp.
References getArgNo(), llvm::Function::getAttributes(), getParent(), llvm::Value::getType(), and llvm::Attribute::NoAlias.
bool Argument::hasNoCaptureAttr | ( | ) | const |
Return true if this argument has the nocapture attribute on it in its containing function.
hasNoCaptureAttr - Return true if this argument has the nocapture attribute on it in its containing function.
Definition at line 146 of file Function.cpp.
References getArgNo(), llvm::Function::getAttributes(), getParent(), llvm::Value::getType(), and llvm::Attribute::NoCapture.
bool Argument::hasNonNullAttr | ( | ) | const |
Return true if this argument has the nonnull attribute on it in its containing function. Also returns true if at least one byte is known to be dereferenceable and the pointer is in addrspace(0).
hasNonNullAttr - Return true if this argument has the nonnull attribute on it in its containing function. Also returns true if at least one byte is known to be dereferenceable and the pointer is in addrspace(0).
Definition at line 82 of file Function.cpp.
References getArgNo(), llvm::Intrinsic::getAttributes(), getDereferenceableBytes(), getParent(), llvm::Value::getType(), and llvm::Attribute::NonNull.
bool Argument::hasReturnedAttr | ( | ) | const |
Return true if this argument has the returned attribute on it in its containing function.
hasReturnedAttr - Return true if this argument has the returned attribute on it in its containing function.
Definition at line 164 of file Function.cpp.
References getArgNo(), llvm::Function::getAttributes(), getParent(), and llvm::Attribute::Returned.
bool Argument::hasSExtAttr | ( | ) | const |
Return true if this argument has the sext attribute on it in its containing function.
hasSExtAttr Return true if this argument has the sext attribute on it in its containing function.
Definition at line 178 of file Function.cpp.
References getArgNo(), llvm::Function::getAttributes(), getParent(), and llvm::Attribute::SExt.
bool Argument::hasStructRetAttr | ( | ) | const |
Return true if this argument has the sret attribute on it in its containing function.
hasSRetAttr - Return true if this argument has the sret attribute on it in its containing function.
Definition at line 154 of file Function.cpp.
References llvm::Function::getAttributes(), getParent(), llvm::Value::getType(), and llvm::Attribute::StructRet.
bool Argument::hasZExtAttr | ( | ) | const |
Return true if this argument has the zext attribute on it in its containing function.
hasZExtAttr - Return true if this argument has the zext attribute on it in its containing function.
Definition at line 171 of file Function.cpp.
References getArgNo(), llvm::Function::getAttributes(), getParent(), and llvm::Attribute::ZExt.
bool Argument::onlyReadsMemory | ( | ) | const |
Return true if this argument has the readonly or readnone attribute on it in its containing function.
Definition at line 185 of file Function.cpp.
References getArgNo(), llvm::Function::getAttributes(), getParent(), llvm::Attribute::ReadNone, and llvm::Attribute::ReadOnly.
void Argument::removeAttr | ( | AttributeSet | AS | ) |
Remove a Attribute from an argument.
removeAttr - Remove attributes from an argument.
Definition at line 203 of file Function.cpp.
References getArgNo(), llvm::Function::getContext(), llvm::AttributeSet::getNumSlots(), getParent(), llvm::AttributeSet::getSlotIndex(), and llvm::Function::removeAttributes().
Referenced by LLVMRemoveAttribute().
friend class SymbolTableListTraits< Argument, Function > [friend] |
Definition at line 39 of file Argument.h.