1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00

Another sentinel optimization. This one should always

be a win, since almost every interesting function has at least one Argument.

llvm-svn: 65778
This commit is contained in:
Gabor Greif 2009-03-01 17:13:15 +00:00
parent dc34b050a2
commit 3f56efbf04
2 changed files with 6 additions and 10 deletions

View File

@ -48,12 +48,15 @@ private:
template<> struct ilist_traits<Argument>
: public SymbolTableListTraits<Argument, Function> {
// createSentinel is used to create a node that marks the end of the list...
static Argument *createSentinel();
static void destroySentinel(Argument *A) { delete A; }
Argument *createSentinel() const {
return const_cast<Argument*>(static_cast<const Argument*>(&Sentinel));
}
static void destroySentinel(Argument*) {}
static iplist<Argument> &getList(Function *F);
static ValueSymbolTable *getSymTab(Function *ItemParent);
static int getListOffset();
private:
ilist_node<Argument> Sentinel;
};
class Function : public GlobalValue, public Annotable,

View File

@ -26,13 +26,6 @@ iplist<BasicBlock> &ilist_traits<BasicBlock>::getList(Function *F) {
return F->getBasicBlockList();
}
Argument *ilist_traits<Argument>::createSentinel() {
Argument *Ret = new Argument(Type::Int32Ty);
// This should not be garbage monitored.
LeakDetector::removeGarbageObject(Ret);
return Ret;
}
iplist<Argument> &ilist_traits<Argument>::getList(Function *F) {
return F->getArgumentList();
}