mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-21 16:25:23 +00:00
IntegersSubsetMapping: removed exclude operation, it will replaced with more universal "diff" operation in next commit.
Changes was separated onto two commits for better readability. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159200 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -66,12 +66,6 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
struct ClusterLefterThan {
|
||||
bool operator()(const Cluster &C, const RangeTy &R) {
|
||||
return C.first.getHigh() < R.getLow();
|
||||
}
|
||||
};
|
||||
|
||||
CaseItems Items;
|
||||
bool Sorted;
|
||||
|
||||
@@ -102,40 +96,6 @@ protected:
|
||||
Sorted = true;
|
||||
}
|
||||
}
|
||||
|
||||
void exclude(CaseItemIt &beginIt, RangeTy &R) {
|
||||
|
||||
std::list<CaseItemIt> ToBeErased;
|
||||
|
||||
CaseItemIt endIt = Items.end();
|
||||
CaseItemIt It =
|
||||
std::lower_bound(beginIt, Items.end(), R, ClusterLefterThan());
|
||||
|
||||
if (It == endIt)
|
||||
return;
|
||||
|
||||
if (It->first.getLow() < R.getLow())
|
||||
Items.insert(It, std::make_pair(
|
||||
RangeTy(It->first.getLow(), R.getLow()-1),
|
||||
It->second));
|
||||
|
||||
do
|
||||
ToBeErased.push_back(It++);
|
||||
while (It != endIt && It->first.getLow() <= R.getHigh());
|
||||
|
||||
beginIt = It;
|
||||
|
||||
CaseItemIt &LastRemoved = *(--ToBeErased.end());
|
||||
if (LastRemoved->first.getHigh() > R.getHigh())
|
||||
beginIt = Items.insert(LastRemoved, std::make_pair(
|
||||
RangeTy(R.getHigh() + 1, LastRemoved->first.getHigh()),
|
||||
LastRemoved->second
|
||||
));
|
||||
|
||||
for (typename std::list<CaseItemIt>::iterator i = ToBeErased.begin(),
|
||||
e = ToBeErased.end(); i != e; ++i)
|
||||
Items.erase(*i);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
@@ -230,18 +190,6 @@ public:
|
||||
/// Removes items from set.
|
||||
void removeItem(RangeIterator i) { Items.erase(i); }
|
||||
|
||||
// Excludes RHS subset from current mapping. RHS should consists of non
|
||||
// overlapped ranges only and sorted from left to the right.
|
||||
// method will have unpredictional behaviour in another case.
|
||||
void exclude(IntegersSubsetTy &RHS) {
|
||||
CaseItemIt startIt = begin();
|
||||
for (unsigned i = 0, e = RHS.getNumItems();
|
||||
i != e && startIt != end(); ++i) {
|
||||
RangeTy R = RHS.getItem(i);
|
||||
exclude(startIt, R);
|
||||
}
|
||||
}
|
||||
|
||||
/// Builds the finalized case objects.
|
||||
void getCases(Cases& TheCases) {
|
||||
CRSMap TheCRSMap;
|
||||
|
Reference in New Issue
Block a user