IdString optimization
authorClifford Wolf <clifford@clifford.at>
Wed, 31 Dec 2014 02:56:09 +0000 (03:56 +0100)
committerClifford Wolf <clifford@clifford.at>
Wed, 31 Dec 2014 02:56:09 +0000 (03:56 +0100)
kernel/rtlil.h

index 739b701f8b5d80ea34cbae13385d9f7304c0cfd6..c40af88aad1b9525e51665b832aea5547eaae784 100644 (file)
@@ -121,6 +121,12 @@ namespace RTLIL
                        global_id_index_[global_id_storage_.at(idx)] = idx;
                        global_refcount_storage_.at(idx)++;
 
+                       // Avoid Create->Delete->Create pattern
+                       static IdString last_created_id;
+                       put_reference(last_created_id.index_);
+                       last_created_id.index_ = idx;
+                       get_reference(last_created_id.index_);
+
                        if (yosys_xtrace) {
                                log("#X# New IdString '%s' with index %d.\n", p, idx);
                                log_backtrace("-X- ", yosys_xtrace-1);