summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2009-03-07 10:49:57 +0000
committerGabor Greif <ggreif@gmail.com>2009-03-07 10:49:57 +0000
commit6e1ca84d2cfc5bd9277eca636039f82d1754b580 (patch)
tree107b5d969b91b769c1c0f48b976abbee0c93c3d1
parent5cd1b2582298e595c2bda2938d8d2745590a8cc0 (diff)
downloadbcm5719-llvm-6e1ca84d2cfc5bd9277eca636039f82d1754b580.tar.gz
bcm5719-llvm-6e1ca84d2cfc5bd9277eca636039f82d1754b580.zip
further simplifications arising from peruse of the more declarative interface
llvm-svn: 66333
-rw-r--r--llvm/include/llvm/BasicBlock.h1
-rw-r--r--llvm/include/llvm/Function.h2
-rw-r--r--llvm/include/llvm/Module.h3
-rw-r--r--llvm/include/llvm/SymbolTableListTraits.h6
-rw-r--r--llvm/lib/VMCore/BasicBlock.cpp4
-rw-r--r--llvm/lib/VMCore/Function.cpp7
-rw-r--r--llvm/lib/VMCore/Module.cpp10
7 files changed, 5 insertions, 28 deletions
diff --git a/llvm/include/llvm/BasicBlock.h b/llvm/include/llvm/BasicBlock.h
index 0d40909f004..0de71008e76 100644
--- a/llvm/include/llvm/BasicBlock.h
+++ b/llvm/include/llvm/BasicBlock.h
@@ -46,7 +46,6 @@ template<> struct ilist_traits<Instruction>
Instruction *ensureHead(Instruction*) const { return createSentinel(); }
static void noteHead(Instruction*, Instruction*) {}
- static iplist<Instruction> &getList(BasicBlock *BB);
static ValueSymbolTable *getSymTab(BasicBlock *ItemParent);
private:
mutable ilist_node<Instruction> Sentinel;
diff --git a/llvm/include/llvm/Function.h b/llvm/include/llvm/Function.h
index ff0b066a5e5..ccc006cfcfb 100644
--- a/llvm/include/llvm/Function.h
+++ b/llvm/include/llvm/Function.h
@@ -43,7 +43,6 @@ template<> struct ilist_traits<BasicBlock>
BasicBlock *ensureHead(BasicBlock*) const { return createSentinel(); }
static void noteHead(BasicBlock*, BasicBlock*) {}
- static iplist<BasicBlock> &getList(Function *F);
static ValueSymbolTable *getSymTab(Function *ItemParent);
private:
mutable ilist_node<BasicBlock> Sentinel;
@@ -61,7 +60,6 @@ template<> struct ilist_traits<Argument>
Argument *ensureHead(Argument*) const { return createSentinel(); }
static void noteHead(Argument*, Argument*) {}
- static iplist<Argument> &getList(Function *F);
static ValueSymbolTable *getSymTab(Function *ItemParent);
private:
mutable ilist_node<Argument> Sentinel;
diff --git a/llvm/include/llvm/Module.h b/llvm/include/llvm/Module.h
index d706615ac71..2564ddc5da0 100644
--- a/llvm/include/llvm/Module.h
+++ b/llvm/include/llvm/Module.h
@@ -31,7 +31,6 @@ template<> struct ilist_traits<Function>
// createSentinel is used to create a node that marks the end of the list.
static Function *createSentinel();
static void destroySentinel(Function *F) { delete F; }
- static iplist<Function> &getList(Module *M);
static inline ValueSymbolTable *getSymTab(Module *M);
};
template<> struct ilist_traits<GlobalVariable>
@@ -39,7 +38,6 @@ template<> struct ilist_traits<GlobalVariable>
// createSentinel is used to create a node that marks the end of the list.
static GlobalVariable *createSentinel();
static void destroySentinel(GlobalVariable *GV) { delete GV; }
- static iplist<GlobalVariable> &getList(Module *M);
static inline ValueSymbolTable *getSymTab(Module *M);
};
template<> struct ilist_traits<GlobalAlias>
@@ -47,7 +45,6 @@ template<> struct ilist_traits<GlobalAlias>
// createSentinel is used to create a node that marks the end of the list.
static GlobalAlias *createSentinel();
static void destroySentinel(GlobalAlias *GA) { delete GA; }
- static iplist<GlobalAlias> &getList(Module *M);
static inline ValueSymbolTable *getSymTab(Module *M);
};
diff --git a/llvm/include/llvm/SymbolTableListTraits.h b/llvm/include/llvm/SymbolTableListTraits.h
index b5ec20de600..44f64dc57f0 100644
--- a/llvm/include/llvm/SymbolTableListTraits.h
+++ b/llvm/include/llvm/SymbolTableListTraits.h
@@ -46,7 +46,7 @@ public:
/// of instructions, it returns the BasicBlock that owns them.
ItemParentClass *getListOwner() {
typedef iplist<ValueSubClass> ItemParentClass::*Sublist;
- Sublist Sub(ItemParentClass::
+ Sublist Sub(ItemParentClass::
getSublistAccess(static_cast<ValueSubClass*>(0)));
size_t Offset(size_t(&((ItemParentClass*)0->*Sub)));
iplist<ValueSubClass>* Anchor(static_cast<iplist<ValueSubClass>*>(this));
@@ -54,6 +54,10 @@ public:
Offset);
}
+ static iplist<ValueSubClass> &getList(ItemParentClass *Par) {
+ return Par->*(Par->getSublistAccess((ValueSubClass*)0));
+}
+
void addNodeToList(ValueSubClass *V);
void removeNodeFromList(ValueSubClass *V);
void transferNodesFromList(ilist_traits<ValueSubClass> &L2,
diff --git a/llvm/lib/VMCore/BasicBlock.cpp b/llvm/lib/VMCore/BasicBlock.cpp
index 66ee99d1745..f68223155dc 100644
--- a/llvm/lib/VMCore/BasicBlock.cpp
+++ b/llvm/lib/VMCore/BasicBlock.cpp
@@ -31,10 +31,6 @@ ilist_traits<Instruction>::getSymTab(BasicBlock *BB) {
return 0;
}
-iplist<Instruction> &ilist_traits<Instruction>::getList(BasicBlock *BB) {
- return BB->getInstList();
-}
-
// Explicit instantiation of SymbolTableListTraits since some of the methods
// are not in the public header file...
template class SymbolTableListTraits<Instruction, BasicBlock>;
diff --git a/llvm/lib/VMCore/Function.cpp b/llvm/lib/VMCore/Function.cpp
index 258158f801e..3a991f62d84 100644
--- a/llvm/lib/VMCore/Function.cpp
+++ b/llvm/lib/VMCore/Function.cpp
@@ -22,13 +22,6 @@
#include "llvm/ADT/StringExtras.h"
using namespace llvm;
-iplist<BasicBlock> &ilist_traits<BasicBlock>::getList(Function *F) {
- return F->getBasicBlockList();
-}
-
-iplist<Argument> &ilist_traits<Argument>::getList(Function *F) {
- return F->getArgumentList();
-}
// Explicit instantiations of SymbolTableListTraits since some of the methods
// are not in the public header file...
diff --git a/llvm/lib/VMCore/Module.cpp b/llvm/lib/VMCore/Module.cpp
index 47233aea682..25d297a03e3 100644
--- a/llvm/lib/VMCore/Module.cpp
+++ b/llvm/lib/VMCore/Module.cpp
@@ -52,16 +52,6 @@ GlobalAlias *ilist_traits<GlobalAlias>::createSentinel() {
return Ret;
}
-iplist<Function> &ilist_traits<Function>::getList(Module *M) {
- return M->getFunctionList();
-}
-iplist<GlobalVariable> &ilist_traits<GlobalVariable>::getList(Module *M) {
- return M->getGlobalList();
-}
-iplist<GlobalAlias> &ilist_traits<GlobalAlias>::getList(Module *M) {
- return M->getAliasList();
-}
-
// Explicit instantiations of SymbolTableListTraits since some of the methods
// are not in the public header file.
template class SymbolTableListTraits<GlobalVariable, Module>;
OpenPOWER on IntegriCloud