Fixed performance bug in object hashing
authorClifford Wolf <clifford@clifford.at>
Sun, 28 Dec 2014 18:03:18 +0000 (19:03 +0100)
committerClifford Wolf <clifford@clifford.at>
Sun, 28 Dec 2014 18:03:18 +0000 (19:03 +0100)
kernel/rtlil.cc
kernel/rtlil.h

index c262801dcbd710ff2a550f457ec3ed008b7f81ab..6f2d367d6531d6e363fb3c4efbcb7c4e8f63269a 100644 (file)
@@ -236,7 +236,7 @@ void RTLIL::Selection::optimize(RTLIL::Design *design)
 
 RTLIL::Design::Design()
 {
-       unsigned int hashidx_count = 0;
+       static unsigned int hashidx_count = 0;
        hashidx_ = hashidx_count++;
 
        refcount_modules_ = 0;
@@ -450,7 +450,7 @@ std::vector<RTLIL::Module*> RTLIL::Design::selected_whole_modules_warn() const
 
 RTLIL::Module::Module()
 {
-       unsigned int hashidx_count = 0;
+       static unsigned int hashidx_count = 0;
        hashidx_ = hashidx_count++;
 
        design = nullptr;
@@ -1741,7 +1741,7 @@ RTLIL::Cell* RTLIL::Module::addDlatchsrGate(RTLIL::IdString name, RTLIL::SigSpec
 
 RTLIL::Wire::Wire()
 {
-       unsigned int hashidx_count = 0;
+       static unsigned int hashidx_count = 0;
        hashidx_ = hashidx_count++;
 
        module = nullptr;
@@ -1755,7 +1755,7 @@ RTLIL::Wire::Wire()
 
 RTLIL::Memory::Memory()
 {
-       unsigned int hashidx_count = 0;
+       static unsigned int hashidx_count = 0;
        hashidx_ = hashidx_count++;
 
        width = 1;
@@ -1764,7 +1764,7 @@ RTLIL::Memory::Memory()
 
 RTLIL::Cell::Cell() : module(nullptr)
 {
-       unsigned int hashidx_count = 0;
+       static unsigned int hashidx_count = 0;
        hashidx_ = hashidx_count++;
 }
 
index 8cf707999e98da3f5422bcbd05091989fb1ace29..f759a014f58188d75e90c9f04d1e3bda40d69dab 100644 (file)
@@ -712,7 +712,7 @@ struct RTLIL::Monitor
        unsigned int hash() const { return hashidx_; }
 
        Monitor() {
-               unsigned int hashidx_count = 0;
+               static unsigned int hashidx_count = 0;
                hashidx_ = hashidx_count++;
        }