/// stripPointerCasts - This method strips off any unneeded pointer
/// casts from the specified value, returning the original uncasted value.
- /// Note that the returned value is guaranteed to have pointer type.
+ /// Note that the returned value has pointer type if the specified value does.
Value *stripPointerCasts();
const Value *stripPointerCasts() const {
return const_cast<Value*>(this)->stripPointerCasts();
}
+
+ /// getUnderlyingObject - This method strips off any GEP address adjustments
+ /// and pointer casts from the specified value, returning the original object
+ /// being addressed. Note that the returned value has pointer type if the
+ /// specified value does.
+ Value *getUnderlyingObject();
+ const Value *getUnderlyingObject() const {
+ return const_cast<Value*>(this)->getUnderlyingObject();
+ }
};
inline std::ostream &operator<<(std::ostream &OS, const Value &V) {
return OS;
}
-void Use::init(Value *V, User *) {
- Val = V;
- if (V) V->addUse(*this);
-}
-
void Use::set(Value *V) {
if (Val) removeFromList();
Val = V;
return Val.getValueID() == Value::GlobalAliasVal;
}
template <> inline bool isa_impl<GlobalValue, Value>(const Value &Val) {
- return isa<GlobalVariable>(Val) || isa<Function>(Val) || isa<GlobalAlias>(Val);
+ return isa<GlobalVariable>(Val) || isa<Function>(Val) ||
+ isa<GlobalAlias>(Val);
}
} // End llvm namespace