LLVM API Documentation

Public Member Functions | Static Public Member Functions | Friends
llvm::Argument Class Reference

LLVM Argument representation. More...

#include <Argument.h>

Inheritance diagram for llvm::Argument:
Inheritance graph
[legend]
Collaboration diagram for llvm::Argument:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Argument (Type *Ty, const Twine &Name="", Function *F=nullptr)
 Constructor.
const FunctiongetParent () const
FunctiongetParent ()
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.
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 >

Detailed Description

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.


Constructor & Destructor Documentation

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().


Member Function Documentation

Add a Attribute to an argument.

addAttr - Add attributes to an argument.

Definition at line 179 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 116 of file Argument.h.

References llvm::Value::ArgumentVal, and llvm::Value::getValueID().

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(), LLVMAddAttribute(), LLVMGetAttribute(), LLVMRemoveAttribute(), LLVMSetParamAlignment(), onlyReadsMemory(), and removeAttr().

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().

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().

Definition at line 50 of file Argument.h.

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().

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().

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().

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.

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.

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.

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.

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.

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.

Return true if this argument has the readonly or readnone attribute on it in its containing function.

Definition at line 171 of file Function.cpp.

References getArgNo(), llvm::Function::getAttributes(), getParent(), llvm::Attribute::ReadNone, and llvm::Attribute::ReadOnly.

Remove a Attribute from an argument.

removeAttr - Remove attributes from an argument.

Definition at line 189 of file Function.cpp.

References getArgNo(), llvm::Function::getContext(), llvm::AttributeSet::getNumSlots(), getParent(), llvm::AttributeSet::getSlotIndex(), and llvm::Function::removeAttributes().

Referenced by LLVMRemoveAttribute().


Friends And Related Function Documentation

friend class SymbolTableListTraits< Argument, Function > [friend]

Definition at line 39 of file Argument.h.


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