|
LLVM
4.0.0
|
LLVM Argument representation. More...
#include <Argument.h>
Public Member Functions | |
| Argument (Type *Ty, const Twine &Name="", Function *F=nullptr) | |
| Constructor. More... | |
| const Function * | getParent () const |
| Function * | getParent () |
| unsigned | getArgNo () const |
| Return the index of this formal argument in its containing function. More... | |
| bool | hasNonNullAttr () const |
| Return true if this argument has the nonnull attribute on it in its containing function. More... | |
| 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. More... | |
| uint64_t | getDereferenceableOrNullBytes () const |
| If this argument has the dereferenceable_or_null attribute on it in its containing function, return the number of bytes known to be dereferenceable. More... | |
| bool | hasByValAttr () const |
| Return true if this argument has the byval attribute on it in its containing function. More... | |
| bool | hasSwiftSelfAttr () const |
| Return true if this argument has the swiftself attribute. More... | |
| bool | hasSwiftErrorAttr () const |
| Return true if this argument has the swifterror attribute. More... | |
| bool | hasByValOrInAllocaAttr () const |
| Return true if this argument has the byval attribute or inalloca attribute on it in its containing function. More... | |
| unsigned | getParamAlignment () const |
| If this is a byval or inalloca 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... | |
| bool | hasInAllocaAttr () const |
| Return true if this argument has the inalloca attribute on it in its containing function. More... | |
| bool | hasZExtAttr () const |
| Return true if this argument has the zext attribute on it in its containing function. More... | |
| bool | hasSExtAttr () const |
| Return true if this argument has the sext attribute on it in its containing function. More... | |
| void | addAttr (AttributeSet AS) |
| Add a Attribute to an argument. More... | |
| void | addAttr (Attribute::AttrKind Kind) |
| void | removeAttr (AttributeSet AS) |
| Remove a Attribute from an argument. More... | |
| void | removeAttr (Attribute::AttrKind Kind) |
| bool | hasAttribute (Attribute::AttrKind Kind) const |
| Checks if an argument has a given attribute. More... | |
Public Member Functions inherited from llvm::Value | |
| Value (const Value &)=delete | |
| void | operator= (const Value &)=delete |
| virtual | ~Value () |
| void | dump () const |
| Support for debugging, callable in GDB: V->dump() More... | |
| Type * | getType () const |
| All values are typed, get the type of this value. More... | |
| LLVMContext & | getContext () const |
| All values hold a context through their type. More... | |
| bool | hasName () const |
| ValueName * | getValueName () const |
| void | setValueName (ValueName *VN) |
| StringRef | getName () const |
| Return a constant reference to the value's name. More... | |
| void | setName (const Twine &Name) |
| Change the name of the value. More... | |
| void | takeName (Value *V) |
| Transfer the name from V to this value. More... | |
| void | replaceAllUsesWith (Value *V) |
| Change all uses of this to point to a new Value. More... | |
| void | replaceNonMetadataUsesWith (Value *V) |
| Change non-metadata uses of this to point to a new Value. More... | |
| void | replaceUsesOutsideBlock (Value *V, BasicBlock *BB) |
| replaceUsesOutsideBlock - Go through the uses list for this definition and make each use point to "V" instead of "this" when the use is outside the block. More... | |
| void | assertModuleIsMaterialized () const |
| bool | use_empty () const |
| use_iterator | materialized_use_begin () |
| const_use_iterator | materialized_use_begin () const |
| use_iterator | use_begin () |
| const_use_iterator | use_begin () const |
| use_iterator | use_end () |
| const_use_iterator | use_end () const |
| iterator_range< use_iterator > | materialized_uses () |
| iterator_range < const_use_iterator > | materialized_uses () const |
| iterator_range< use_iterator > | uses () |
| iterator_range < const_use_iterator > | uses () const |
| bool | user_empty () const |
| user_iterator | materialized_user_begin () |
| const_user_iterator | materialized_user_begin () const |
| user_iterator | user_begin () |
| const_user_iterator | user_begin () const |
| user_iterator | user_end () |
| const_user_iterator | user_end () const |
| User * | user_back () |
| const User * | user_back () const |
| iterator_range< user_iterator > | materialized_users () |
| iterator_range < const_user_iterator > | materialized_users () const |
| iterator_range< user_iterator > | users () |
| iterator_range < const_user_iterator > | users () const |
| bool | hasOneUse () const |
| Return true if there is exactly one user of this value. More... | |
| bool | hasNUses (unsigned N) const |
| Return true if this Value has exactly N users. More... | |
| bool | hasNUsesOrMore (unsigned N) const |
| Return true if this value has N users or more. More... | |
| bool | isUsedInBasicBlock (const BasicBlock *BB) const |
| Check if this value is used in the specified basic block. More... | |
| unsigned | getNumUses () const |
| This method computes the number of uses of this Value. More... | |
| void | addUse (Use &U) |
| This method should only be used by the Use class. More... | |
| unsigned | getValueID () const |
| Return an ID for the concrete type of this object. More... | |
| unsigned | getRawSubclassOptionalData () const |
| Return the raw optional flags value contained in this value. More... | |
| void | clearSubclassOptionalData () |
| Clear the optional flags contained in this value. More... | |
| bool | hasSameSubclassOptionalData (const Value *V) const |
| Check the optional flags for equality. More... | |
| bool | hasValueHandle () const |
| Return true if there is a value handle associated with this value. More... | |
| bool | isUsedByMetadata () const |
| Return true if there is metadata referencing this value. More... | |
| bool | isSwiftError () const |
| Return true if this value is a swifterror value. More... | |
| Value * | stripPointerCasts () |
| Strip off pointer casts, all-zero GEPs, and aliases. More... | |
| const Value * | stripPointerCasts () const |
| Value * | stripPointerCastsNoFollowAliases () |
| Strip off pointer casts and all-zero GEPs. More... | |
| const Value * | stripPointerCastsNoFollowAliases () const |
| Value * | stripInBoundsConstantOffsets () |
| Strip off pointer casts and all-constant inbounds GEPs. More... | |
| const Value * | stripInBoundsConstantOffsets () const |
| Value * | stripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) |
| Accumulate offsets from stripInBoundsConstantOffsets(). More... | |
| const Value * | stripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) const |
| Value * | stripInBoundsOffsets () |
| Strip off pointer casts and inbounds GEPs. More... | |
| const Value * | stripInBoundsOffsets () const |
| unsigned | getPointerDereferenceableBytes (const DataLayout &DL, bool &CanBeNull) const |
| Returns the number of bytes known to be dereferenceable for the pointer value. More... | |
| unsigned | getPointerAlignment (const DataLayout &DL) const |
| Returns an alignment of the pointer value. More... | |
| Value * | DoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) |
| Translate PHI node to its predecessor from the given basic block. More... | |
| const Value * | DoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) const |
| void | mutateType (Type *Ty) |
| Mutate the type of this Value to be of the specified type. More... | |
| template<class Compare > | |
| void | sortUseList (Compare Cmp) |
| Sort the use-list. More... | |
| void | reverseUseList () |
| Reverse the use-list. More... | |
| void | print (raw_ostream &O, bool IsForDebug=false) const |
| Implement operator<< on Value. More... | |
| void | print (raw_ostream &O, ModuleSlotTracker &MST, bool IsForDebug=false) const |
| void | printAsOperand (raw_ostream &O, bool PrintType=true, const Module *M=nullptr) const |
| Print the name of this Value out to the specified raw_ostream. More... | |
| void | printAsOperand (raw_ostream &O, bool PrintType, ModuleSlotTracker &MST) const |
Public Member Functions inherited from llvm::ilist_node_impl< ilist_detail::compute_node_options< Argument, Options...>::type > | |
| self_iterator | getIterator () |
| const_self_iterator | getIterator () const |
| reverse_self_iterator | getReverseIterator () |
| const_reverse_self_iterator | getReverseIterator () const |
| bool | isSentinel () const |
| Check whether this is the sentinel node. 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 > |
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 34 of file Argument.h.
Constructor.
If F is specified, the argument is inserted at the end of the argument list for F.
Definition at line 42 of file Function.cpp.
References llvm::Function::getArgumentList(), llvm::iplist_impl< IntrusiveListT, TraitsT >::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 188 of file Function.cpp.
References llvm::Function::addAttributes(), assert(), B, getArgNo(), llvm::Function::getContext(), llvm::AttributeSet::getNumSlots(), getParent(), and llvm::AttributeSet::getSlotIndex().
Referenced by addArgumentAttrs(), addAttr(), and LLVMSetParamAlignment().
|
inline |
Definition at line 129 of file Argument.h.
References addAttr(), getArgNo(), and llvm::Value::getContext().
Method for support type inquiry through isa, cast, and dyn_cast.
Definition at line 145 of file Argument.h.
References llvm::Value::getValueID().
| unsigned Argument::getArgNo | ( | ) | const |
Return the index of this formal argument in its containing function.
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 57 of file Function.cpp.
References llvm::Function::arg_begin(), assert(), F, and getParent().
Referenced by addArgumentAttrs(), addAttr(), AllCallersPassInValidPointerForArgument(), getDereferenceableBytes(), getDereferenceableOrNullBytes(), getParamAlignment(), hasAttribute(), hasByValOrInAllocaAttr(), hasNonNullAttr(), hasSwiftErrorAttr(), hasSwiftSelfAttr(), isArgPassedInSGPR(), 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 120 of file Function.cpp.
References assert(), getArgNo(), llvm::Function::getDereferenceableBytes(), getParent(), and llvm::Value::getType().
Referenced by hasNonNullAttr().
| uint64_t Argument::getDereferenceableOrNullBytes | ( | ) | const |
If this argument has the dereferenceable_or_null attribute on it in its containing function, return the number of bytes known to be dereferenceable.
Otherwise, zero is returned.
Definition at line 126 of file Function.cpp.
References assert(), getArgNo(), llvm::Function::getDereferenceableOrNullBytes(), getParent(), and llvm::Value::getType().
| unsigned Argument::getParamAlignment | ( | ) | const |
If this is a byval or inalloca argument, return its alignment.
Definition at line 114 of file Function.cpp.
References assert(), getArgNo(), llvm::Function::getParamAlignment(), getParent(), and llvm::Value::getType().
Referenced by llvm::ObjectSizeOffsetVisitor::visitArgument().
Definition at line 48 of file Argument.h.
Referenced by addAttr(), AllCallersPassInValidPointerForArgument(), getArgNo(), getDereferenceableBytes(), getDereferenceableOrNullBytes(), getParamAlignment(), hasAttribute(), hasByValOrInAllocaAttr(), hasNonNullAttr(), hasSwiftErrorAttr(), hasSwiftSelfAttr(), isArgPassedInSGPR(), isOnlyUsedInEntryBlock(), isSafeToPromoteArgument(), LLVMGetNextParam(), LLVMGetPreviousParam(), onlyReadsMemory(), and removeAttr().
|
inline |
Definition at line 49 of file Argument.h.
| bool Argument::hasAttribute | ( | Attribute::AttrKind | Kind | ) | const |
Checks if an argument has a given attribute.
hasAttribute - Checks if an argument has a given attribute.
Definition at line 208 of file Function.cpp.
References getArgNo(), getParent(), and llvm::Function::hasAttribute().
Referenced by hasByValAttr(), hasInAllocaAttr(), hasNestAttr(), hasNoAliasAttr(), hasNoCaptureAttr(), hasNonNullAttr(), hasReturnedAttr(), hasSExtAttr(), hasStructRetAttr(), hasSwiftErrorAttr(), hasSwiftSelfAttr(), hasZExtAttr(), and onlyReadsMemory().
| 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 85 of file Function.cpp.
References llvm::Value::getType(), and hasAttribute().
Referenced by canPaddingBeAccessed().
| 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 107 of file Function.cpp.
References getArgNo(), llvm::Function::getAttributes(), getParent(), llvm::Value::getType(), and llvm::AttributeSet::hasAttribute().
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 102 of file Function.cpp.
References llvm::Value::getType(), and hasAttribute().
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 134 of file Function.cpp.
References llvm::Value::getType(), and hasAttribute().
| 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 141 of file Function.cpp.
References llvm::Value::getType(), hasAttribute(), and llvm::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 148 of file Function.cpp.
References llvm::Value::getType(), and hasAttribute().
Referenced by addArgumentAttrs().
| bool Argument::hasNonNullAttr | ( | ) | const |
Return true if this argument has the nonnull attribute on it in its containing function.
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 72 of file Function.cpp.
References getArgNo(), llvm::Intrinsic::getAttributes(), getDereferenceableBytes(), getParent(), llvm::Value::getType(), and hasAttribute().
| 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 162 of file Function.cpp.
References hasAttribute().
| 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 174 of file Function.cpp.
References hasAttribute().
| 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 155 of file Function.cpp.
References llvm::Value::getType(), and hasAttribute().
| bool Argument::hasSwiftErrorAttr | ( | ) | const |
Return true if this argument has the swifterror attribute.
Definition at line 95 of file Function.cpp.
References getArgNo(), llvm::Function::getAttributes(), getParent(), and hasAttribute().
Referenced by llvm::Value::isSwiftError().
| bool Argument::hasSwiftSelfAttr | ( | ) | const |
Return true if this argument has the swiftself attribute.
Definition at line 90 of file Function.cpp.
References getArgNo(), llvm::Function::getAttributes(), getParent(), and hasAttribute().
| 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 168 of file Function.cpp.
References hasAttribute().
| bool Argument::onlyReadsMemory | ( | ) | const |
Return true if this argument has the readonly or readnone attribute on it in its containing function.
Definition at line 180 of file Function.cpp.
References getArgNo(), llvm::Function::getAttributes(), getParent(), hasAttribute(), and AMDGPU::RuntimeMD::KernelArg::ReadOnly.
| void Argument::removeAttr | ( | AttributeSet | AS | ) |
Remove a Attribute from an argument.
removeAttr - Remove attributes from an argument.
Definition at line 198 of file Function.cpp.
References assert(), B, getArgNo(), llvm::Function::getContext(), llvm::AttributeSet::getNumSlots(), getParent(), llvm::AttributeSet::getSlotIndex(), and llvm::Function::removeAttributes().
Referenced by addArgumentAttrs(), and removeAttr().
|
inline |
Definition at line 136 of file Argument.h.
References getArgNo(), llvm::Value::getContext(), and removeAttr().
|
friend |
Definition at line 38 of file Argument.h.
1.8.6