mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
SparseSet: Add support for key-derived indexes and arbitrary key types.
This nicely handles the most common case of virtual register sets, but also handles anticipated cases where we will map pointers to IDs. The goal is not to develop a completely generic SparseSet template. Instead we want to handle the expected uses within llvm without any template antics in the client code. I'm adding a bit of template nastiness here, and some assumption about expected usage in order to make the client code very clean. The expected common uses cases I'm designing for: - integer keys that need to be reindexed, and may map to additional data - densely numbered objects where we want pointer keys because no number->object map exists. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@155227 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -161,7 +161,7 @@ TEST(SparseSetTest, MultipleEntrySet) {
|
||||
struct Alt {
|
||||
unsigned Value;
|
||||
explicit Alt(unsigned x) : Value(x) {}
|
||||
unsigned getSparseSetKey() const { return Value - 1000; }
|
||||
unsigned getSparseSetIndex() const { return Value - 1000; }
|
||||
};
|
||||
|
||||
TEST(SparseSetTest, AltStructSet) {
|
||||
|
Reference in New Issue
Block a user