forked from OSchip/llvm-project
Use CostPool::PoolRef typedef some more
Cleanup to 217563 suggested by Lang Hames in post-commit review. llvm-svn: 217564
This commit is contained in:
parent
ebd7f671df
commit
792e8f3c02
llvm/include/llvm/CodeGen/PBQP
|
@ -68,19 +68,17 @@ private:
|
||||||
void removeEntry(PoolEntry *p) { entrySet.erase(p); }
|
void removeEntry(PoolEntry *p) { entrySet.erase(p); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template <typename CostKeyT>
|
template <typename CostKeyT> PoolRef getCost(CostKeyT costKey) {
|
||||||
std::shared_ptr<CostT> getCost(CostKeyT costKey) {
|
|
||||||
typename EntrySet::iterator itr =
|
typename EntrySet::iterator itr =
|
||||||
std::lower_bound(entrySet.begin(), entrySet.end(), costKey,
|
std::lower_bound(entrySet.begin(), entrySet.end(), costKey,
|
||||||
EntryComparator());
|
EntryComparator());
|
||||||
|
|
||||||
if (itr != entrySet.end() && costKey == (*itr)->getCost())
|
if (itr != entrySet.end() && costKey == (*itr)->getCost())
|
||||||
return std::shared_ptr<CostT>((*itr)->shared_from_this(),
|
return PoolRef((*itr)->shared_from_this(), &(*itr)->getCost());
|
||||||
&(*itr)->getCost());
|
|
||||||
|
|
||||||
auto p = std::make_shared<PoolEntry>(*this, std::move(costKey));
|
auto p = std::make_shared<PoolEntry>(*this, std::move(costKey));
|
||||||
entrySet.insert(itr, p.get());
|
entrySet.insert(itr, p.get());
|
||||||
return std::shared_ptr<CostT>(std::move(p), &p->getCost());
|
return PoolRef(std::move(p), &p->getCost());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue