mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	Use set for strpool_attribute to maintain ordering, but keep some backwards compatibility
This commit is contained in:
		
							parent
							
								
									3a67468860
								
							
						
					
					
						commit
						8117ab228e
					
				
					 4 changed files with 16 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -14,6 +14,7 @@
 | 
			
		|||
 | 
			
		||||
#include <stdexcept>
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include <set>
 | 
			
		||||
#include <string>
 | 
			
		||||
#include <variant>
 | 
			
		||||
#include <vector>
 | 
			
		||||
| 
						 | 
				
			
			@ -1001,6 +1002,11 @@ public:
 | 
			
		|||
	{
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	pool(std::set<K> other) {
 | 
			
		||||
		for (auto it : other)
 | 
			
		||||
			insert(it);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	pool(const pool &other)
 | 
			
		||||
	{
 | 
			
		||||
		entries = other.entries;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -708,6 +708,14 @@ void RTLIL::AttrObject::add_strpool_attribute(const RTLIL::IdString& id, const s
 | 
			
		|||
		set_strpool_attribute(id, union_data);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void RTLIL::AttrObject::add_strpool_attribute(const RTLIL::IdString& id, const pool<string> &data)
 | 
			
		||||
{
 | 
			
		||||
	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);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::set<string> RTLIL::AttrObject::get_strpool_attribute(const RTLIL::IdString &id) const
 | 
			
		||||
{
 | 
			
		||||
	std::set<string> data;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -857,6 +857,7 @@ struct RTLIL::AttrObject
 | 
			
		|||
 | 
			
		||||
	void set_strpool_attribute(const RTLIL::IdString& id, const std::set<string> &data);
 | 
			
		||||
	void add_strpool_attribute(const RTLIL::IdString& id, const std::set<string> &data);
 | 
			
		||||
	void add_strpool_attribute(const RTLIL::IdString& id, const pool<string> &data);
 | 
			
		||||
	std::set<string> get_strpool_attribute(const RTLIL::IdString &id) const;
 | 
			
		||||
 | 
			
		||||
	void set_src_attribute(const std::string &src) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,7 +26,6 @@
 | 
			
		|||
#include <stdlib.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <set>
 | 
			
		||||
 | 
			
		||||
#include "simplemap.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -157,7 +156,7 @@ struct TechmapWorker
 | 
			
		|||
		}
 | 
			
		||||
 | 
			
		||||
		std::string orig_cell_name;
 | 
			
		||||
		std::set<string> extra_src_attrs = cell->get_strpool_attribute(ID::src);
 | 
			
		||||
		pool<string> extra_src_attrs = cell->get_strpool_attribute(ID::src);
 | 
			
		||||
 | 
			
		||||
		orig_cell_name = cell->name.str();
 | 
			
		||||
		for (auto tpl_cell : tpl->cells())
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue