mirror of https://github.com/YosysHQ/yosys.git
kernel: Cell::set{Port,Param}() to pass by value, but use std::move
Otherwise cell->setPort(ID::A, cell->getPort(ID::B)) could be invalid
This commit is contained in:
parent
940640ac44
commit
f97b90e40b
|
@ -2481,11 +2481,11 @@ void RTLIL::Cell::unsetPort(RTLIL::IdString portname)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTLIL::Cell::setPort(RTLIL::IdString portname, const RTLIL::SigSpec &signal)
|
void RTLIL::Cell::setPort(RTLIL::IdString portname, RTLIL::SigSpec signal)
|
||||||
{
|
{
|
||||||
auto r = connections_.insert(portname);
|
auto r = connections_.insert(portname);
|
||||||
auto conn_it = r.first;
|
auto conn_it = r.first;
|
||||||
if (conn_it->second == signal)
|
if (!r.second && conn_it->second == signal)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto mon : module->monitors)
|
for (auto mon : module->monitors)
|
||||||
|
@ -2500,7 +2500,7 @@ void RTLIL::Cell::setPort(RTLIL::IdString portname, const RTLIL::SigSpec &signal
|
||||||
log_backtrace("-X- ", yosys_xtrace-1);
|
log_backtrace("-X- ", yosys_xtrace-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
conn_it->second = signal;
|
conn_it->second = std::move(signal);
|
||||||
}
|
}
|
||||||
|
|
||||||
const RTLIL::SigSpec &RTLIL::Cell::getPort(RTLIL::IdString portname) const
|
const RTLIL::SigSpec &RTLIL::Cell::getPort(RTLIL::IdString portname) const
|
||||||
|
@ -2556,9 +2556,9 @@ void RTLIL::Cell::unsetParam(RTLIL::IdString paramname)
|
||||||
parameters.erase(paramname);
|
parameters.erase(paramname);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTLIL::Cell::setParam(RTLIL::IdString paramname, const RTLIL::Const &value)
|
void RTLIL::Cell::setParam(RTLIL::IdString paramname, RTLIL::Const value)
|
||||||
{
|
{
|
||||||
parameters[paramname] = value;
|
parameters[paramname] = std::move(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const RTLIL::Const &RTLIL::Cell::getParam(RTLIL::IdString paramname) const
|
const RTLIL::Const &RTLIL::Cell::getParam(RTLIL::IdString paramname) const
|
||||||
|
|
|
@ -1381,7 +1381,7 @@ public:
|
||||||
// access cell ports
|
// access cell ports
|
||||||
bool hasPort(RTLIL::IdString portname) const;
|
bool hasPort(RTLIL::IdString portname) const;
|
||||||
void unsetPort(RTLIL::IdString portname);
|
void unsetPort(RTLIL::IdString portname);
|
||||||
void setPort(RTLIL::IdString portname, const RTLIL::SigSpec &signal);
|
void setPort(RTLIL::IdString portname, RTLIL::SigSpec signal);
|
||||||
const RTLIL::SigSpec &getPort(RTLIL::IdString portname) const;
|
const RTLIL::SigSpec &getPort(RTLIL::IdString portname) const;
|
||||||
const dict<RTLIL::IdString, RTLIL::SigSpec> &connections() const;
|
const dict<RTLIL::IdString, RTLIL::SigSpec> &connections() const;
|
||||||
|
|
||||||
|
@ -1393,7 +1393,7 @@ public:
|
||||||
// access cell parameters
|
// access cell parameters
|
||||||
bool hasParam(RTLIL::IdString paramname) const;
|
bool hasParam(RTLIL::IdString paramname) const;
|
||||||
void unsetParam(RTLIL::IdString paramname);
|
void unsetParam(RTLIL::IdString paramname);
|
||||||
void setParam(RTLIL::IdString paramname, const RTLIL::Const& value);
|
void setParam(RTLIL::IdString paramname, RTLIL::Const value);
|
||||||
const RTLIL::Const &getParam(RTLIL::IdString paramname) const;
|
const RTLIL::Const &getParam(RTLIL::IdString paramname) const;
|
||||||
|
|
||||||
void sort();
|
void sort();
|
||||||
|
|
Loading…
Reference in New Issue