3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-13 04:28:18 +00:00

Fixed performance bug in ilang parser

This commit is contained in:
Clifford Wolf 2015-11-27 19:46:47 +01:00
parent a7ffb85690
commit 32f5ee117c

View file

@ -50,6 +50,7 @@ USING_YOSYS_NAMESPACE
int integer; int integer;
YOSYS_NAMESPACE_PREFIX RTLIL::Const *data; YOSYS_NAMESPACE_PREFIX RTLIL::Const *data;
YOSYS_NAMESPACE_PREFIX RTLIL::SigSpec *sigspec; YOSYS_NAMESPACE_PREFIX RTLIL::SigSpec *sigspec;
std::vector<YOSYS_NAMESPACE_PREFIX RTLIL::SigSpec> *rsigspec;
} }
%token <string> TOK_ID TOK_VALUE TOK_STRING %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_UPDATE TOK_PROCESS TOK_END TOK_INVALID TOK_EOL TOK_OFFSET
%token TOK_PARAMETER TOK_ATTRIBUTE TOK_MEMORY TOK_SIZE TOK_SIGNED TOK_UPTO %token TOK_PARAMETER TOK_ATTRIBUTE TOK_MEMORY TOK_SIZE TOK_SIGNED TOK_UPTO
%type <rsigspec> sigspec_list_reversed
%type <sigspec> sigspec sigspec_list %type <sigspec> sigspec sigspec_list
%type <integer> sync_type %type <integer> sync_type
%type <data> constant %type <data> constant
@ -389,16 +391,20 @@ sigspec:
$$ = $2; $$ = $2;
}; };
sigspec_list: sigspec_list_reversed:
sigspec_list sigspec { sigspec_list_reversed sigspec {
$$ = new RTLIL::SigSpec; $$->push_back(*$2);
$$->append(*$2);
$$->append(*$1);
delete $1;
delete $2; delete $2;
} | } |
/* empty */ { /* empty */ {
$$ = new std::vector<RTLIL::SigSpec>;
};
sigspec_list: sigspec_list_reversed {
$$ = new RTLIL::SigSpec; $$ = new RTLIL::SigSpec;
for (auto it = $1->rbegin(); it != $1->rend(); it++)
$$->append(*it);
delete $1;
}; };
conn_stmt: conn_stmt: