From 09eeeaf08b293c3fc62c2cd434a455c207bd40e4 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Sun, 8 Nov 2009 08:49:59 +0000 Subject: Moved some ManagedStatics out of the SlotIndexes header. llvm-svn: 86446 --- llvm/lib/CodeGen/SlotIndexes.cpp | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'llvm/lib/CodeGen/SlotIndexes.cpp') diff --git a/llvm/lib/CodeGen/SlotIndexes.cpp b/llvm/lib/CodeGen/SlotIndexes.cpp index d99d120509d..9519114b5a3 100644 --- a/llvm/lib/CodeGen/SlotIndexes.cpp +++ b/llvm/lib/CodeGen/SlotIndexes.cpp @@ -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 IndexListEntry::emptyKeyEntry; -ManagedStatic 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 IndexListEntryEmptyKey; + ManagedStatic IndexListEntryTombstoneKey; +} char SlotIndexes::ID = 0; static RegisterPass 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); -- cgit v1.2.3