mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
Add operator= implementations to SparseBitVector, allowing it to be used in GVN. This results
in both time and memory savings for GVN. For example, one testcase went from 10.5s to 6s with this patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49345 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -89,6 +89,14 @@ public:
|
||||
ElementIndex = RHS.ElementIndex;
|
||||
std::copy(&RHS.Bits[0], &RHS.Bits[BITWORDS_PER_ELEMENT], Bits);
|
||||
}
|
||||
|
||||
// Assignment
|
||||
SparseBitVectorElement& operator=(const SparseBitVectorElement& RHS) {
|
||||
ElementIndex = RHS.ElementIndex;
|
||||
std::copy(&RHS.Bits[0], &RHS.Bits[BITWORDS_PER_ELEMENT], Bits);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Comparison.
|
||||
bool operator==(const SparseBitVectorElement &RHS) const {
|
||||
@@ -483,6 +491,21 @@ public:
|
||||
|
||||
CurrElementIter = Elements.begin ();
|
||||
}
|
||||
|
||||
// Assignment
|
||||
SparseBitVector& operator=(const SparseBitVector& RHS) {
|
||||
Elements.clear();
|
||||
|
||||
ElementListConstIter ElementIter = RHS.Elements.begin();
|
||||
while (ElementIter != RHS.Elements.end()) {
|
||||
Elements.push_back(SparseBitVectorElement<ElementSize>(*ElementIter));
|
||||
++ElementIter;
|
||||
}
|
||||
|
||||
CurrElementIter = Elements.begin ();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Test, Reset, and Set a bit in the bitmap.
|
||||
bool test(unsigned Idx) {
|
||||
|
||||
Reference in New Issue
Block a user