3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-09-30 13:19:05 +00:00

Merge pull request #5378 from rocallahan/static-ID-namespace

Make `ID::` constants be `StaticIdString`s for better optimization
This commit is contained in:
Jannis Harder 2025-09-23 08:25:54 +02:00 committed by GitHub
commit cb9d0b6ff9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View file

@ -46,7 +46,7 @@ int RTLIL::IdString::last_created_idx_[8];
int RTLIL::IdString::last_created_idx_ptr_; int RTLIL::IdString::last_created_idx_ptr_;
#endif #endif
#define X(N) const RTLIL::IdString RTLIL::ID::N(RTLIL::StaticId::N); #define X(_id) const RTLIL::IdString RTLIL::IDInternal::_id(RTLIL::StaticId::_id);
#include "kernel/constids.inc" #include "kernel/constids.inc"
#undef X #undef X

View file

@ -495,9 +495,14 @@ inline bool RTLIL::IdString::operator!=(const RTLIL::StaticIdString &rhs) const
} }
namespace RTLIL { namespace RTLIL {
namespace ID { namespace IDInternal {
#define X(_id) extern const IdString _id; #define X(_id) extern const IdString _id;
#include "kernel/constids.inc" #include "kernel/constids.inc"
#undef X
}
namespace ID {
#define X(_id) constexpr StaticIdString _id(StaticId::_id, IDInternal::_id);
#include "kernel/constids.inc"
#undef X #undef X
} }
} }
@ -508,7 +513,7 @@ struct IdTableEntry {
}; };
constexpr IdTableEntry IdTable[] = { constexpr IdTableEntry IdTable[] = {
#define X(_id) {#_id, RTLIL::StaticIdString(RTLIL::StaticId::_id, RTLIL::ID::_id)}, #define X(_id) {#_id, ID::_id},
#include "kernel/constids.inc" #include "kernel/constids.inc"
#undef X #undef X
}; };