diff options
author | Clifford Wolf <clifford@clifford.at> | 2015-11-27 19:46:47 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2015-11-27 19:46:47 +0100 |
commit | 32f5ee117cd419e35db9f7ea15b958e1d545ecea (patch) | |
tree | 5fdca08cb093a3e7eed02c9982592607171c6e8b /frontends | |
parent | a7ffb8569039736e041c92b272995159145430a6 (diff) | |
download | yosys-32f5ee117cd419e35db9f7ea15b958e1d545ecea.tar.gz yosys-32f5ee117cd419e35db9f7ea15b958e1d545ecea.tar.bz2 yosys-32f5ee117cd419e35db9f7ea15b958e1d545ecea.zip |
Fixed performance bug in ilang parser
Diffstat (limited to 'frontends')
-rw-r--r-- | frontends/ilang/ilang_parser.y | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/frontends/ilang/ilang_parser.y b/frontends/ilang/ilang_parser.y index b49fd6740..8622e0b89 100644 --- a/frontends/ilang/ilang_parser.y +++ b/frontends/ilang/ilang_parser.y @@ -50,6 +50,7 @@ USING_YOSYS_NAMESPACE int integer; YOSYS_NAMESPACE_PREFIX RTLIL::Const *data; YOSYS_NAMESPACE_PREFIX RTLIL::SigSpec *sigspec; + std::vector<YOSYS_NAMESPACE_PREFIX RTLIL::SigSpec> *rsigspec; } %token <string> TOK_ID TOK_VALUE TOK_STRING @@ -60,6 +61,7 @@ USING_YOSYS_NAMESPACE %token TOK_UPDATE TOK_PROCESS TOK_END TOK_INVALID TOK_EOL TOK_OFFSET %token TOK_PARAMETER TOK_ATTRIBUTE TOK_MEMORY TOK_SIZE TOK_SIGNED TOK_UPTO +%type <rsigspec> sigspec_list_reversed %type <sigspec> sigspec sigspec_list %type <integer> sync_type %type <data> constant @@ -389,16 +391,20 @@ sigspec: $$ = $2; }; -sigspec_list: - sigspec_list sigspec { - $$ = new RTLIL::SigSpec; - $$->append(*$2); - $$->append(*$1); - delete $1; +sigspec_list_reversed: + sigspec_list_reversed sigspec { + $$->push_back(*$2); delete $2; } | /* empty */ { + $$ = new std::vector<RTLIL::SigSpec>; + }; + +sigspec_list: sigspec_list_reversed { $$ = new RTLIL::SigSpec; + for (auto it = $1->rbegin(); it != $1->rend(); it++) + $$->append(*it); + delete $1; }; conn_stmt: |