From: Andreas Hansson Date: Thu, 16 Oct 2014 09:49:59 +0000 (-0400) Subject: misc: Move AddrRangeList from port.hh to addr_range.hh X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=edc77fc03cc2f9ef0fb17a34a998b2b957904c93;p=gem5.git misc: Move AddrRangeList from port.hh to addr_range.hh The new location seems like a better fit. The iterator typedefs are removed in favour of using C++11 auto. --- diff --git a/src/base/addr_range.hh b/src/base/addr_range.hh index df4afab9e..4cb1ebd5a 100644 --- a/src/base/addr_range.hh +++ b/src/base/addr_range.hh @@ -45,6 +45,7 @@ #ifndef __BASE_ADDR_RANGE_HH__ #define __BASE_ADDR_RANGE_HH__ +#include #include #include "base/bitfield.hh" @@ -293,6 +294,11 @@ class AddrRange #endif // SWIG }; +/** + * Convenience typedef for a collection of address ranges + */ +typedef std::list AddrRangeList; + inline AddrRange RangeEx(Addr start, Addr end) { return AddrRange(start, end - 1); } diff --git a/src/kern/tru64/tru64_events.cc b/src/kern/tru64/tru64_events.cc index 943d961fb..df346d6ab 100644 --- a/src/kern/tru64/tru64_events.cc +++ b/src/kern/tru64/tru64_events.cc @@ -57,15 +57,14 @@ BadAddrEvent::process(ThreadContext *tc) uint64_t a0 = tc->readIntReg(16); - AddrRangeIter iter; bool found = false; MasterPort &dataPort = tc->getCpuPtr()->getDataPort(); // get the address ranges of the connected slave port AddrRangeList resp = dataPort.getAddrRanges(); - for (iter = resp.begin(); iter != resp.end(); iter++) { - if (iter->contains(K0Seg2Phys(a0) & PAddrImplMask)) + for (const auto &iter : resp) { + if (iter.contains(K0Seg2Phys(a0) & PAddrImplMask)) found = true; } diff --git a/src/mem/port.hh b/src/mem/port.hh index 28f4d7d68..6b5e9530c 100644 --- a/src/mem/port.hh +++ b/src/mem/port.hh @@ -50,22 +50,9 @@ #ifndef __MEM_PORT_HH__ #define __MEM_PORT_HH__ -#include - #include "base/addr_range.hh" #include "mem/packet.hh" -/** - * This typedef is used to clean up getAddrRanges(). It's declared - * outside the Port object since it's also used by some mem objects. - * Eventually we should move this typedef to wherever Addr is - * defined. - */ - -typedef std::list AddrRangeList; -typedef std::list::iterator AddrRangeIter; -typedef std::list::const_iterator AddrRangeConstIter; - class MemObject; /** diff --git a/src/mem/ruby/system/RubyPort.cc b/src/mem/ruby/system/RubyPort.cc index b839e6646..1374c3566 100644 --- a/src/mem/ruby/system/RubyPort.cc +++ b/src/mem/ruby/system/RubyPort.cc @@ -526,8 +526,8 @@ RubyPort::PioSlavePort::getAddrRanges() const ranges.splice(ranges.begin(), ruby_port->master_ports[i]->getAddrRanges()); } - for (AddrRangeConstIter r = ranges.begin(); r != ranges.end(); ++r) - DPRINTF(RubyPort, "%s\n", r->to_string()); + for (const auto M5_VAR_USED &r : ranges) + DPRINTF(RubyPort, "%s\n", r.to_string()); return ranges; }