On x86 favors folding short immediate into some arithmetic operations (e.g. add,...
[oota-llvm.git] / include / llvm / Value.h
index f9edba116b5fcbe0a48febf21f9ad098b7735dca..ee7e25ac76a7aae45bbc949e3a94fb39fa6fcbdf 100644 (file)
@@ -228,11 +228,20 @@ public:
 
   /// 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) {
@@ -244,11 +253,6 @@ inline raw_ostream &operator<<(raw_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;
@@ -285,7 +289,8 @@ template <> inline bool isa_impl<GlobalAlias, Value>(const Value &Val) {
   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