[llvm-commits] [llvm] r86446 - in /llvm/trunk: include/llvm/CodeGen/SlotIndexes.h lib/CodeGen/SlotIndexes.cpp

Lang Hames lhames at gmail.com
Sun Nov 8 00:50:00 PST 2009


Author: lhames
Date: Sun Nov  8 02:49:59 2009
New Revision: 86446

URL: http://llvm.org/viewvc/llvm-project?rev=86446&view=rev
Log:
Moved some ManagedStatics out of the SlotIndexes header.

Modified:
    llvm/trunk/include/llvm/CodeGen/SlotIndexes.h
    llvm/trunk/lib/CodeGen/SlotIndexes.cpp

Modified: llvm/trunk/include/llvm/CodeGen/SlotIndexes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SlotIndexes.h?rev=86446&r1=86445&r2=86446&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/SlotIndexes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/SlotIndexes.h Sun Nov  8 02:49:59 2009
@@ -29,13 +29,9 @@
 #include "llvm/CodeGen/MachineInstr.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/ManagedStatic.h"
 
 namespace llvm {
 
-  class EmptyIndexListEntry;
-  class TombstoneIndexListEntry;
-
   /// This class represents an entry in the slot index list held in the
   /// SlotIndexes pass. It should not be used directly. See the
   /// SlotIndex & SlotIndexes classes for the public interface to this
@@ -46,11 +42,6 @@
     static const unsigned EMPTY_KEY_INDEX = ~0U & ~3U,
                           TOMBSTONE_KEY_INDEX = ~0U & ~7U;
 
-    // The following statics are thread safe. They're read only, and you
-    // can't step from them to any other list entries.
-    static ManagedStatic<EmptyIndexListEntry> emptyKeyEntry;
-    static ManagedStatic<TombstoneIndexListEntry> tombstoneKeyEntry;
-
     IndexListEntry *next, *prev;
     MachineInstr *mi;
     unsigned index;
@@ -116,31 +107,13 @@
 
     // This function returns the index list entry that is to be used for empty
     // SlotIndex keys.
-    inline static IndexListEntry* getEmptyKeyEntry();
+    static IndexListEntry* getEmptyKeyEntry();
 
     // This function returns the index list entry that is to be used for
     // tombstone SlotIndex keys.
-    inline static IndexListEntry* getTombstoneKeyEntry();
-  };
-
-  class EmptyIndexListEntry : public IndexListEntry {
-  public:
-    EmptyIndexListEntry() : IndexListEntry(EMPTY_KEY) {}
-  };
-
-  class TombstoneIndexListEntry : public IndexListEntry {
-  public:
-    TombstoneIndexListEntry() : IndexListEntry(TOMBSTONE_KEY) {}
+    static IndexListEntry* getTombstoneKeyEntry();
   };
 
-  inline IndexListEntry* IndexListEntry::getEmptyKeyEntry() {
-    return &*emptyKeyEntry;
-  }
-
-  inline IndexListEntry* IndexListEntry::getTombstoneKeyEntry() {
-    return &*tombstoneKeyEntry;
-  }
-
   // Specialize PointerLikeTypeTraits for IndexListEntry.
   template <>
   class PointerLikeTypeTraits<IndexListEntry*> { 

Modified: llvm/trunk/lib/CodeGen/SlotIndexes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SlotIndexes.cpp?rev=86446&r1=86445&r2=86446&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SlotIndexes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SlotIndexes.cpp Sun Nov  8 02:49:59 2009
@@ -13,17 +13,43 @@
 #include "llvm/CodeGen/MachineFunction.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/ManagedStatic.h"
 
 using namespace llvm;
 
 
 // Yep - these are thread safe. See the header for details. 
-ManagedStatic<EmptyIndexListEntry> IndexListEntry::emptyKeyEntry;
-ManagedStatic<TombstoneIndexListEntry> IndexListEntry::tombstoneKeyEntry;
+namespace {
+
+
+  class EmptyIndexListEntry : public IndexListEntry {
+  public:
+    EmptyIndexListEntry() : IndexListEntry(EMPTY_KEY) {}
+  };
+
+  class TombstoneIndexListEntry : public IndexListEntry {
+  public:
+    TombstoneIndexListEntry() : IndexListEntry(TOMBSTONE_KEY) {}
+  };
+
+  // The following statics are thread safe. They're read only, and you
+  // can't step from them to any other list entries.
+  ManagedStatic<EmptyIndexListEntry> IndexListEntryEmptyKey;
+  ManagedStatic<TombstoneIndexListEntry> IndexListEntryTombstoneKey;
+}
 
 char SlotIndexes::ID = 0;
 static RegisterPass<SlotIndexes> X("slotindexes", "Slot index numbering");
 
+IndexListEntry* IndexListEntry::getEmptyKeyEntry() {
+  return &*IndexListEntryEmptyKey;
+}
+
+IndexListEntry* IndexListEntry::getTombstoneKeyEntry() {
+  return &*IndexListEntryTombstoneKey;
+}
+
+
 void SlotIndexes::getAnalysisUsage(AnalysisUsage &au) const {
   au.setPreservesAll();
   MachineFunctionPass::getAnalysisUsage(au);





More information about the llvm-commits mailing list