}
}
- push_back(Target(pkt, readyTime, order, source, markPending));
+ emplace_back(Target(pkt, readyTime, order, source, markPending));
}
if (!hasUpgrade)
return;
- Iterator end_i = end();
- for (Iterator i = begin(); i != end_i; ++i) {
- replaceUpgrade(i->pkt);
+ for (auto& t : *this) {
+ replaceUpgrade(t.pkt);
}
hasUpgrade = false;
void
MSHR::TargetList::clearDownstreamPending()
{
- Iterator end_i = end();
- for (Iterator i = begin(); i != end_i; ++i) {
- if (i->markedPending) {
+ for (auto& t : *this) {
+ if (t.markedPending) {
// Iterate over the SenderState stack and see if we find
// an MSHR entry. If we find one, clear the
// downstreamPending flag by calling
// clearDownstreamPending(). This recursively clears the
// downstreamPending flag in all caches this packet has
// passed through.
- MSHR *mshr = i->pkt->findNextSenderState<MSHR>();
+ MSHR *mshr = t.pkt->findNextSenderState<MSHR>();
if (mshr != NULL) {
mshr->clearDownstreamPending();
}
bool
MSHR::TargetList::checkFunctional(PacketPtr pkt)
{
- Iterator end_i = end();
- for (Iterator i = begin(); i != end_i; ++i) {
- if (pkt->checkFunctional(i->pkt)) {
+ for (auto& t : *this) {
+ if (pkt->checkFunctional(t.pkt)) {
return true;
}
}
void
-MSHR::TargetList::
-print(std::ostream &os, int verbosity, const std::string &prefix) const
+MSHR::TargetList::print(std::ostream &os, int verbosity,
+ const std::string &prefix) const
{
- ConstIterator end_i = end();
- for (ConstIterator i = begin(); i != end_i; ++i) {
+ for (auto& t : *this) {
const char *s;
- switch (i->source) {
+ switch (t.source) {
case Target::FromCPU:
s = "FromCPU";
break;
break;
}
ccprintf(os, "%s%s: ", prefix, s);
- i->pkt->print(os, verbosity, "");
+ t.pkt->print(os, verbosity, "");
}
}
void
-MSHR::handleFill(Packet *pkt, CacheBlk *blk)
+MSHR::handleFill(PacketPtr pkt, CacheBlk *blk)
{
if (!pkt->sharedAsserted()
&& !(hasPostInvalidate() || hasPostDowngrade())
FromPrefetcher
};
- Tick recvTime; //!< Time when request was received (for stats)
- Tick readyTime; //!< Time when request is ready to be serviced
- Counter order; //!< Global order (for memory consistency mgmt)
- PacketPtr pkt; //!< Pending request packet.
- Source source; //!< Did request come from cpu, memory, or prefetcher?
- bool markedPending; //!< Did we mark upstream MSHR
- //!< as downstreamPending?
+ const Tick recvTime; //!< Time when request was received (for stats)
+ const Tick readyTime; //!< Time when request is ready to be serviced
+ const Counter order; //!< Global order (for memory consistency mgmt)
+ const PacketPtr pkt; //!< Pending request packet.
+ const Source source; //!< Request from cpu, memory, or prefetcher?
+ const bool markedPending; //!< Did we mark upstream MSHR
+ //!< as downstreamPending?
Target(PacketPtr _pkt, Tick _readyTime, Counter _order,
Source _source, bool _markedPending)
};
class TargetList : public std::list<Target> {
- /** Target list iterator. */
- typedef std::list<Target>::iterator Iterator;
- typedef std::list<Target>::const_iterator ConstIterator;
public:
bool needsExclusive;
TargetList();
void resetFlags() { needsExclusive = hasUpgrade = false; }
- bool isReset() { return !needsExclusive && !hasUpgrade; }
+ bool isReset() const { return !needsExclusive && !hasUpgrade; }
void add(PacketPtr pkt, Tick readyTime, Counter order,
Target::Source source, bool markPending);
void replaceUpgrades();
bool promoteDeferredTargets();
- void handleFill(Packet *pkt, CacheBlk *blk);
+ void handleFill(PacketPtr pkt, CacheBlk *blk);
bool checkFunctional(PacketPtr pkt);
MSHR *
MSHRQueue::findMatch(Addr blk_addr, bool is_secure) const
{
- MSHR::ConstIterator i = allocatedList.begin();
- MSHR::ConstIterator end = allocatedList.end();
- for (; i != end; ++i) {
- MSHR *mshr = *i;
+ for (const auto& mshr : allocatedList) {
if (mshr->blkAddr == blk_addr && mshr->isSecure == is_secure) {
return mshr;
}
// Need an empty vector
assert(matches.empty());
bool retval = false;
- MSHR::ConstIterator i = allocatedList.begin();
- MSHR::ConstIterator end = allocatedList.end();
- for (; i != end; ++i) {
- MSHR *mshr = *i;
+ for (const auto& mshr : allocatedList) {
if (mshr->blkAddr == blk_addr && mshr->isSecure == is_secure) {
retval = true;
matches.push_back(mshr);
MSHRQueue::checkFunctional(PacketPtr pkt, Addr blk_addr)
{
pkt->pushLabel(label);
- MSHR::ConstIterator i = allocatedList.begin();
- MSHR::ConstIterator end = allocatedList.end();
- for (; i != end; ++i) {
- MSHR *mshr = *i;
+ for (const auto& mshr : allocatedList) {
if (mshr->blkAddr == blk_addr && mshr->checkFunctional(pkt)) {
pkt->popLabel();
return true;
MSHR *
MSHRQueue::findPending(Addr blk_addr, bool is_secure) const
{
- MSHR::ConstIterator i = readyList.begin();
- MSHR::ConstIterator end = readyList.end();
- for (; i != end; ++i) {
- MSHR *mshr = *i;
+ for (const auto& mshr : readyList) {
if (mshr->blkAddr == blk_addr && mshr->isSecure == is_secure) {
return mshr;
}
return readyList.insert(readyList.end(), mshr);
}
- MSHR::Iterator i = readyList.begin();
- MSHR::Iterator end = readyList.end();
- for (; i != end; ++i) {
+ for (auto i = readyList.begin(); i != readyList.end(); ++i) {
if ((*i)->readyTime > mshr->readyTime) {
return readyList.insert(i, mshr);
}
}
assert(false);
- return end; // keep stupid compilers happy
+ return readyList.end(); // keep stupid compilers happy
}
void
MSHRQueue::squash(int threadNum)
{
- MSHR::Iterator i = allocatedList.begin();
- MSHR::Iterator end = allocatedList.end();
- for (; i != end;) {
+ for (auto i = allocatedList.begin(); i != allocatedList.end();) {
MSHR *mshr = *i;
if (mshr->threadNum == threadNum) {
while (mshr->hasTargets()) {