mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-02 12:21:23 +00:00
Use ordered set for src attrs when flattening
This commit is contained in:
parent
1b1855353d
commit
3a67468860
3 changed files with 11 additions and 9 deletions
|
@ -30,6 +30,7 @@
|
|||
#include <strstream>
|
||||
#include <algorithm>
|
||||
#include <optional>
|
||||
#include <set>
|
||||
|
||||
YOSYS_NAMESPACE_BEGIN
|
||||
|
||||
|
@ -688,7 +689,7 @@ string RTLIL::AttrObject::get_string_attribute(const RTLIL::IdString &id) const
|
|||
return value;
|
||||
}
|
||||
|
||||
void RTLIL::AttrObject::set_strpool_attribute(const RTLIL::IdString& id, const pool<string> &data)
|
||||
void RTLIL::AttrObject::set_strpool_attribute(const RTLIL::IdString& id, const std::set<string> &data)
|
||||
{
|
||||
string attrval;
|
||||
for (const auto &s : data) {
|
||||
|
@ -699,17 +700,17 @@ void RTLIL::AttrObject::set_strpool_attribute(const RTLIL::IdString& id, const p
|
|||
set_string_attribute(id, attrval);
|
||||
}
|
||||
|
||||
void RTLIL::AttrObject::add_strpool_attribute(const RTLIL::IdString& id, const pool<string> &data)
|
||||
void RTLIL::AttrObject::add_strpool_attribute(const RTLIL::IdString& id, const std::set<string> &data)
|
||||
{
|
||||
pool<string> union_data = get_strpool_attribute(id);
|
||||
std::set<string> union_data = get_strpool_attribute(id);
|
||||
union_data.insert(data.begin(), data.end());
|
||||
if (!union_data.empty())
|
||||
set_strpool_attribute(id, union_data);
|
||||
}
|
||||
|
||||
pool<string> RTLIL::AttrObject::get_strpool_attribute(const RTLIL::IdString &id) const
|
||||
std::set<string> RTLIL::AttrObject::get_strpool_attribute(const RTLIL::IdString &id) const
|
||||
{
|
||||
pool<string> data;
|
||||
std::set<string> data;
|
||||
if (attributes.count(id) != 0)
|
||||
for (auto s : split_tokens(get_string_attribute(id), "|"))
|
||||
data.insert(s);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue