Remove the burden of dealing with list offsets

from SymbolTableListTraits' clients, and
intead request a nice declarative interface.
Cleans up an IMHO ugly wart.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66331 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Gabor Greif
2009-03-07 10:00:35 +00:00
parent 922a881f32
commit b547a18100
4 changed files with 25 additions and 67 deletions
+3 -12
View File
@@ -48,7 +48,6 @@ template<> struct ilist_traits<Instruction>
static iplist<Instruction> &getList(BasicBlock *BB);
static ValueSymbolTable *getSymTab(BasicBlock *ItemParent);
static int getListOffset();
private:
mutable ilist_node<Instruction> Sentinel;
};
@@ -186,6 +185,9 @@ public:
///
const InstListType &getInstList() const { return InstList; }
InstListType &getInstList() { return InstList; }
static iplist<Instruction> BasicBlock::*getSublistAccess(Instruction*) {
return &BasicBlock::InstList;
}
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const BasicBlock *) { return true; }
@@ -224,19 +226,8 @@ public:
/// the basic block).
///
BasicBlock *splitBasicBlock(iterator I, const std::string &BBName = "");
static unsigned getInstListOffset() {
BasicBlock *Obj = 0;
return unsigned(reinterpret_cast<uintptr_t>(&Obj->InstList));
}
};
inline int
ilist_traits<Instruction>::getListOffset() {
return BasicBlock::getInstListOffset();
}
} // End llvm namespace
#endif