mirror of
https://github.com/verilator/verilator.git
synced 2026-09-04 08:33:38 +02:00
Internals: Add cloneTreePure to prepare for side effect check.
Use cloneTreePure when what is being cloned must be side-effect free. Use cloneTree when safe to contain side effects (e.g. cloning module).
This commit is contained in:
+6
-6
@@ -257,7 +257,7 @@ private:
|
||||
// Create equivalent of VL_SIGNONES_(node_width)
|
||||
constzerop = new AstNegate{
|
||||
nodep->fileline(),
|
||||
new AstShiftR{nodep->fileline(), nodep->lhsp()->cloneTree(false),
|
||||
new AstShiftR{nodep->fileline(), nodep->lhsp()->cloneTreePure(false),
|
||||
new AstConst(nodep->fileline(), m1value), nodep->width()}};
|
||||
} else {
|
||||
constzerop = new AstConst{nodep->fileline(), AstConst::WidthedValue{},
|
||||
@@ -269,10 +269,10 @@ private:
|
||||
= new AstConst(nodep->fileline(), AstConst::WidthedValue{},
|
||||
nodep->rhsp()->widthMin(), m1value);
|
||||
constwidthp->dtypeFrom(nodep->rhsp()); // unsigned
|
||||
AstCond* const newp = new AstCond{
|
||||
nodep->fileline(),
|
||||
new AstGte{nodep->fileline(), constwidthp, nodep->rhsp()->cloneTree(false)},
|
||||
nodep, constzerop};
|
||||
AstCond* const newp = new AstCond{nodep->fileline(),
|
||||
new AstGte{nodep->fileline(), constwidthp,
|
||||
nodep->rhsp()->cloneTreePure(false)},
|
||||
nodep, constzerop};
|
||||
replaceHandle.relink(newp);
|
||||
}
|
||||
}
|
||||
@@ -370,7 +370,7 @@ private:
|
||||
UINFO(4, "Autoflush " << nodep << endl);
|
||||
nodep->addNextHere(
|
||||
new AstFFlush{nodep->fileline(),
|
||||
nodep->filep() ? nodep->filep()->cloneTree(true) : nullptr});
|
||||
nodep->filep() ? nodep->filep()->cloneTreePure(true) : nullptr});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user