Lines Matching refs:Value
1 //===-- Value.cpp - Implement the Value class -----------------------------===//
10 // This file implements the Value, ValueHandle, and User classes.
14 #include "llvm/IR/Value.h"
40 // Value Class
43 assert(Ty && "Value defined with a null type: Error!");
47 Value::Value(Type *ty, unsigned scid)
63 Value::~Value() {
64 // Notify all ValueHandles (if present) that this value is going away.
71 // Check to make sure that there are no uses of this value that are still
72 // around when the value is destroyed. If there are, then we have a dangling
74 // the value is still being referenced.
82 assert(use_empty() && "Uses remain when a value is destroyed!");
84 // If this value is named, destroy the name. This should not be in a symtab
89 void Value::destroyValueName() {
96 bool Value::hasNUses(unsigned N) const {
104 bool Value::hasNUsesOrMore(unsigned N) const {
113 bool Value::isUsedInBasicBlock(const BasicBlock *BB) const {
115 // scanning the use list of this Value. Both lists can be very long, but
123 // Scan basic block: Check if this Value is used by the instruction at BI.
134 unsigned Value::getNumUses() const {
138 static bool getSymTab(Value *V, ValueSymbolTable *&ST) {
154 assert(isa<Constant>(V) && "Unknown value type!");
160 ValueName *Value::getValueName() const {
171 void Value::setValueName(ValueName *VN) {
188 StringRef Value::getName() const {
197 void Value::setNameImpl(const Twine &NewName) {
216 return; // Cannot set a name on this value (e.g. constant).
220 // Free the name for this value.
250 void Value::setName(const Twine &NewName) {
256 void Value::takeName(Value *V) {
258 // If this value has a name, drop it.
262 // We can't set a name on this value, but we need to clear V's name if
265 return; // Cannot set a name on this value (e.g. constant).
284 return; // Cannot set a name on this value (e.g. constant).
317 void Value::assertModuleIsMaterialized() const {
344 static bool contains(Value *Expr, Value *V) {
361 void Value::replaceAllUsesWith(Value *New) {
362 assert(New && "Value::replaceAllUsesWith(<null>) is invalid!");
366 "replaceAllUses of value with new value of different type!");
368 // Notify all ValueHandles (if present) that this value is going away.
394 void Value::replaceUsesOutsideBlock(Value *New, BasicBlock *BB) {
395 assert(New && "Value::replaceUsesOutsideBlock(<null>, BB) is invalid!");
399 "replaceUses of value with new value of different type!");
424 static Value *stripPointerCastsAndOffsets(Value *V) {
430 SmallPtrSet<Value *, 4> Visited;
468 Value *Value::stripPointerCasts() {
472 Value *Value::stripPointerCastsNoFollowAliases() {
476 Value *Value::stripInBoundsConstantOffsets() {
480 Value *Value::stripAndAccumulateInBoundsConstantOffsets(const DataLayout &DL,
491 SmallPtrSet<Value *, 4> Visited;
493 Value *V = this;
516 Value *Value::stripInBoundsOffsets() {
520 Value *Value::DoPHITranslation(const BasicBlock *CurBB,
528 LLVMContext &Value::getContext() const { return VTy->getContext(); }
530 void Value::reverseUseList() {
582 // If this value already has a ValueHandle, then it must be in the
585 assert(Entry && "Value doesn't have any handles?");
595 DenseMap<Value*, ValueHandleBase*> &Handles = pImpl->ValueHandles;
599 assert(!Entry && "Value really did already have handles?");
611 for (DenseMap<Value*, ValueHandleBase*>::iterator I = Handles.begin(),
638 DenseMap<Value*, ValueHandleBase*> &Handles = pImpl->ValueHandles;
646 void ValueHandleBase::ValueIsDeleted(Value *V) {
653 assert(Entry && "Value bit set but no entries exist");
658 // Note that we deliberately do not the support the case when dropping a value
659 // handle results in a new value handle being permanently added to the list
660 // (as might occur in theory for CallbackVH's): the new value handle will not
663 // value handles (it is fine to momentarily add then remove a value handle).
673 // Mark that this value has been deleted by setting it to an invalid Value
675 Entry->operator=(DenseMapInfo<Value *>::getTombstoneKey());
694 llvm_unreachable("An asserting value handle still pointed to this"
695 " value!");
703 void ValueHandleBase::ValueIsRAUWd(Value *Old, Value *New) {
705 assert(Old != New && "Changing value into itself!");
707 "replaceAllUses of value with new value of different type!");
714 assert(Entry && "Value bit set but no entries exist");
730 // Tracking goes to new value like a WeakVH. Note that this may make it
733 // the TrackingVH accessors guarantee that a client never sees this value.
737 // Weak goes to the new value, which will unlink it from Old's list.
748 // If any new tracking or weak value handles were added while processing the
758 llvm_unreachable("A tracking or weak value handle still pointed to the"
759 " old value!\n");