[llvm] r249469 - IR: Remove unnecessary specialization of getSymTab(), NFC
Duncan P. N. Exon Smith via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 6 14:31:07 PDT 2015
Author: dexonsmith
Date: Tue Oct 6 16:31:07 2015
New Revision: 249469
URL: http://llvm.org/viewvc/llvm-project?rev=249469&view=rev
Log:
IR: Remove unnecessary specialization of getSymTab(), NFC
The only specializations of `getSymTab()` were identical to the default
defined in `SymbolTableListTraits::getSymTab()`. Remove the
specializations, and stop treating it like a configuration point. Just
to be sure no one else accesses this, make it private.
Modified:
llvm/trunk/include/llvm/IR/BasicBlock.h
llvm/trunk/include/llvm/IR/Function.h
llvm/trunk/include/llvm/IR/SymbolTableListTraits.h
llvm/trunk/lib/IR/SymbolTableListTraitsImpl.h
Modified: llvm/trunk/include/llvm/IR/BasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/BasicBlock.h?rev=249469&r1=249468&r2=249469&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/BasicBlock.h (original)
+++ llvm/trunk/include/llvm/IR/BasicBlock.h Tue Oct 6 16:31:07 2015
@@ -40,8 +40,6 @@ template<> struct ilist_traits<BasicBloc
BasicBlock *provideInitialHead() const { return createSentinel(); }
BasicBlock *ensureHead(BasicBlock*) const { return createSentinel(); }
static void noteHead(BasicBlock*, BasicBlock*) {}
-
- static ValueSymbolTable *getSymTab(Function *ItemParent);
private:
mutable ilist_half_node<BasicBlock> Sentinel;
};
Modified: llvm/trunk/include/llvm/IR/Function.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Function.h?rev=249469&r1=249468&r2=249469&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Function.h (original)
+++ llvm/trunk/include/llvm/IR/Function.h Tue Oct 6 16:31:07 2015
@@ -46,8 +46,6 @@ template<> struct ilist_traits<Argument>
Argument *ensureHead(Argument*) const { return createSentinel(); }
static void noteHead(Argument*, Argument*) {}
- static ValueSymbolTable *getSymTab(Function *ItemParent);
-
private:
mutable ilist_half_node<Argument> Sentinel;
};
@@ -626,16 +624,6 @@ private:
void clearMetadata();
};
-inline ValueSymbolTable *
-ilist_traits<BasicBlock>::getSymTab(Function *F) {
- return F ? &F->getValueSymbolTable() : nullptr;
-}
-
-inline ValueSymbolTable *
-ilist_traits<Argument>::getSymTab(Function *F) {
- return F ? &F->getValueSymbolTable() : nullptr;
-}
-
template <>
struct OperandTraits<Function> : public OptionalOperandTraits<Function> {};
Modified: llvm/trunk/include/llvm/IR/SymbolTableListTraits.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/SymbolTableListTraits.h?rev=249469&r1=249468&r2=249469&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/SymbolTableListTraits.h (original)
+++ llvm/trunk/include/llvm/IR/SymbolTableListTraits.h Tue Oct 6 16:31:07 2015
@@ -58,10 +58,12 @@ public:
return Par->*(Par->getSublistAccess((ValueSubClass*)nullptr));
}
+private:
static ValueSymbolTable *getSymTab(ItemParentClass *Par) {
return Par ? toPtr(Par->getValueSymbolTable()) : nullptr;
}
+public:
void addNodeToList(ValueSubClass *V);
void removeNodeFromList(ValueSubClass *V);
void transferNodesFromList(ilist_traits<ValueSubClass> &L2,
Modified: llvm/trunk/lib/IR/SymbolTableListTraitsImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/SymbolTableListTraitsImpl.h?rev=249469&r1=249468&r2=249469&view=diff
==============================================================================
--- llvm/trunk/lib/IR/SymbolTableListTraitsImpl.h (original)
+++ llvm/trunk/lib/IR/SymbolTableListTraitsImpl.h Tue Oct 6 16:31:07 2015
@@ -29,13 +29,13 @@ template<typename TPtr>
void SymbolTableListTraits<ValueSubClass,ItemParentClass>
::setSymTabObject(TPtr *Dest, TPtr Src) {
// Get the old symtab and value list before doing the assignment.
- ValueSymbolTable *OldST = TraitsClass::getSymTab(getListOwner());
+ ValueSymbolTable *OldST = getSymTab(getListOwner());
// Do it.
*Dest = Src;
// Get the new SymTab object.
- ValueSymbolTable *NewST = TraitsClass::getSymTab(getListOwner());
+ ValueSymbolTable *NewST = getSymTab(getListOwner());
// If there is nothing to do, quick exit.
if (OldST == NewST) return;
@@ -69,7 +69,7 @@ void SymbolTableListTraits<ValueSubClass
ItemParentClass *Owner = getListOwner();
V->setParent(Owner);
if (V->hasName())
- if (ValueSymbolTable *ST = TraitsClass::getSymTab(Owner))
+ if (ValueSymbolTable *ST = getSymTab(Owner))
ST->reinsertValue(V);
}
@@ -78,7 +78,7 @@ void SymbolTableListTraits<ValueSubClass
::removeNodeFromList(ValueSubClass *V) {
V->setParent(nullptr);
if (V->hasName())
- if (ValueSymbolTable *ST = TraitsClass::getSymTab(getListOwner()))
+ if (ValueSymbolTable *ST = getSymTab(getListOwner()))
ST->removeValueName(V->getValueName());
}
@@ -93,8 +93,8 @@ void SymbolTableListTraits<ValueSubClass
// We only have to update symbol table entries if we are transferring the
// instructions to a different symtab object...
- ValueSymbolTable *NewST = TraitsClass::getSymTab(NewIP);
- ValueSymbolTable *OldST = TraitsClass::getSymTab(OldIP);
+ ValueSymbolTable *NewST = getSymTab(NewIP);
+ ValueSymbolTable *OldST = getSymTab(OldIP);
if (NewST != OldST) {
for (; first != last; ++first) {
ValueSubClass &V = *first;
More information about the llvm-commits
mailing list