summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2013-01-07 13:05:38 -0500
committerAndreas Hansson <andreas.hansson@arm.com>2013-01-07 13:05:38 -0500
commite0d93fde993126a2147648586f2fa0526412d841 (patch)
treeadaa3d83cd49c08ab6d0604d5e753eade6bc5a67
parente65de3f5ca1d1a91265d09b1950a2d69c620631b (diff)
downloadgem5-e0d93fde993126a2147648586f2fa0526412d841.tar.xz
base: Simplify the AddrRangeMap by removing unused code
This patch cleans up the AddrRangeMap in preparation for the addition of interleaving by removing unused code. The non-const editions of find are never used, and hence the duplication is not needed.
-rw-r--r--src/base/addr_range_map.hh50
-rw-r--r--src/mem/physical.cc3
2 files changed, 8 insertions, 45 deletions
diff --git a/src/base/addr_range_map.hh b/src/base/addr_range_map.hh
index 1992c5e48..e38e25702 100644
--- a/src/base/addr_range_map.hh
+++ b/src/base/addr_range_map.hh
@@ -68,32 +68,10 @@ class AddrRangeMap
const_iterator
find(const AddrRange &r) const
{
- const_iterator i;
-
- i = tree.upper_bound(r);
-
- if (i == tree.begin()) {
- if (i->first.intersects(r))
- return i;
- else
- // Nothing could match, so return end()
- return tree.end();
- }
-
- --i;
-
- if (i->first.intersects(r))
- return i;
-
- return tree.end();
- }
-
- iterator
- find(const AddrRange &r)
- {
- iterator i;
+ if (tree.empty())
+ return tree.end();
- i = tree.upper_bound(r);
+ const_iterator i = tree.upper_bound(r);
if (i == tree.begin()) {
if (i->first.intersects(r))
@@ -117,23 +95,13 @@ class AddrRangeMap
return find(RangeSize(r, 1));
}
- iterator
- find(const Addr &r)
- {
- return find(RangeSize(r, 1));
- }
-
bool
- intersect(const AddrRange &r)
+ intersect(const AddrRange &r) const
{
- iterator i;
- i = find(r);
- if (i != tree.end())
- return true;
- return false;
+ return find(r) != tree.end();
}
- iterator
+ const_iterator
insert(const AddrRange &r, const V& d)
{
if (intersect(r))
@@ -142,12 +110,6 @@ class AddrRangeMap
return tree.insert(std::make_pair(r, d)).first;
}
- std::size_t
- erase(Addr k)
- {
- return tree.erase(k);
- }
-
void
erase(iterator p)
{
diff --git a/src/mem/physical.cc b/src/mem/physical.cc
index ef1f7159e..ae5da82fd 100644
--- a/src/mem/physical.cc
+++ b/src/mem/physical.cc
@@ -325,7 +325,8 @@ PhysicalMemory::unserialize(Checkpoint* cp, const string& section)
arrayParamIn(cp, section, "lal_addr", lal_addr);
arrayParamIn(cp, section, "lal_cid", lal_cid);
for(size_t i = 0; i < lal_addr.size(); ++i) {
- AddrRangeMap<AbstractMemory*>::iterator m = addrMap.find(lal_addr[i]);
+ AddrRangeMap<AbstractMemory*>::const_iterator m =
+ addrMap.find(lal_addr[i]);
m->second->addLockedAddr(LockedAddr(lal_addr[i], lal_cid[i]));
}