Override use_back in instruction/basicblock to provide more type information.
authorChris Lattner <sabre@nondot.org>
Sat, 30 Sep 2006 22:20:34 +0000 (22:20 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 30 Sep 2006 22:20:34 +0000 (22:20 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30678 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/BasicBlock.h
include/llvm/Instruction.h

index 551ca4d6c2ea8747c3ace703645d39d93905adb3..f15d2b46a91453ca2a2bfa3802afb623389a2586 100644 (file)
@@ -85,6 +85,11 @@ public:
         BasicBlock *getPrev()       { return Prev; }
   const BasicBlock *getPrev() const { return Prev; }
 
+  /// use_back - Specialize the methods defined in Value, as we know that an
+  /// BasicBlock can only be used by Instructions (specifically PHI and terms).
+  Instruction       *use_back()       { return cast<Instruction>(*use_begin());}
+  const Instruction *use_back() const { return cast<Instruction>(*use_begin());}
+  
   /// getTerminator() - If this is a well formed basic block, then this returns
   /// a pointer to the terminator instruction.  If it is not, then you get a
   /// null pointer back.
index cd024d09ea92b62a6e22ede663782c7ba1ab2734..591e0d2b889f20df77e1dc90a4089f23efceecd8 100644 (file)
@@ -71,7 +71,11 @@ public:
   /// extra information (e.g. load is volatile) agree.
   bool isIdenticalTo(Instruction *I) const;
 
-
+  /// use_back - Specialize the methods defined in Value, as we know that an
+  /// instruction can only be used by other instructions.
+  Instruction       *use_back()       { return cast<Instruction>(*use_begin());}
+  const Instruction *use_back() const { return cast<Instruction>(*use_begin());}
+  
   // Accessor methods...
   //
   inline const BasicBlock *getParent() const { return Parent; }