LLVM API Documentation
A Use represents the edge between a Value definition and its users. More...
#include <Use.h>
Public Types | |
typedef PointerIntPair< User *, 1, unsigned > | UserRef |
Public Member Functions | |
void | swap (Use &RHS) |
Provide a fast substitute to std::swap<Use> that also works with less standard-compliant compilers. | |
operator Value * () const | |
Value * | get () const |
User * | getUser () const |
Returns the User that contains this Use. | |
void | set (Value *Val) |
Value * | operator= (Value *RHS) |
const Use & | operator= (const Use &RHS) |
Value * | operator-> () |
const Value * | operator-> () const |
Use * | getNext () const |
unsigned | getOperandNo () const |
Return the operand # of this use in its User. | |
Static Public Member Functions | |
static Use * | initTags (Use *Start, Use *Stop) |
Initializes the waymarking tags on an array of Uses. | |
static void | zap (Use *Start, const Use *Stop, bool del=false) |
Destroys Use operands when the number of operands of a User changes. | |
Friends | |
class | Value |
A Use represents the edge between a Value definition and its users.
This is notionally a two-dimensional linked list. It supports traversing all of the uses for a particular value definition. It also supports jumping directly to the used value when we arrive from the User's operands, and jumping directly to the User when we arrive from the Value's uses.
The pointer to the used Value is explicit, and the pointer to the User is implicit. The implicit pointer is found via a waymarking algorithm described in the programmer's manual:
http://www.llvm.org/docs/ProgrammersManual.html#the-waymarking-algorithm
This is essentially the single most memory intensive object in LLVM because of the number of uses in the system. At the same time, the constant time operations it allows are essential to many optimizations having reasonable time complexity.
typedef PointerIntPair<User *, 1, unsigned> llvm::Use::UserRef |
Value* llvm::Use::get | ( | ) | const [inline] |
Definition at line 95 of file Use.h.
Referenced by llvm::simplify_type< Use >::getSimplifiedValue(), llvm::simplify_type< const Use >::getSimplifiedValue(), and llvm::SSAUpdater::RewriteUse().
Use* llvm::Use::getNext | ( | ) | const [inline] |
unsigned llvm::Use::getOperandNo | ( | ) | const |
Return the operand # of this use in its User.
Definition at line 48 of file Use.cpp.
References getUser(), and llvm::User::op_begin().
User * llvm::Use::getUser | ( | ) | const |
Returns the User that contains this Use.
For an instruction operand, for example, this will return the instruction.
Definition at line 41 of file Use.cpp.
References llvm::PointerIntPair< PointerTy, IntBits, IntType, PtrTraits >::getInt(), and llvm::PointerIntPair< PointerTy, IntBits, IntType, PtrTraits >::getPointer().
Referenced by llvm::DominatorTree::dominates(), llvm::PHINode::getIncomingBlock(), getOperandNo(), llvm::IRBuilder< true, TargetFolder >::IRBuilder(), llvm::DominatorTree::isReachableFromEntry(), OptimizeGlobalAddressOfMalloc(), llvm::Value::replaceAllUsesWith(), llvm::SSAUpdater::RewriteUse(), llvm::SSAUpdater::RewriteUseAfterInsertions(), RewriteUsesOfClonedInstructions(), and llvm::IRBuilderBase::SetInsertPoint().
Use * llvm::Use::initTags | ( | Use * | Start, |
Use * | Stop | ||
) | [static] |
Initializes the waymarking tags on an array of Uses.
This sets up the array of Uses such that getUser() can find the User from any of those Uses.
Definition at line 57 of file Use.cpp.
Referenced by llvm::User::allocHungoffUses(), llvm::PHINode::allocHungoffUses(), and llvm::User::operator new().
void llvm::Use::set | ( | Value * | Val | ) | [inline] |
Definition at line 500 of file Value.h.
References llvm::Value::addUse().
Referenced by llvm::SwitchInst::removeCase(), llvm::IndirectBrInst::removeDestination(), llvm::Value::replaceAllUsesWith(), llvm::SSAUpdater::RewriteUse(), and llvm::SSAUpdater::RewriteUseAfterInsertions().
void llvm::Use::swap | ( | Use & | RHS | ) |
Provide a fast substitute to std::swap<Use> that also works with less standard-compliant compilers.
Definition at line 17 of file Use.cpp.
References llvm::Value::addUse().
Destroys Use operands when the number of operands of a User changes.
Definition at line 87 of file Use.cpp.
Referenced by llvm::User::dropHungoffUses(), and llvm::User::~User().