3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-24 01:25:33 +00:00

read_liberty: Faster input handling for the liberty lexer

The lexer for liberty files was using istream's `get` and `unget` which
are notorious for bad performance and that showed up during profiling.

This replaces the direct `istream` use with a custom LibertyInputStream
that does its own buffering to provide `get` and `unget` that behave the
same way but are implemented with a fast path that is easy to inline and
optimize.
This commit is contained in:
Jannis Harder 2025-04-01 13:48:44 +02:00
parent c08f72b806
commit 119e998f12
3 changed files with 83 additions and 1 deletions

View file

@ -128,6 +128,12 @@
# error "C++17 or later compatible compiler is required"
#endif
#if defined(__has_cpp_attribute) && __has_cpp_attribute(gnu::cold)
# define YS_COLD [[gnu::cold]]
#else
# define YS_COLD
#endif
#include "kernel/io.h"
YOSYS_NAMESPACE_BEGIN