mirror of
https://github.com/YosysHQ/yosys
synced 2025-09-30 05:09:04 +00:00
Make ID::
constants be StaticIdString
s for better optimization.
Their internal indexes will be known at compile time, like we already support for the `ID()` macro.
This commit is contained in:
parent
13a2481da7
commit
effc52fedc
2 changed files with 8 additions and 3 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue