Remove dead genblk code & some cleanups.

This commit is contained in:
Wilson Snyder 2020-02-25 18:57:51 -05:00
parent 93ac79981b
commit 5b83484f20
5 changed files with 8 additions and 55 deletions

View File

@ -2332,21 +2332,6 @@ public:
//######################################################################
class AstGenerate : public AstNode {
// A Generate/end block
// Parents: MODULE
// Children: modItems
public:
AstGenerate(FileLine* fl, AstNode* stmtsp)
: ASTGEN_SUPER(fl) {
addNOp1p(stmtsp);
}
ASTNODE_NODE_FUNCS(Generate)
// op1 = Statements
AstNode* stmtsp() const { return op1p(); } // op1 = List of statements
void addStmtp(AstNode* nodep) { addOp1p(nodep); }
};
class AstParseRef : public AstNode {
// A reference to a variable, function or task
// We don't know which at parse time due to bison constraints

View File

@ -76,7 +76,7 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
}
virtual void visit(AstBegin* nodep) VL_OVERRIDE {
if (nodep->unnamed()) {
if (nodep->name() == "") {
putbs("begin\n");
} else {
putbs("begin : "+nodep->name()+"\n");
@ -84,11 +84,6 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
iterateChildren(nodep);
puts("end\n");
}
virtual void visit(AstGenerate* nodep) VL_OVERRIDE {
putfs(nodep, "generate\n");
iterateChildren(nodep);
putqs(nodep, "end\n");
}
virtual void visit(AstFinal* nodep) VL_OVERRIDE {
putfs(nodep, "final begin\n");
iterateChildren(nodep);

View File

@ -683,7 +683,6 @@ class LinkDotFindVisitor : public AstNVisitor {
string m_scope; // Scope text
AstBegin* m_beginp; // Current Begin/end block
AstNodeFTask* m_ftaskp; // Current function/task
bool m_inGenerate; // Inside a generate
bool m_inRecursion; // Inside a recursive module
int m_paramNum; // Parameter number, for position based connection
int m_beginNum; // Begin block number, 0=none seen
@ -891,16 +890,6 @@ class LinkDotFindVisitor : public AstNVisitor {
nodep->user1p(m_curSymp);
iterateChildren(nodep);
}
virtual void visit(AstGenerate* nodep) VL_OVERRIDE {
// Begin: ... blocks often replicate under genif/genfor, so simply
// suppress duplicate checks. See t_gen_forif.v for an example.
bool lastInGen = m_inGenerate;
{
m_inGenerate = true;
iterateChildren(nodep);
}
m_inGenerate = lastInGen;
}
virtual void visit(AstBegin* nodep) VL_OVERRIDE {
UINFO(5," "<<nodep<<endl);
// Rename "genblk"s to include a number
@ -909,9 +898,6 @@ class LinkDotFindVisitor : public AstNVisitor {
++m_beginNum;
nodep->name(nodep->name()+cvtToStr(m_beginNum));
}
// Just for loop index, make special name. The [00] is so it will "dearray" to same
// name as after we expand the GENFOR
if (nodep->genforp()) nodep->name(nodep->name());
}
// All blocks are numbered in the standard, IE we start with "genblk1" even if only one.
if (nodep->name()=="" && nodep->unnamed()) {
@ -1202,7 +1188,6 @@ public:
m_statep = statep;
m_beginp = NULL;
m_ftaskp = NULL;
m_inGenerate = false;
m_inRecursion = false;
m_paramNum = 0;
m_beginNum = 0;

View File

@ -431,20 +431,6 @@ private:
}
// Generate Statements
virtual void visit(AstGenerate* nodep) VL_OVERRIDE {
if (debug()>=9) nodep->dumpTree(cout, "-genin: ");
iterateChildren(nodep);
// After expanding the generate, all statements under it can be moved
// up, and the generate block deleted as it's not relevant
if (AstNode* stmtsp = nodep->stmtsp()) {
stmtsp->unlinkFrBackWithNext();
nodep->replaceWith(stmtsp);
if (debug()>=9) stmtsp->dumpTree(cout, "-genout: ");
} else {
nodep->unlinkFrBack();
}
VL_DO_DANGLING(nodep->deleteTree(), nodep);
}
virtual void visit(AstGenIf* nodep) VL_OVERRIDE {
UINFO(9," GENIF "<<nodep<<endl);
iterateAndNextNull(nodep->condp());

View File

@ -1155,7 +1155,7 @@ interface_item<nodep>: // IEEE: interface_item + non_port_interface_item
;
interface_generate_region<nodep>: // ==IEEE: generate_region
yGENERATE interface_itemList yENDGENERATE { $$ = new AstGenerate($1, $2); }
yGENERATE interface_itemList yENDGENERATE { $$ = $2; }
| yGENERATE yENDGENERATE { $$ = NULL; }
;
@ -2035,7 +2035,7 @@ bind_instantiation<nodep>: // ==IEEE: bind_instantiation
// different, so we copy all rules for checkers.
generate_region<nodep>: // ==IEEE: generate_region
yGENERATE ~c~genItemList yENDGENERATE { $$ = new AstGenerate($1, $2); }
yGENERATE ~c~genItemList yENDGENERATE { $$ = $2; }
| yGENERATE yENDGENERATE { $$ = NULL; }
;
@ -2043,7 +2043,7 @@ generate_region<nodep>: // ==IEEE: generate_region
//UNSUP BISONPRE_COPY(generate_region,{s/~c~/c_/g}) // {copied}
//UNSUP ;
generate_block_or_null<nodep>: // IEEE: generate_block_or_null
generate_block_or_null<nodep>: // IEEE: generate_block_or_null (called from gencase/genif/genfor)
// ';' // is included in
// // IEEE: generate_block
// // Must always return a BEGIN node, or NULL - see GenFor construction
@ -2054,9 +2054,11 @@ generate_block_or_null<nodep>: // IEEE: generate_block_or_null
genItemBegin<nodep>: // IEEE: part of generate_block
yBEGIN ~c~genItemList yEND { $$ = new AstBegin($1,"genblk",$2,true); }
| yBEGIN yEND { $$ = NULL; }
| id ':' yBEGIN ~c~genItemList yEND endLabelE { $$ = new AstBegin($<fl>1,*$1,$4,true); GRAMMARP->endLabel($<fl>6,*$1,$6); }
| id ':' yBEGIN ~c~genItemList yEND endLabelE
{ $$ = new AstBegin($<fl>1,*$1,$4,true); GRAMMARP->endLabel($<fl>6,*$1,$6); }
| id ':' yBEGIN yEND endLabelE { $$ = NULL; GRAMMARP->endLabel($<fl>5,*$1,$5); }
| yBEGIN ':' idAny ~c~ genItemList yEND endLabelE { $$ = new AstBegin($<fl>3,*$3,$4,true); GRAMMARP->endLabel($<fl>6,*$3,$6); }
| yBEGIN ':' idAny ~c~genItemList yEND endLabelE
{ $$ = new AstBegin($<fl>3,*$3,$4,true); GRAMMARP->endLabel($<fl>6,*$3,$6); }
| yBEGIN ':' idAny yEND endLabelE { $$ = NULL; GRAMMARP->endLabel($<fl>5,*$3,$5); }
;