Internals: Add AstLoop statement constructor. No functional change.
This commit is contained in:
parent
e65f052abf
commit
9155e2529b
|
|
@ -795,8 +795,10 @@ class AstLoop final : public AstNodeStmt {
|
||||||
// @astgen op2 := contsp : List[AstNode] // Empty after LinkJump
|
// @astgen op2 := contsp : List[AstNode] // Empty after LinkJump
|
||||||
VOptionBool m_unroll; // Full, none, or default unrolling
|
VOptionBool m_unroll; // Full, none, or default unrolling
|
||||||
public:
|
public:
|
||||||
explicit AstLoop(FileLine* fl)
|
explicit AstLoop(FileLine* fl, AstNode* stmtsp = nullptr)
|
||||||
: ASTGEN_SUPER_Loop(fl) {}
|
: ASTGEN_SUPER_Loop(fl) {
|
||||||
|
addStmtsp(stmtsp);
|
||||||
|
}
|
||||||
ASTGEN_MEMBERS_AstLoop;
|
ASTGEN_MEMBERS_AstLoop;
|
||||||
void dump(std::ostream& str) const override;
|
void dump(std::ostream& str) const override;
|
||||||
void dumpJson(std::ostream& str) const override;
|
void dumpJson(std::ostream& str) const override;
|
||||||
|
|
|
||||||
|
|
@ -3561,8 +3561,7 @@ statement_item<nodeStmtp>: // IEEE: statement_item
|
||||||
//
|
//
|
||||||
// do/for/forever/while loops all modelled as AstLoop
|
// do/for/forever/while loops all modelled as AstLoop
|
||||||
| yDO stmt yWHILE '(' expr ')' ';'
|
| yDO stmt yWHILE '(' expr ')' ';'
|
||||||
{ AstLoop* const loopp = new AstLoop{$1};
|
{ AstLoop* const loopp = new AstLoop{$1, $2};
|
||||||
loopp->addStmtsp($2);
|
|
||||||
loopp->addContsp(new AstLoopTest{$<fl>5, loopp, $5});
|
loopp->addContsp(new AstLoopTest{$<fl>5, loopp, $5});
|
||||||
$$ = loopp; }
|
$$ = loopp; }
|
||||||
| yFOR '(' { VARRESET_NONLIST(UNKNOWN); } for_initializationE ';' exprE ';' for_stepE ')' stmt
|
| yFOR '(' { VARRESET_NONLIST(UNKNOWN); } for_initializationE ';' exprE ';' for_stepE ')' stmt
|
||||||
|
|
@ -3574,8 +3573,7 @@ statement_item<nodeStmtp>: // IEEE: statement_item
|
||||||
blockp->addStmtsp(loopp);
|
blockp->addStmtsp(loopp);
|
||||||
$$ = blockp; }
|
$$ = blockp; }
|
||||||
| yFOREVER stmt
|
| yFOREVER stmt
|
||||||
{ AstLoop* const loopp = new AstLoop{$1};
|
{ AstLoop* const loopp = new AstLoop{$1, $2};
|
||||||
loopp->addStmtsp($2);
|
|
||||||
$$ = loopp; }
|
$$ = loopp; }
|
||||||
| yWHILE '(' expr ')' stmt
|
| yWHILE '(' expr ')' stmt
|
||||||
{ AstLoop* const loopp = new AstLoop{$1};
|
{ AstLoop* const loopp = new AstLoop{$1};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue