diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-03-03 05:40:04 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-03-03 05:40:04 +0000 |
commit | 4ec757d5889aced9a48ad028d02fee97b2f99c5b (patch) | |
tree | 7c9536429f1609232b62a6a9815f671bbea27ae2 /llvm/lib/CodeGen/SlotIndexes.cpp | |
parent | 67a84d08ceaff928d734d10affccc7e5d0510dd9 (diff) | |
download | bcm5719-llvm-4ec757d5889aced9a48ad028d02fee97b2f99c5b.tar.gz bcm5719-llvm-4ec757d5889aced9a48ad028d02fee97b2f99c5b.zip |
Represent sentinel slot indexes with a null pointer.
This is much faster than using a pointer to a ManagedStatic object accessed with
a function call. The greedy register allocator is 5% faster overall just from
the SlotIndex default constructor savings.
llvm-svn: 126925
Diffstat (limited to 'llvm/lib/CodeGen/SlotIndexes.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SlotIndexes.cpp | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/llvm/lib/CodeGen/SlotIndexes.cpp b/llvm/lib/CodeGen/SlotIndexes.cpp index 6e3fa90e434..f18854be856 100644 --- a/llvm/lib/CodeGen/SlotIndexes.cpp +++ b/llvm/lib/CodeGen/SlotIndexes.cpp @@ -13,45 +13,14 @@ #include "llvm/CodeGen/MachineFunction.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" -#include "llvm/Support/ManagedStatic.h" #include "llvm/Target/TargetInstrInfo.h" using namespace llvm; - -// Yep - these are thread safe. See the header for details. -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; INITIALIZE_PASS(SlotIndexes, "slotindexes", "Slot index numbering", false, false) -IndexListEntry* IndexListEntry::getEmptyKeyEntry() { - return &*IndexListEntryEmptyKey; -} - -IndexListEntry* IndexListEntry::getTombstoneKeyEntry() { - return &*IndexListEntryTombstoneKey; -} - - void SlotIndexes::getAnalysisUsage(AnalysisUsage &au) const { au.setPreservesAll(); MachineFunctionPass::getAnalysisUsage(au); |