mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-28 03:15:50 +00:00
cxxrtl: minimize stack space consumed by debug_info()
.
This commit uses parameter packs to sink `debug_item()` construction into the `debug_info()`-specific `add()` overload. This makes the stack space use sub-linear in typical case rather than linear (which is still the worst case). Oddly, the stack slots that get allocated now are all for the `0` literal for `lsb_offset`. This could be fixed by allocating numbers statically but the existing reduction in stack use of ~98% for a representative example (Minerva SoC) should be enough.
This commit is contained in:
parent
80798daf53
commit
6e003e1af6
2 changed files with 35 additions and 27 deletions
|
@ -1467,8 +1467,9 @@ struct debug_items {
|
|||
}
|
||||
|
||||
// This overload exists to reduce excessive stack slot allocation in `CXXRTL_EXTREMELY_COLD void debug_info()`.
|
||||
void add(const std::string &base_path, const char *path, debug_item &&item, const char *serialized_item_attrs) {
|
||||
add(base_path + path, std::move(item), metadata::deserialize(serialized_item_attrs));
|
||||
template<class... T>
|
||||
void add(const std::string &base_path, const char *path, const char *serialized_item_attrs, T&&... args) {
|
||||
add(base_path + path, debug_item(std::forward<T>(args)...), metadata::deserialize(serialized_item_attrs));
|
||||
}
|
||||
|
||||
size_t count(const std::string &path) const {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue