LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Friends | List of all members
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]

Public Member Functions

 Argument (Type *Ty, const Twine &Name="", Function *F=0)
 Constructor. More...
 
const FunctiongetParent () const
 
FunctiongetParent ()
 
unsigned getArgNo () const
 Return the index of this formal argument in its containing function. More...
 
bool hasByValAttr () const
 Return true if this argument has the byval attribute on it in its containing function. More...
 
unsigned getParamAlignment () const
 If this is a byval argument, return its alignment. More...
 
bool hasNestAttr () const
 Return true if this argument has the nest attribute on it in its containing function. More...
 
bool hasNoAliasAttr () const
 Return true if this argument has the noalias attribute on it in its containing function. More...
 
bool hasNoCaptureAttr () const
 Return true if this argument has the nocapture attribute on it in its containing function. More...
 
bool hasStructRetAttr () const
 Return true if this argument has the sret attribute on it in its containing function. More...
 
bool hasReturnedAttr () const
 Return true if this argument has the returned attribute on it in its containing function. More...
 
bool onlyReadsMemory () const
 Return true if this argument has the readonly or readnone attribute on it in its containing function. More...
 
void addAttr (AttributeSet AS)
 Add a Attribute to an argument. More...
 
void removeAttr (AttributeSet AS)
 Remove a Attribute from an argument. More...
 
- Public Member Functions inherited from llvm::Value
virtual ~Value ()
 
void dump () const
 dump - Support for debugging, callable in GDB: V->dump() More...
 
void print (raw_ostream &O, AssemblyAnnotationWriter *AAW=0) const
 
TypegetType () const
 
LLVMContextgetContext () const
 All values hold a context through their type. More...
 
bool hasName () const
 
ValueNamegetValueName () const
 
void setValueName (ValueName *VN)
 
StringRef getName () const
 
void setName (const Twine &Name)
 
void takeName (Value *V)
 
void replaceAllUsesWith (Value *V)
 
bool use_empty () const
 
use_iterator use_begin ()
 
const_use_iterator use_begin () const
 
use_iterator use_end ()
 
const_use_iterator use_end () const
 
Useruse_back ()
 
const Useruse_back () const
 
bool hasOneUse () const
 
bool hasNUses (unsigned N) const
 
bool hasNUsesOrMore (unsigned N) const
 
bool isUsedInBasicBlock (const BasicBlock *BB) const
 
unsigned getNumUses () const
 
void addUse (Use &U)
 
unsigned getValueID () const
 
unsigned getRawSubclassOptionalData () const
 
void clearSubclassOptionalData ()
 
bool hasSameSubclassOptionalData (const Value *V) const
 
void intersectOptionalDataWith (const Value *V)
 
bool hasValueHandle () const
 
ValuestripPointerCasts ()
 Strips off any unneeded pointer casts, all-zero GEPs and aliases from the specified value, returning the original uncasted value. More...
 
const ValuestripPointerCasts () const
 
ValuestripPointerCastsNoFollowAliases ()
 Strips off any unneeded pointer casts and all-zero GEPs from the specified value, returning the original uncasted value. More...
 
const ValuestripPointerCastsNoFollowAliases () const
 
ValuestripInBoundsConstantOffsets ()
 Strips off unneeded pointer casts and all-constant GEPs from the specified value, returning the original pointer value. More...
 
const ValuestripInBoundsConstantOffsets () const
 
ValuestripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset)
 Strips like stripInBoundsConstantOffsets but also accumulates the constant offset stripped. More...
 
const ValuestripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) const
 
ValuestripInBoundsOffsets ()
 Strips off unneeded pointer casts and any in-bounds offsets from the specified value, returning the original pointer value. More...
 
const ValuestripInBoundsOffsets () const
 
bool isDereferenceablePointer () const
 
ValueDoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB)
 
const ValueDoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) const
 
void mutateType (Type *Ty)
 
- Public Member Functions inherited from llvm::ilist_node< Argument >
ArgumentgetPrevNode ()
 Get the previous node, or 0 for the list head. More...
 
const ArgumentgetPrevNode () const
 Get the previous node, or 0 for the list head. More...
 
ArgumentgetNextNode ()
 Get the next node, or 0 for the list tail. More...
 
const ArgumentgetNextNode () const
 Get the next node, or 0 for the list tail. More...
 

Static Public Member Functions

static bool classof (const Value *V)
 Method for support type inquiry through isa, cast, and dyn_cast. More...
 

Friends

class SymbolTableListTraits< Argument, Function >
 

Additional Inherited Members

- Public Types inherited from llvm::Value
enum  ValueTy {
  ArgumentVal, BasicBlockVal, FunctionVal, GlobalAliasVal,
  GlobalVariableVal, UndefValueVal, BlockAddressVal, ConstantExprVal,
  ConstantAggregateZeroVal, ConstantDataArrayVal, ConstantDataVectorVal, ConstantIntVal,
  ConstantFPVal, ConstantArrayVal, ConstantStructVal, ConstantVectorVal,
  ConstantPointerNullVal, MDNodeVal, MDStringVal, InlineAsmVal,
  PseudoSourceValueVal, FixedStackPseudoSourceValueVal, InstructionVal, ConstantFirstVal = FunctionVal,
  ConstantLastVal = ConstantPointerNullVal
}
 
typedef value_use_iterator< Useruse_iterator
 
typedef value_use_iterator
< const User
const_use_iterator
 
- Static Public Attributes inherited from llvm::Value
static const unsigned MaximumAlignment = 1u << 29
 
- Protected Member Functions inherited from llvm::Value
virtual void printCustom (raw_ostream &O) const
 
 Value (Type *Ty, unsigned scid)
 
unsigned short getSubclassDataFromValue () const
 
void setValueSubclassData (unsigned short D)
 
- Protected Member Functions inherited from llvm::ilist_node< Argument >
 ilist_node ()
 
- Protected Attributes inherited from llvm::Value
unsigned char SubclassOptionalData: 7
 

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 = 0 
)
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

void Argument::addAttr ( AttributeSet  AS)

Add a Attribute to an argument.

addAttr - Add attributes to an argument.

Definition at line 144 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)
inlinestatic

Method for support type inquiry through isa, cast, and dyn_cast.

Definition at line 98 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(), getParamAlignment(), hasByValAttr(), hasNestAttr(), hasNoAliasAttr(), hasNoCaptureAttr(), hasReturnedAttr(), LLVMAddAttribute(), LLVMGetAttribute(), LLVMRemoveAttribute(), LLVMSetParamAlignment(), onlyReadsMemory(), and removeAttr().

unsigned Argument::getParamAlignment ( ) const

If this is a byval argument, return its alignment.

Definition at line 87 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
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 81 of file Function.cpp.

References llvm::Attribute::ByVal, getArgNo(), llvm::Function::getAttributes(), getParent(), and llvm::Value::getType().

Referenced by llvm::ObjectSizeOffsetVisitor::visitArgument().

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 95 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 103 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 111 of file Function.cpp.

References getArgNo(), llvm::Function::getAttributes(), getParent(), llvm::Value::getType(), and llvm::Attribute::NoCapture.

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 129 of file Function.cpp.

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

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 119 of file Function.cpp.

References llvm::Function::getAttributes(), getParent(), llvm::Value::getType(), and llvm::Attribute::StructRet.

bool Argument::onlyReadsMemory ( ) const

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

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

Definition at line 136 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 154 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: