On x86 favors folding short immediate into some arithmetic operations (e.g. add,...
[oota-llvm.git] / include / llvm / Value.h
index 1d2c61ea1991a48126b4a697c3ef93bede232a6a..ee7e25ac76a7aae45bbc949e3a94fb39fa6fcbdf 100644 (file)
@@ -165,7 +165,7 @@ public:
   ///
   bool hasNUsesOrMore(unsigned N) const;
 
-  bool isUsedInBasicBlock(BasicBlock *BB) const;
+  bool isUsedInBasicBlock(const BasicBlock *BB) const;
 
   /// getNumUses - This method computes the number of uses of this Value.  This
   /// is a linear time operation.  Use hasOneUse, hasNUses, or hasMoreThanNUses
@@ -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