The (negative) offset from a SymbolTableListTraits-using ilist to its container
[oota-llvm.git] / include / llvm / BasicBlock.h
index 8cc450c127d1b8820b858a0090e6b309861fd6bd..0a22f44b985bc3420543b61d758084b90ae7c571 100644 (file)
@@ -31,6 +31,7 @@ template<> struct ilist_traits<Instruction>
   static void destroySentinel(Instruction *I) { delete I; }
   static iplist<Instruction> &getList(BasicBlock *BB);
   static ValueSymbolTable *getSymTab(BasicBlock *ItemParent);
+  static int getListOffset();
 };
 
 /// This represents a single basic block in LLVM. A basic block is simply a
@@ -194,8 +195,19 @@ public:
   /// the basic block).
   ///
   BasicBlock *splitBasicBlock(iterator I, const std::string &BBName = "");
+  
+  
+  static unsigned getInstListOffset() {
+    BasicBlock *Obj = 0;
+    return reinterpret_cast<unsigned>(&Obj->InstList);
+  }
 };
 
+inline int 
+ilist_traits<Instruction>::getListOffset() {
+  return BasicBlock::getInstListOffset();
+}
+
 } // End llvm namespace
 
 #endif