summaryrefslogtreecommitdiff
path: root/include/llvm/ADT/SparseSet.h
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2012-02-23 01:52:38 +0000
committerAndrew Trick <atrick@apple.com>2012-02-23 01:52:38 +0000
commit81a682a4c004b0f44452ef824637a1b6face178f (patch)
treef1ec6e505018b3d584952bbd9cd499efe4c48940 /include/llvm/ADT/SparseSet.h
parentf19a5926cb1fcd145a61116b7dd2b18312e76fd7 (diff)
downloadllvm-81a682a4c004b0f44452ef824637a1b6face178f.tar.gz
llvm-81a682a4c004b0f44452ef824637a1b6face178f.tar.bz2
llvm-81a682a4c004b0f44452ef824637a1b6face178f.tar.xz
PostRASched: Convert physreg def/use tracking to Jakob's SparseSet.
Added array subscript to SparseSet for convenience. Slight reorg to make it easier to manage the def/use sets. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151228 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/SparseSet.h')
-rw-r--r--include/llvm/ADT/SparseSet.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/llvm/ADT/SparseSet.h b/include/llvm/ADT/SparseSet.h
index 7801d8d9bd..9b276d5533 100644
--- a/include/llvm/ADT/SparseSet.h
+++ b/include/llvm/ADT/SparseSet.h
@@ -213,6 +213,13 @@ public:
return std::make_pair(end() - 1, true);
}
+ /// array subscript - If an element already exists with this key, return it.
+ /// Otherwise, automatically construct a new value from Key, insert it,
+ /// and return the newly inserted element.
+ ValueT &operator[](unsigned Key) {
+ return *insert(ValueT(Key)).first;
+ }
+
/// erase - Erases an existing element identified by a valid iterator.
///
/// This invalidates all iterators, but erase() returns an iterator pointing