mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-28 19:25:00 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126925 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user