From 67f918ec8f6e59640d5fb424649406602b83e0d7 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Tue, 6 Oct 2015 21:31:07 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249469 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/IR/BasicBlock.h | 2 -- include/llvm/IR/Function.h | 12 ------------ include/llvm/IR/SymbolTableListTraits.h | 2 ++ lib/IR/SymbolTableListTraitsImpl.h | 12 ++++++------ 4 files changed, 8 insertions(+), 20 deletions(-) diff --git a/include/llvm/IR/BasicBlock.h b/include/llvm/IR/BasicBlock.h index d5a6584ab68..d3a8ec3d3e6 100644 --- a/include/llvm/IR/BasicBlock.h +++ b/include/llvm/IR/BasicBlock.h @@ -40,8 +40,6 @@ template<> struct ilist_traits 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 Sentinel; }; diff --git a/include/llvm/IR/Function.h b/include/llvm/IR/Function.h index 29799dd7fbe..c6486d1b4e5 100644 --- a/include/llvm/IR/Function.h +++ b/include/llvm/IR/Function.h @@ -46,8 +46,6 @@ template<> struct ilist_traits Argument *ensureHead(Argument*) const { return createSentinel(); } static void noteHead(Argument*, Argument*) {} - static ValueSymbolTable *getSymTab(Function *ItemParent); - private: mutable ilist_half_node Sentinel; }; @@ -626,16 +624,6 @@ private: void clearMetadata(); }; -inline ValueSymbolTable * -ilist_traits::getSymTab(Function *F) { - return F ? &F->getValueSymbolTable() : nullptr; -} - -inline ValueSymbolTable * -ilist_traits::getSymTab(Function *F) { - return F ? &F->getValueSymbolTable() : nullptr; -} - template <> struct OperandTraits : public OptionalOperandTraits {}; diff --git a/include/llvm/IR/SymbolTableListTraits.h b/include/llvm/IR/SymbolTableListTraits.h index 87dd366b2ab..a81ffe8fa0c 100644 --- a/include/llvm/IR/SymbolTableListTraits.h +++ b/include/llvm/IR/SymbolTableListTraits.h @@ -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 &L2, diff --git a/lib/IR/SymbolTableListTraitsImpl.h b/lib/IR/SymbolTableListTraitsImpl.h index a18f98261ab..10cb76ed31d 100644 --- a/lib/IR/SymbolTableListTraitsImpl.h +++ b/lib/IR/SymbolTableListTraitsImpl.h @@ -29,13 +29,13 @@ template void SymbolTableListTraits ::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 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 ::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 // 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; -- 2.34.1