Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/db/db/dbArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ class DB_PUBLIC ArrayRepository

basic_repository::iterator f = r->find ((ArrayBase *) &base);
if (f != r->end ()) {
return dynamic_cast <basic_array<Coord> *> (*f);
tl_assert ((*f)->type () == base.type ());
return static_cast <basic_array<Coord> *> (*f);
} else {
basic_array<Coord> *bb = base.clone ();
bb->in_repository = true;
Expand Down
14 changes: 7 additions & 7 deletions src/db/db/dbEdgesUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ JoinEdgesCluster::finish ()
std::multimap<db::Point, iterator>::iterator j0 = objects_by_p1.begin ();
std::multimap<db::Point, iterator>::iterator j = j0;
do {
std::multimap<db::Point, iterator>::iterator jj = objects_by_p2.find (j->first);
if (jj == objects_by_p2.end ()) {
std::multimap<db::Point, iterator>::iterator jj = objects_by_p2.lower_bound (j->first);
if (jj == objects_by_p2.end () || jj->first != j->first) {
break;
} else {
j = objects_by_p1.find (jj->second->first->p1 ());
tl_assert (j != objects_by_p1.end ());
j = objects_by_p1.lower_bound (jj->second->first->p1 ());
tl_assert (j != objects_by_p1.end () && j->first == jj->second->first->p1 ());
}
} while (j != j0);

Expand All @@ -78,7 +78,7 @@ JoinEdgesCluster::finish ()

// remove the edge as it's taken
std::multimap<db::Point, iterator>::iterator jj;
for (jj = objects_by_p2.find (i->first->p2 ()); jj != objects_by_p2.end () && jj->first == i->first->p2 (); ++jj) {
for (jj = objects_by_p2.lower_bound (i->first->p2 ()); jj != objects_by_p2.end () && jj->first == i->first->p2 (); ++jj) {
if (jj->second == i) {
break;
}
Expand All @@ -89,8 +89,8 @@ JoinEdgesCluster::finish ()

// process along the edge to the next one
// TODO: this chooses any solution in case of forks. Choose a specific one?
j = objects_by_p1.find (i->first->p2 ());
if (j != objects_by_p1.end ()) {
j = objects_by_p1.lower_bound (i->first->p2 ());
if (j != objects_by_p1.end () && j->first == i->first->p2 ()) {
i = j->second;
} else {
break;
Expand Down
14 changes: 7 additions & 7 deletions src/db/db/dbLayout.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3349,7 +3349,7 @@ Layout::register_lib_proxy (db::LibraryProxy *lib_proxy)
{
auto key = std::make_pair (lib_proxy->lib_id (), lib_proxy->library_cell_index ());

auto l = m_lib_proxy_map.find (key);
auto l = m_lib_proxy_map.lower_bound (key);
while (l != m_lib_proxy_map.end () && l->first == key) {
if (l->second == lib_proxy->Cell::cell_index ()) {
return;
Expand All @@ -3365,7 +3365,7 @@ Layout::unregister_lib_proxy (db::LibraryProxy *lib_proxy)
{
auto key = std::make_pair (lib_proxy->lib_id (), lib_proxy->library_cell_index ());

auto l = m_lib_proxy_map.find (key);
auto l = m_lib_proxy_map.lower_bound (key);
while (l != m_lib_proxy_map.end () && l->first == key) {
if (l->second == lib_proxy->Cell::cell_index ()) {
m_lib_proxy_map.erase (l);
Expand Down Expand Up @@ -3394,7 +3394,7 @@ Layout::get_lib_proxy (Library *lib, cell_index_type cell_index)
{
auto key = std::make_pair (lib->get_id (), cell_index);

lib_proxy_map::const_iterator lp = m_lib_proxy_map.find (key);
lib_proxy_map::const_iterator lp = m_lib_proxy_map.lower_bound (key);
if (lp != m_lib_proxy_map.end () && lp->first == key) {

return lp->second;
Expand Down Expand Up @@ -3432,7 +3432,7 @@ Layout::get_lib_proxy (Library *lib, cell_index_type cell_index)
void
Layout::register_cold_proxy (db::ColdProxy *cold_proxy)
{
auto l = m_cold_proxy_map.find (cold_proxy->context_info ());
auto l = m_cold_proxy_map.lower_bound (cold_proxy->context_info ());
while (l != m_cold_proxy_map.end () && l->first == cold_proxy->context_info ()) {
if (l->second == cold_proxy->Cell::cell_index ()) {
return;
Expand All @@ -3446,7 +3446,7 @@ Layout::register_cold_proxy (db::ColdProxy *cold_proxy)
void
Layout::unregister_cold_proxy (db::ColdProxy *cold_proxy)
{
auto l = m_cold_proxy_map.find (cold_proxy->context_info ());
auto l = m_cold_proxy_map.lower_bound (cold_proxy->context_info ());
while (l != m_cold_proxy_map.end () && l->first == cold_proxy->context_info ()) {
if (l->second == cold_proxy->Cell::cell_index ()) {
m_cold_proxy_map.erase (l);
Expand All @@ -3459,7 +3459,7 @@ Layout::unregister_cold_proxy (db::ColdProxy *cold_proxy)
std::pair<bool, cell_index_type>
Layout::find_cold_proxy (const db::LayoutOrCellContextInfo &info)
{
cold_proxy_map::const_iterator lp = m_cold_proxy_map.find (info);
cold_proxy_map::const_iterator lp = m_cold_proxy_map.lower_bound (info);
if (lp != m_cold_proxy_map.end () && lp->first == info) {
return std::make_pair (true, lp->second);
} else {
Expand All @@ -3470,7 +3470,7 @@ Layout::find_cold_proxy (const db::LayoutOrCellContextInfo &info)
cell_index_type
Layout::create_cold_proxy (const db::LayoutOrCellContextInfo &info)
{
cold_proxy_map::const_iterator lp = m_cold_proxy_map.find (info);
cold_proxy_map::const_iterator lp = m_cold_proxy_map.lower_bound (info);
if (lp != m_cold_proxy_map.end () && lp->first == info) {

return lp->second;
Expand Down
6 changes: 3 additions & 3 deletions src/db/db/dbLayoutLayers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ LayoutLayers::delete_layer (unsigned int n)
{
const db::LayerProperties &lp = m_layer_props [n];
if (! lp.is_null ()) {
for (auto i = m_layers_by_props.find (lp); i != m_layers_by_props.end () && i->first.log_equal (lp); ++i) {
for (auto i = m_layers_by_props.lower_bound (lp); i != m_layers_by_props.end () && i->first.log_equal (lp); ++i) {
if (i->second == n) {
m_layers_by_props.erase (i);
break;
Expand Down Expand Up @@ -163,7 +163,7 @@ LayoutLayers::get_layer_maybe (const db::LayerProperties &lp) const
if (lp.is_null ()) {
return -1;
} else {
auto i = m_layers_by_props.find (lp);
auto i = m_layers_by_props.lower_bound (lp);
if (i != m_layers_by_props.end () && i->first.log_equal (lp)) {
return int (i->second);
} else {
Expand Down Expand Up @@ -290,7 +290,7 @@ LayoutLayers::set_properties (unsigned int n, const LayerProperties &props)

const db::LayerProperties &lp = m_layer_props [n];
if (! lp.is_null ()) {
for (auto i = m_layers_by_props.find (lp); i != m_layers_by_props.end () && i->first.log_equal (lp); ++i) {
for (auto i = m_layers_by_props.lower_bound (lp); i != m_layers_by_props.end () && i->first.log_equal (lp); ++i) {
if (i->second == n) {
m_layers_by_props.erase (i);
break;
Expand Down
14 changes: 8 additions & 6 deletions src/db/db/dbLibraryManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,16 @@ LibraryManager::rename (lib_id_type lib_id, const std::string &name)

std::string org_name = lib->get_name ();

for (auto it = m_lib_by_name.find (org_name);it != m_lib_by_name.end () && it->first == org_name; ++it) {
for (auto it = m_lib_by_name.lower_bound (org_name); it != m_lib_by_name.end () && it->first == org_name; ++it) {
if (it->second == lib_id) {
m_lib_by_name.erase (it);
break;
}
}

m_lib_by_name.insert (std::make_pair (name, lib_id));
// insert new lib as first of this name
auto l = m_lib_by_name.lower_bound (name);
m_lib_by_name.insert (l, std::make_pair (name, lib_id));
lib->set_name (name);
}

Expand All @@ -109,7 +111,7 @@ LibraryManager::lib_by_name (const std::string &name, const std::set<std::string

if (! for_technologies.empty ()) {

l = m_lib_by_name.find (name);
l = m_lib_by_name.lower_bound (name);
while (l != m_lib_by_name.end () && l->first == name) {
const db::Library *lptr = lib_internal (l->second);
bool found = lptr->for_technologies ();
Expand All @@ -127,7 +129,7 @@ LibraryManager::lib_by_name (const std::string &name, const std::set<std::string
}

// fallback: technology-unspecific libs
l = m_lib_by_name.find (name);
l = m_lib_by_name.lower_bound (name);
while (l != m_lib_by_name.end () && l->first == name) {
if (! lib_internal (l->second)->for_technologies ()) {
return std::make_pair (true, l->second);
Expand Down Expand Up @@ -207,7 +209,7 @@ LibraryManager::register_lib (Library *library)

// if the new library replaces the old one, remap existing library proxies before deleting the library
// (replacement is done only when all technologies are substituted)
lib_name_map::iterator l = m_lib_by_name.find (library->get_name ());
lib_name_map::iterator l = m_lib_by_name.lower_bound (library->get_name ());
bool found = false;
while (l != m_lib_by_name.end () && l->first == library->get_name ()) {
if (m_libs [l->second] && m_libs [l->second]->get_technologies () == library->get_technologies ()) {
Expand All @@ -224,7 +226,7 @@ LibraryManager::register_lib (Library *library)
}

// insert new lib as first of this name
l = m_lib_by_name.find (library->get_name ());
l = m_lib_by_name.lower_bound (library->get_name ());
m_lib_by_name.insert (l, std::make_pair (library->get_name (), id));
}

Expand Down
6 changes: 3 additions & 3 deletions src/db/db/dbNetlistCompare.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1391,7 +1391,7 @@ NetlistComparer::do_pin_assignment (const db::Circuit *c1, const db::NetGraph &g
continue;
}

std::multimap<size_t, const db::Pin *>::iterator np = net2pin2.find (n.other_net_index ());
std::multimap<size_t, const db::Pin *>::iterator np = net2pin2.lower_bound (n.other_net_index ());
for (db::Net::const_pin_iterator pi = net->begin_pins (); pi != net->end_pins (); ++pi) {

if (np != net2pin2.end () && np->first == n.other_net_index ()) {
Expand Down Expand Up @@ -1533,7 +1533,7 @@ NetlistComparer::do_device_assignment (const db::Circuit *c1, const db::NetGraph
bool mapped = true;
std::vector<std::pair<size_t, size_t> > k = compute_device_key_for_other (*d, g2, device_categorizer.is_strict_device_category (device_cat), mapped);

auto dm = device_map.find (k);
auto dm = device_map.lower_bound (k);

if (! mapped || dm == device_map.end () || dm->first != k) {

Expand Down Expand Up @@ -1761,7 +1761,7 @@ NetlistComparer::do_subcircuit_assignment (const db::Circuit *c1, const db::NetG
bool mapped = true, valid = true;
std::vector<std::pair<size_t, size_t> > k = compute_subcircuit_key_for_other (*sc, g2, &c22_circuit_and_pin_mapping, &circuit_pin_mapper, mapped, valid);

std::multimap<std::vector<std::pair<size_t, size_t> >, std::pair<const db::SubCircuit *, size_t> >::iterator scm = subcircuit_map.find (k);
std::multimap<std::vector<std::pair<size_t, size_t> >, std::pair<const db::SubCircuit *, size_t> >::iterator scm = subcircuit_map.lower_bound (k);

if (! mapped || scm == subcircuit_map.end () || scm->first != k) {

Expand Down
4 changes: 2 additions & 2 deletions src/db/db/dbPLC.cc
Original file line number Diff line number Diff line change
Expand Up @@ -468,14 +468,14 @@ Polygon::init ()

mp_v.push_back (v);

auto i = v2e.find (v);
auto i = v2e.lower_bound (v);
tl_assert (i != v2e.end () && i->first == v && i->second != mp_e.back ());
mp_e.push_back (i->second);
v = i->second->other (v);

v2e.erase (i);

i = v2e.find (v);
i = v2e.lower_bound (v);
while (i != v2e.end () && i->first == v) {
if (i->second == mp_e.back ()) {
v2e.erase (i);
Expand Down
7 changes: 6 additions & 1 deletion src/db/db/dbPropertiesRepository.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,12 @@ class DB_PUBLIC PropertiesSet
*/
iterator find (db::property_names_id_type name_id) const
{
return m_map.find (name_id);
auto i = m_map.lower_bound (name_id);
if (i != m_map.end () && i->first != name_id) {
return m_map.end ();
} else {
return i;
}
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/db/db/dbRegionCheckUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Edge2EdgeCheckBase::finish (const Edge *o, size_t p)
if (m_has_negative_edge_output && m_pass == 1 && m_pseudo_edges.find (std::make_pair (*o, p)) == m_pseudo_edges.end ()) {

std::pair<db::Edge, size_t> k (*o, p);
std::multimap<std::pair<db::Edge, size_t>, size_t>::const_iterator i0 = m_e2ep.find (k);
std::multimap<std::pair<db::Edge, size_t>, size_t>::const_iterator i0 = m_e2ep.lower_bound (k);

bool fully_removed = false;
bool any = false;
Expand Down Expand Up @@ -270,7 +270,7 @@ Edge2EdgeCheckBase::add (const db::Edge *o1, size_t p1, const db::Edge *o2, size
for (unsigned int p = 0; p < 2; ++p) {

std::pair<db::Edge, size_t> k (*o1, p1);
for (std::multimap<std::pair<db::Edge, size_t>, size_t>::const_iterator i = m_e2ep.find (k); i != m_e2ep.end () && i->first == k; ++i) {
for (std::multimap<std::pair<db::Edge, size_t>, size_t>::const_iterator i = m_e2ep.lower_bound (k); i != m_e2ep.end () && i->first == k; ++i) {
size_t n = i->second / 2;
if (n < m_first_pseudo && ! m_ep_discarded [n]) {
n1.push_back (n);
Expand Down
8 changes: 8 additions & 0 deletions src/gsi/gsi/gsiClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,14 @@ class GSI_PUBLIC_TEMPLATE VariantUserClass
}
}

void detach_proxy (tl::Object *proxy) const
{
Proxy *p = dynamic_cast<Proxy *> (proxy);
if (p) {
p->detach ();
}
}

virtual bool equal (const void *a, const void *b) const
{
return gsi::_var_user_equal_impl<T, tl::has_equal_operator<T>::value>::call ((const T *) a, (const T *) b, this);
Expand Down
Loading
Loading