mirror of
https://github.com/verilator/verilator.git
synced 2026-09-01 10:27:04 +02:00
Internals: More const. No functional change intended.
This commit is contained in:
+21
-19
@@ -322,7 +322,7 @@ protected:
|
||||
vertexp = vertexp->verticesNextp()) {
|
||||
if (!vertexp->outBeginp() && dynamic_cast<SplitVarStdVertex*>(vertexp)) {
|
||||
if (debug() >= 9) {
|
||||
SplitVarStdVertex* const stdp = static_cast<SplitVarStdVertex*>(vertexp);
|
||||
const SplitVarStdVertex* const stdp = static_cast<SplitVarStdVertex*>(vertexp);
|
||||
UINFO(0, "Will prune deps on var " << stdp->nodep() << endl);
|
||||
stdp->nodep()->dumpTree(cout, "- ");
|
||||
}
|
||||
@@ -477,7 +477,8 @@ protected:
|
||||
// vertexes not involved with this step as unimportant
|
||||
for (V3GraphVertex* vertexp = m_graph.verticesBeginp(); vertexp;
|
||||
vertexp = vertexp->verticesNextp()) {
|
||||
if (SplitLogicVertex* const vvertexp = dynamic_cast<SplitLogicVertex*>(vertexp)) {
|
||||
if (const SplitLogicVertex* const vvertexp
|
||||
= dynamic_cast<SplitLogicVertex*>(vertexp)) {
|
||||
if (!vvertexp->user()) {
|
||||
for (V3GraphEdge* edgep = vertexp->inBeginp(); edgep;
|
||||
edgep = edgep->inNextp()) {
|
||||
@@ -502,7 +503,7 @@ protected:
|
||||
for (AstNode* nextp = nodep; nextp; nextp = nextp->nextp()) {
|
||||
SplitLogicVertex* const vvertexp
|
||||
= reinterpret_cast<SplitLogicVertex*>(nextp->user3p());
|
||||
uint32_t color = vvertexp->color();
|
||||
const uint32_t color = vvertexp->color();
|
||||
UASSERT_OBJ(color, nextp, "No node color assigned");
|
||||
if (lastOfColor[color]) {
|
||||
new SplitStrictEdge(&m_graph, lastOfColor[color], vvertexp);
|
||||
@@ -526,7 +527,7 @@ protected:
|
||||
std::multimap<uint32_t, AstNode*> rankMap;
|
||||
int currOrder = 0; // Existing sequence number of assignment
|
||||
for (AstNode* nextp = nodep; nextp; nextp = nextp->nextp()) {
|
||||
SplitLogicVertex* const vvertexp
|
||||
const SplitLogicVertex* const vvertexp
|
||||
= reinterpret_cast<SplitLogicVertex*>(nextp->user3p());
|
||||
rankMap.emplace(vvertexp->rank(), nextp);
|
||||
nextp->user4(++currOrder); // Record current ordering
|
||||
@@ -536,7 +537,7 @@ protected:
|
||||
bool leaveAlone = true;
|
||||
int newOrder = 0; // New sequence number of assignment
|
||||
for (auto it = rankMap.cbegin(); it != rankMap.cend(); ++it) {
|
||||
AstNode* const nextp = it->second;
|
||||
const AstNode* const nextp = it->second;
|
||||
if (++newOrder != nextp->user4()) leaveAlone = false;
|
||||
}
|
||||
if (leaveAlone) {
|
||||
@@ -650,8 +651,9 @@ public:
|
||||
private:
|
||||
void trackNode(AstNode* nodep) {
|
||||
if (nodep->user3p()) {
|
||||
SplitLogicVertex* const vertexp = reinterpret_cast<SplitLogicVertex*>(nodep->user3p());
|
||||
uint32_t color = vertexp->color();
|
||||
const SplitLogicVertex* const vertexp
|
||||
= reinterpret_cast<SplitLogicVertex*>(nodep->user3p());
|
||||
const uint32_t color = vertexp->color();
|
||||
m_colors.insert(color);
|
||||
UINFO(8, " SVL " << vertexp << " has color " << color << "\n");
|
||||
|
||||
@@ -681,7 +683,7 @@ private:
|
||||
|
||||
class EmitSplitVisitor final : public AstNVisitor {
|
||||
// MEMBERS
|
||||
AstAlways* const m_origAlwaysp; // Block that *this will split
|
||||
const AstAlways* const m_origAlwaysp; // Block that *this will split
|
||||
const IfColorVisitor* const m_ifColorp; // Digest of results of prior coloring
|
||||
|
||||
// Map each color to our current place within the color's new always
|
||||
@@ -747,8 +749,8 @@ protected:
|
||||
UASSERT_OBJ(nodep->user3p(), nodep, "null user3p in V3Split leaf");
|
||||
|
||||
// Clone the leaf into its new always block
|
||||
SplitLogicVertex* const vxp = reinterpret_cast<SplitLogicVertex*>(nodep->user3p());
|
||||
uint32_t color = vxp->color();
|
||||
const SplitLogicVertex* const vxp = reinterpret_cast<SplitLogicVertex*>(nodep->user3p());
|
||||
const uint32_t color = vxp->color();
|
||||
AstNode* const clonedp = nodep->cloneTree(false);
|
||||
m_addAfter[color]->addNextHere(clonedp);
|
||||
m_addAfter[color] = clonedp;
|
||||
@@ -765,7 +767,7 @@ protected:
|
||||
AstSplitPlaceholder* const else_placeholderp = makePlaceholderp();
|
||||
AstIf* const clonep = new AstIf(nodep->fileline(), nodep->condp()->cloneTree(true),
|
||||
if_placeholderp, else_placeholderp);
|
||||
AstIf* const origp = VN_CAST(nodep, If);
|
||||
const AstIf* const origp = VN_CAST(nodep, If);
|
||||
if (origp) {
|
||||
// Preserve pragmas from unique if's
|
||||
// so assertions work properly
|
||||
@@ -817,7 +819,7 @@ private:
|
||||
std::unordered_map<AstAlways*, AlwaysVec> m_replaceBlocks;
|
||||
|
||||
// AstNodeIf* whose condition we're currently visiting
|
||||
AstNode* m_curIfConditional = nullptr;
|
||||
const AstNode* m_curIfConditional = nullptr;
|
||||
|
||||
// CONSTRUCTORS
|
||||
public:
|
||||
@@ -832,7 +834,7 @@ public:
|
||||
for (AlwaysVec::iterator addme = it->second.begin(); addme != it->second.end();
|
||||
++addme) {
|
||||
origp->addNextHere(*addme);
|
||||
RemovePlaceholdersVisitor removePlaceholders(*addme);
|
||||
RemovePlaceholdersVisitor{*addme};
|
||||
}
|
||||
origp->unlinkFrBack(); // Without next
|
||||
VL_DO_DANGLING(origp->deleteTree(), origp);
|
||||
@@ -847,7 +849,7 @@ protected:
|
||||
// Each 'if' depends on rvalues in its own conditional ONLY,
|
||||
// not rvalues in the if/else bodies.
|
||||
for (auto it = m_stmtStackps.cbegin(); it != m_stmtStackps.cend(); ++it) {
|
||||
AstNodeIf* const ifNodep = VN_CAST((*it)->nodep(), NodeIf);
|
||||
const AstNodeIf* const ifNodep = VN_CAST((*it)->nodep(), NodeIf);
|
||||
if (ifNodep && (m_curIfConditional != ifNodep)) continue;
|
||||
new SplitRVEdge(&m_graph, *it, vstdp);
|
||||
}
|
||||
@@ -871,15 +873,15 @@ protected:
|
||||
// inputs) prune all edges that depend on the 'if'.
|
||||
for (V3GraphVertex* vertexp = m_graph.verticesBeginp(); vertexp;
|
||||
vertexp = vertexp->verticesNextp()) {
|
||||
SplitLogicVertex* const logicp = dynamic_cast<SplitLogicVertex*>(vertexp);
|
||||
const SplitLogicVertex* const logicp = dynamic_cast<SplitLogicVertex*>(vertexp);
|
||||
if (!logicp) continue;
|
||||
|
||||
AstNodeIf* const ifNodep = VN_CAST(logicp->nodep(), NodeIf);
|
||||
const AstNodeIf* const ifNodep = VN_CAST(logicp->nodep(), NodeIf);
|
||||
if (!ifNodep) continue;
|
||||
|
||||
bool pruneMe = true;
|
||||
for (V3GraphEdge* edgep = logicp->outBeginp(); edgep; edgep = edgep->outNextp()) {
|
||||
SplitEdge* const oedgep = dynamic_cast<SplitEdge*>(edgep);
|
||||
const SplitEdge* const oedgep = dynamic_cast<SplitEdge*>(edgep);
|
||||
if (!oedgep->ignoreThisStep()) {
|
||||
// This if conditional depends on something we can't
|
||||
// prune -- a variable generated in the current block.
|
||||
@@ -889,7 +891,7 @@ protected:
|
||||
// give a hint about why...
|
||||
if (debug() >= 9) {
|
||||
V3GraphVertex* vxp = oedgep->top();
|
||||
SplitNodeVertex* const nvxp = dynamic_cast<SplitNodeVertex*>(vxp);
|
||||
const SplitNodeVertex* const nvxp = dynamic_cast<SplitNodeVertex*>(vxp);
|
||||
UINFO(0, "Cannot prune if-node due to edge "
|
||||
<< oedgep << " pointing to node " << nvxp->nodep() << endl);
|
||||
nvxp->nodep()->dumpTree(cout, "- ");
|
||||
@@ -936,7 +938,7 @@ protected:
|
||||
|
||||
// Map each AstNodeIf to the set of colors (split always blocks)
|
||||
// it must participate in. Also find the whole set of colors.
|
||||
IfColorVisitor ifColor{nodep};
|
||||
const IfColorVisitor ifColor{nodep};
|
||||
|
||||
if (ifColor.colors().size() > 1) {
|
||||
// Counting original always blocks rather than newly-split
|
||||
|
||||
Reference in New Issue
Block a user