|
LLVM
5.0.0
|
This class represents an incoming formal argument to a Function. More...
#include "llvm/IR/Argument.h"
Public Member Functions | |
| Argument (Type *Ty, const Twine &Name="", Function *F=nullptr, unsigned ArgNo=0) | |
| Argument 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. More... | |
| uint64_t | getDereferenceableBytes () const |
| If this argument has the dereferenceable attribute, return the number of bytes known to be dereferenceable. More... | |
| uint64_t | getDereferenceableOrNullBytes () const |
| If this argument has the dereferenceable_or_null attribute, return the number of bytes known to be dereferenceable. More... | |
| bool | hasByValAttr () const |
| Return true if this argument has the byval attribute. 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. 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. More... | |
| bool | hasNoAliasAttr () const |
| Return true if this argument has the noalias attribute. More... | |
| bool | hasNoCaptureAttr () const |
| Return true if this argument has the nocapture attribute. More... | |
| bool | hasStructRetAttr () const |
| Return true if this argument has the sret attribute. More... | |
| bool | hasReturnedAttr () const |
| Return true if this argument has the returned attribute. More... | |
| bool | onlyReadsMemory () const |
| Return true if this argument has the readonly or readnone attribute. More... | |
| bool | hasInAllocaAttr () const |
| Return true if this argument has the inalloca attribute. More... | |
| bool | hasZExtAttr () const |
| Return true if this argument has the zext attribute. More... | |
| bool | hasSExtAttr () const |
| Return true if this argument has the sext attribute. More... | |
| void | addAttrs (AttrBuilder &B) |
| Add attributes to an argument. More... | |
| void | addAttr (Attribute::AttrKind Kind) |
| void | addAttr (Attribute Attr) |
| void | removeAttr (Attribute::AttrKind Kind) |
| Remove attributes from an argument. More... | |
| bool | hasAttribute (Attribute::AttrKind Kind) const |
| Check if an argument has a given attribute. More... | |
Public Member Functions inherited from llvm::Value | |
| Value (const Value &)=delete | |
| Value & | operator= (const Value &)=delete |
| void | deleteValue () |
| Delete a pointer to a generic Value. More... | |
| 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 | assertModuleIsMaterializedImpl () const |
| 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... | |
| const Value * | stripPointerCasts () const |
| Strip off pointer casts, all-zero GEPs, and aliases. More... | |
| Value * | stripPointerCasts () |
| const Value * | stripPointerCastsAndBarriers () const |
| Strip off pointer casts, all-zero GEPs, aliases and barriers. More... | |
| Value * | stripPointerCastsAndBarriers () |
| const Value * | stripPointerCastsNoFollowAliases () const |
| Strip off pointer casts and all-zero GEPs. More... | |
| Value * | stripPointerCastsNoFollowAliases () |
| const Value * | stripInBoundsConstantOffsets () const |
| Strip off pointer casts and all-constant inbounds GEPs. More... | |
| Value * | stripInBoundsConstantOffsets () |
| const Value * | stripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) const |
| Accumulate offsets from stripInBoundsConstantOffsets(). More... | |
| Value * | stripAndAccumulateInBoundsConstantOffsets (const DataLayout &DL, APInt &Offset) |
| const Value * | stripInBoundsOffsets () const |
| Strip off pointer casts and inbounds GEPs. More... | |
| Value * | stripInBoundsOffsets () |
| 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... | |
| const Value * | DoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) const |
| Translate PHI node to its predecessor from the given basic block. More... | |
| Value * | DoPHITranslation (const BasicBlock *CurBB, const BasicBlock *PredBB) |
| 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 |
Static Public Member Functions | |
| static bool | classof (const Value *V) |
| Method for support type inquiry through isa, cast, and dyn_cast. More... | |
Friends | |
| class | Function |
Additional Inherited Members | |
Public Types inherited from llvm::Value | |
| enum | ValueTy |
| Concrete subclass of this. More... | |
| using | use_iterator = use_iterator_impl< Use > |
| using | const_use_iterator = use_iterator_impl< const Use > |
| using | user_iterator = user_iterator_impl< User > |
| using | const_user_iterator = user_iterator_impl< const User > |
Static Public Attributes inherited from llvm::Value | |
| static const unsigned | MaxAlignmentExponent = 29 |
| The maximum alignment for instructions. More... | |
| static const unsigned | MaximumAlignment = 1u << MaxAlignmentExponent |
Protected Types inherited from llvm::Value | |
| enum | : unsigned { NumUserOperandsBits = 28 } |
| The number of operands in the subclass. More... | |
Protected Member Functions inherited from llvm::Value | |
| Value (Type *Ty, unsigned scid) | |
| ~Value () | |
| Value's destructor should be virtual by design, but that would require that Value and all of its subclasses have a vtable that effectively duplicates the information in the value ID. More... | |
| unsigned short | getSubclassDataFromValue () const |
| void | setValueSubclassData (unsigned short D) |
Protected Attributes inherited from llvm::Value | |
| unsigned char | SubclassOptionalData: 7 |
| Hold subclass data that can be dropped. More... | |
| unsigned | NumUserOperands: NumUserOperandsBits |
| unsigned | IsUsedByMD: 1 |
| unsigned | HasName: 1 |
| unsigned | HasHungOffUses: 1 |
| unsigned | HasDescriptor: 1 |
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 30 of file Argument.h.
|
explicit |
Argument constructor.
Definition at line 69 of file Function.cpp.
References llvm::Value::setName().
| void Argument::addAttr | ( | Attribute::AttrKind | Kind | ) |
Definition at line 174 of file Function.cpp.
References llvm::Function::addParamAttr(), getArgNo(), and getParent().
Referenced by addArgumentAttrs(), and LLVMSetParamAlignment().
| void Argument::addAttr | ( | Attribute | Attr | ) |
Definition at line 178 of file Function.cpp.
References llvm::Function::addParamAttr(), getArgNo(), and getParent().
| void Argument::addAttrs | ( | AttrBuilder & | B | ) |
Add attributes to an argument.
Definition at line 168 of file Function.cpp.
References llvm::AttributeList::addParamAttributes(), B, getArgNo(), llvm::Function::getAttributes(), llvm::Function::getContext(), getParent(), and llvm::Function::setAttributes().
Method for support type inquiry through isa, cast, and dyn_cast.
Definition at line 123 of file Argument.h.
References llvm::Value::getValueID().
|
inline |
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 48 of file Argument.h.
References assert().
Referenced by addAttr(), addAttrs(), allCallersPassInValidPointerForArgument(), getDereferenceableBytes(), getDereferenceableOrNullBytes(), getParamAlignment(), hasAttribute(), hasByValOrInAllocaAttr(), hasNonNullAttr(), hasSwiftErrorAttr(), hasSwiftSelfAttr(), isArgPassedInSGPR(), LLVMGetNextParam(), LLVMGetPreviousParam(), onlyReadsMemory(), and removeAttr().
| uint64_t Argument::getDereferenceableBytes | ( | ) | const |
If this argument has the dereferenceable attribute, return the number of bytes known to be dereferenceable.
Otherwise, zero is returned.
Definition at line 118 of file Function.cpp.
References assert(), getArgNo(), llvm::Function::getParamDereferenceableBytes(), getParent(), and llvm::Value::getType().
Referenced by hasNonNullAttr().
| uint64_t Argument::getDereferenceableOrNullBytes | ( | ) | const |
If this argument has the dereferenceable_or_null attribute, return the number of bytes known to be dereferenceable.
Otherwise, zero is returned.
Definition at line 124 of file Function.cpp.
References assert(), getArgNo(), llvm::Function::getParamDereferenceableOrNullBytes(), getParent(), and llvm::Value::getType().
| unsigned Argument::getParamAlignment | ( | ) | const |
If this is a byval or inalloca argument, return its alignment.
Definition at line 113 of file Function.cpp.
References assert(), getArgNo(), llvm::Function::getParamAlignment(), getParent(), and llvm::Value::getType().
Referenced by llvm::ObjectSizeOffsetVisitor::visitArgument().
Definition at line 42 of file Argument.h.
Referenced by addAttr(), addAttrs(), allCallersPassInValidPointerForArgument(), getDereferenceableBytes(), getDereferenceableOrNullBytes(), getParamAlignment(), hasAttribute(), hasByValOrInAllocaAttr(), hasNonNullAttr(), hasSwiftErrorAttr(), hasSwiftSelfAttr(), isArgPassedInSGPR(), isOnlyUsedInEntryBlock(), isSafeToPromoteArgument(), LLVMGetNextParam(), LLVMGetPreviousParam(), onlyReadsMemory(), and removeAttr().
|
inline |
Definition at line 43 of file Argument.h.
| bool Argument::hasAttribute | ( | Attribute::AttrKind | Kind | ) | const |
Check if an argument has a given attribute.
Definition at line 186 of file Function.cpp.
References getArgNo(), getParent(), and llvm::Function::hasParamAttribute().
Referenced by hasByValAttr(), hasInAllocaAttr(), hasNestAttr(), hasNoAliasAttr(), hasNoCaptureAttr(), hasReturnedAttr(), hasSExtAttr(), hasStructRetAttr(), hasZExtAttr(), and llvm::HexagonEvaluator::HexagonEvaluator().
| bool Argument::hasByValAttr | ( | ) | const |
Return true if this argument has the byval attribute.
Definition at line 88 of file Function.cpp.
References llvm::Value::getType(), and hasAttribute().
Referenced by canPaddingBeAccessed(), and PropagateConstantsIntoArguments().
| bool Argument::hasByValOrInAllocaAttr | ( | ) | const |
Return true if this argument has the byval attribute or inalloca attribute.
These attributes represent arguments being passed by value.
Definition at line 106 of file Function.cpp.
References llvm::AMDGPU::CodeObject::Kernel::Key::Attrs, getArgNo(), llvm::Function::getAttributes(), getParent(), llvm::Value::getType(), and llvm::AttributeList::hasParamAttribute().
Referenced by llvm::ObjectSizeOffsetVisitor::visitArgument().
| bool Argument::hasInAllocaAttr | ( | ) | const |
Return true if this argument has the inalloca attribute.
Definition at line 101 of file Function.cpp.
References llvm::Value::getType(), and hasAttribute().
Referenced by determinePointerReadAttrs(), and PropagateConstantsIntoArguments().
| bool Argument::hasNestAttr | ( | ) | const |
Return true if this argument has the nest attribute.
Definition at line 130 of file Function.cpp.
References llvm::Value::getType(), and hasAttribute().
| bool Argument::hasNoAliasAttr | ( | ) | const |
Return true if this argument has the noalias attribute.
Definition at line 135 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.
Definition at line 140 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.
Also returns true if at least one byte is known to be dereferenceable and the pointer is in addrspace(0).
Definition at line 78 of file Function.cpp.
References getArgNo(), getDereferenceableBytes(), getParent(), and llvm::Value::getType().
| bool Argument::hasReturnedAttr | ( | ) | const |
Return true if this argument has the returned attribute.
Definition at line 150 of file Function.cpp.
References hasAttribute().
| bool Argument::hasSExtAttr | ( | ) | const |
Return true if this argument has the sext attribute.
Definition at line 158 of file Function.cpp.
References hasAttribute().
| bool Argument::hasStructRetAttr | ( | ) | const |
Return true if this argument has the sret attribute.
Definition at line 145 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 97 of file Function.cpp.
References getArgNo(), getParent(), and llvm::Function::hasParamAttribute().
Referenced by llvm::Value::isSwiftError().
| bool Argument::hasSwiftSelfAttr | ( | ) | const |
Return true if this argument has the swiftself attribute.
Definition at line 93 of file Function.cpp.
References getArgNo(), getParent(), and llvm::Function::hasParamAttribute().
| bool Argument::hasZExtAttr | ( | ) | const |
Return true if this argument has the zext attribute.
Definition at line 154 of file Function.cpp.
References hasAttribute().
| bool Argument::onlyReadsMemory | ( | ) | const |
Return true if this argument has the readonly or readnone attribute.
Definition at line 162 of file Function.cpp.
References llvm::AMDGPU::CodeObject::Kernel::Key::Attrs, getArgNo(), llvm::Function::getAttributes(), getParent(), and llvm::AttributeList::hasParamAttribute().
| void Argument::removeAttr | ( | Attribute::AttrKind | Kind | ) |
Remove attributes from an argument.
Definition at line 182 of file Function.cpp.
References getArgNo(), getParent(), and llvm::Function::removeParamAttr().
Referenced by addArgumentAttrs().
|
friend |
Definition at line 34 of file Argument.h.
1.8.6