mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 03:32:29 +00:00 
			
		
		
		
	kernel: use const reference for SigSet too
This commit is contained in:
		
							parent
							
								
									bc51e609cb
								
							
						
					
					
						commit
						8c45ea9f0e
					
				
					 1 changed files with 18 additions and 18 deletions
				
			
		|  | @ -155,65 +155,65 @@ struct SigSet | ||||||
| 
 | 
 | ||||||
| 	void insert(const RTLIL::SigSpec &sig, T data) | 	void insert(const RTLIL::SigSpec &sig, T data) | ||||||
| 	{ | 	{ | ||||||
| 		for (auto &bit : sig) | 		for (const auto &bit : sig) | ||||||
| 			if (bit.wire != NULL) | 			if (bit.wire != NULL) | ||||||
| 				bits[bit].insert(data); | 				bits[bit].insert(data); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	void insert(RTLIL::SigSpec sig, const std::set<T> &data) | 	void insert(const RTLIL::SigSpec& sig, const std::set<T> &data) | ||||||
| 	{ | 	{ | ||||||
| 		for (auto &bit : sig) | 		for (const auto &bit : sig) | ||||||
| 			if (bit.wire != NULL) | 			if (bit.wire != NULL) | ||||||
| 				bits[bit].insert(data.begin(), data.end()); | 				bits[bit].insert(data.begin(), data.end()); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	void erase(RTLIL::SigSpec sig) | 	void erase(const RTLIL::SigSpec& sig) | ||||||
| 	{ | 	{ | ||||||
| 		for (auto &bit : sig) | 		for (const auto &bit : sig) | ||||||
| 			if (bit.wire != NULL) | 			if (bit.wire != NULL) | ||||||
| 				bits[bit].clear(); | 				bits[bit].clear(); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	void erase(RTLIL::SigSpec sig, T data) | 	void erase(const RTLIL::SigSpec &sig, T data) | ||||||
| 	{ | 	{ | ||||||
| 		for (auto &bit : sig) | 		for (const auto &bit : sig) | ||||||
| 			if (bit.wire != NULL) | 			if (bit.wire != NULL) | ||||||
| 				bits[bit].erase(data); | 				bits[bit].erase(data); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	void erase(RTLIL::SigSpec sig, const std::set<T> &data) | 	void erase(const RTLIL::SigSpec &sig, const std::set<T> &data) | ||||||
| 	{ | 	{ | ||||||
| 		for (auto &bit : sig) | 		for (const auto &bit : sig) | ||||||
| 			if (bit.wire != NULL) | 			if (bit.wire != NULL) | ||||||
| 				bits[bit].erase(data.begin(), data.end()); | 				bits[bit].erase(data.begin(), data.end()); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	void find(RTLIL::SigSpec sig, std::set<T> &result) | 	void find(const RTLIL::SigSpec &sig, std::set<T> &result) | ||||||
| 	{ | 	{ | ||||||
| 		for (auto &bit : sig) | 		for (const auto &bit : sig) | ||||||
| 			if (bit.wire != NULL) { | 			if (bit.wire != NULL) { | ||||||
| 				auto &data = bits[bit]; | 				auto &data = bits[bit]; | ||||||
| 				result.insert(data.begin(), data.end()); | 				result.insert(data.begin(), data.end()); | ||||||
| 			} | 			} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	void find(RTLIL::SigSpec sig, pool<T> &result) | 	void find(const RTLIL::SigSpec &sig, pool<T> &result) | ||||||
| 	{ | 	{ | ||||||
| 		for (auto &bit : sig) | 		for (const auto &bit : sig) | ||||||
| 			if (bit.wire != NULL) { | 			if (bit.wire != NULL) { | ||||||
| 				auto &data = bits[bit]; | 				auto &data = bits[bit]; | ||||||
| 				result.insert(data.begin(), data.end()); | 				result.insert(data.begin(), data.end()); | ||||||
| 			} | 			} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	std::set<T> find(RTLIL::SigSpec sig) | 	std::set<T> find(const RTLIL::SigSpec &sig) | ||||||
| 	{ | 	{ | ||||||
| 		std::set<T> result; | 		std::set<T> result; | ||||||
| 		find(sig, result); | 		find(sig, result); | ||||||
| 		return result; | 		return result; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	bool has(RTLIL::SigSpec sig) | 	bool has(const RTLIL::SigSpec &sig) | ||||||
| 	{ | 	{ | ||||||
| 		for (auto &bit : sig) | 		for (auto &bit : sig) | ||||||
| 			if (bit.wire != NULL && bits.count(bit)) | 			if (bit.wire != NULL && bits.count(bit)) | ||||||
|  | @ -289,14 +289,14 @@ struct SigMap | ||||||
| 
 | 
 | ||||||
| 	void add(const RTLIL::SigBit &bit) | 	void add(const RTLIL::SigBit &bit) | ||||||
| 	{ | 	{ | ||||||
| 		RTLIL::SigBit b = database.find(bit); | 		const auto &b = database.find(bit); | ||||||
| 		if (b.wire != nullptr) | 		if (b.wire != nullptr) | ||||||
| 			database.promote(bit); | 			database.promote(bit); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	void add(const RTLIL::SigSpec &sig) | 	void add(const RTLIL::SigSpec &sig) | ||||||
| 	{ | 	{ | ||||||
| 		for (auto &bit : sig) | 		for (const auto &bit : sig) | ||||||
| 			add(bit); | 			add(bit); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -335,7 +335,7 @@ struct SigMap | ||||||
| 	RTLIL::SigSpec allbits() const | 	RTLIL::SigSpec allbits() const | ||||||
| 	{ | 	{ | ||||||
| 		RTLIL::SigSpec sig; | 		RTLIL::SigSpec sig; | ||||||
| 		for (auto &bit : database) | 		for (const auto &bit : database) | ||||||
| 			if (bit.wire != nullptr) | 			if (bit.wire != nullptr) | ||||||
| 				sig.append(bit); | 				sig.append(bit); | ||||||
| 		return sig; | 		return sig; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue