Internals: UINFO now includes newline itself. No functional change.

This commit is contained in:
Wilson Snyder
2025-05-22 20:29:32 -04:00
parent 091be59f0d
commit 46c7b69c64
129 changed files with 1259 additions and 1287 deletions
+23 -27
View File
@@ -459,9 +459,9 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl {
void visit(AstNode* nodep) override { iterateChildren(nodep); }
void visit(AstNodeModule* nodep) override {
UINFO(4, "Start checking " << nodep->prettyNameQ() << "\n");
UINFO(4, "Start checking " << nodep->prettyNameQ());
if (!VN_IS(nodep, Module)) {
UINFO(4, "Skip " << nodep->prettyNameQ() << "\n");
UINFO(4, "Skip " << nodep->prettyNameQ());
return;
}
UASSERT_OBJ(!m_modp, m_modp, "Nested module declaration");
@@ -522,7 +522,7 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl {
}
}
void visit(AstPin* nodep) override {
UINFO(5, nodep->modVarp()->prettyNameQ() << " pin \n");
UINFO(5, nodep->modVarp()->prettyNameQ() << " pin ");
AstNode* const exprp = nodep->exprp();
if (!exprp) return; // Not connected pin
m_foundTargetVar.clear();
@@ -548,7 +548,7 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl {
if (!nodep->attrSplitVar()) return; // Nothing to do
if (!cannotSplitReason(nodep)) {
m_refs.registerVar(nodep);
UINFO(4, nodep->name() << " is added to candidate list.\n");
UINFO(4, nodep->name() << " is added to candidate list.");
}
}
void visit(AstVarRef* nodep) override {
@@ -559,7 +559,7 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl {
}
}
void visit(AstVarXRef* nodep) override {
UINFO(4, nodep->varp() << " Has hierarchical reference\n");
UINFO(4, nodep->varp() << " Has hierarchical reference");
m_forPackedSplit.m_hasXref.emplace(nodep->varp());
}
void visit(AstSel* nodep) override {
@@ -570,7 +570,7 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl {
if (AstVarRef* const refp = isTargetVref(nodep->fromp())) {
const AstConst* const indexp = VN_CAST(nodep->bitp(), Const);
if (indexp) { // OK
UINFO(4, "add " << nodep << " for " << refp->varp()->prettyName() << "\n");
UINFO(4, "add " << nodep << " for " << refp->varp()->prettyName());
if (indexp->toSInt() < outerMostSizeOfUnpackedArray(refp->varp())) {
m_refs.tryAdd(m_contextp, refp, nodep, indexp->toSInt(), m_inFTaskp);
} else {
@@ -597,7 +597,7 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl {
nodep->declRange().ascending()};
UASSERT_OBJ(dtypep->lo() <= selRange.lo() && selRange.hi() <= dtypep->hi(), nodep,
"Range check for AstSliceSel must have been finished in V3Width.cpp");
UINFO(4, "add " << nodep << " for " << refp->varp()->prettyName() << "\n");
UINFO(4, "add " << nodep << " for " << refp->varp()->prettyName());
m_refs.tryAdd(m_contextp, refp, nodep, nodep->declRange().hi(),
nodep->declRange().lo(), m_inFTaskp);
} else {
@@ -618,7 +618,7 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl {
AstVar* const varp = newVar(fl, VVarType::VAR, name, dtypep);
// Variable will be registered in the caller side.
UINFO(4, varp->prettyNameQ()
<< " is created lsb:" << dtypep->lo() << " msb:" << dtypep->hi() << "\n");
<< " is created lsb:" << dtypep->lo() << " msb:" << dtypep->hi());
// Use AstAssign if true, otherwise AstAssignW
const bool use_simple_assign
= (context && VN_IS(context, NodeFTaskRef)) || (assignp && VN_IS(assignp, Assign));
@@ -629,7 +629,7 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl {
AstNodeExpr* rhsp = new AstArraySel{
fl, newVarRef(fl, varp, !lvalue ? VAccess::WRITE : VAccess::READ), i};
AstNode* const refp = lhsp;
UINFO(9, "Creating assign idx:" << i << " + " << start_idx << "\n");
UINFO(9, "Creating assign idx:" << i << " + " << start_idx);
if (!lvalue) std::swap(lhsp, rhsp);
AstNode* newassignp;
if (use_simple_assign) {
@@ -684,7 +684,7 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl {
for (const auto& pair : refs) {
UINFO(4, "In module " << m_modp->name() << " var " << pair.first->prettyNameQ()
<< " which has " << pair.second.size()
<< " refs will be split.\n");
<< " refs will be split.");
AstVar* const varp = pair.first;
AstNode* insertp = varp;
const AstUnpackArrayDType* const dtypep
@@ -730,8 +730,7 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl {
refp->access(), ref.ftask());
newp = newrefp;
refp->varp()->addNextHere(newrefp->varp());
UINFO(4,
"Create " << newrefp->varp()->prettyNameQ() << " for " << refp << "\n");
UINFO(4, "Create " << newrefp->varp()->prettyNameQ() << " for " << refp);
}
ref.nodep()->replaceWith(newp);
pushDeletep(ref.nodep());
@@ -760,7 +759,7 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl {
m_refs.swap(next);
const size_t n = collapse(next);
UINFO(4, n << " Variables are split " << trial << " th trial in "
<< m_modp->prettyNameQ() << '\n');
<< m_modp->prettyNameQ());
if (trial == 0) m_numSplit += n;
}
doDeletes();
@@ -784,7 +783,7 @@ public:
const std::pair<uint32_t, uint32_t> dim = nodep->dtypep()->dimensions(false);
UINFO(7, nodep->prettyNameQ()
<< " pub:" << nodep->isSigPublic() << " pri:" << nodep->isPrimaryIO()
<< " io:" << nodep->isInout() << " typ:" << nodep->varType() << "\n");
<< " io:" << nodep->isInout() << " typ:" << nodep->varType());
const char* reason = nullptr;
// Public variable cannot be split.
// at least one unpacked dimension must exist
@@ -792,8 +791,7 @@ public:
reason = "it is not an unpacked array";
if (!reason) reason = cannotSplitVarCommonReason(nodep);
if (reason) {
UINFO(5,
"Check " << nodep->prettyNameQ() << " cannot split because" << reason << ".\n");
UINFO(5, "Check " << nodep->prettyNameQ() << " cannot split because" << reason);
}
return reason;
}
@@ -980,7 +978,7 @@ class SplitPackedVarVisitor final : public VNVisitor, public SplitVarImpl {
}
} else { // Finally find a good candidate
const bool inserted = m_refs.emplace(nodep, PackedVarRef{nodep}).second;
if (inserted) UINFO(4, nodep->prettyNameQ() << " is added to candidate list.\n");
if (inserted) UINFO(4, nodep->prettyNameQ() << " is added to candidate list.");
}
}
void visit(AstVarRef* nodep) override {
@@ -995,7 +993,7 @@ class SplitPackedVarVisitor final : public VNVisitor, public SplitVarImpl {
refit->second.append(PackedVarRefEntry{nodep, basicp->lo(), varp->width()},
nodep->access());
UINFO(5, varp->prettyName()
<< " Entire bit of [" << basicp->lo() << "+:" << varp->width() << "] \n");
<< " Entire bit of [" << basicp->lo() << "+:" << varp->width() << "]");
}
void visit(AstSel* nodep) override {
const AstVarRef* const vrefp = VN_CAST(nodep->fromp(), VarRef);
@@ -1022,17 +1020,17 @@ class SplitPackedVarVisitor final : public VNVisitor, public SplitVarImpl {
vrefp->access());
UINFO(5, varp->prettyName()
<< " [" << consts[0]->toSInt() << ":+" << consts[1]->toSInt()
<< "] lsb:" << refit->second.basicp()->lo() << "\n");
<< "] lsb:" << refit->second.basicp()->lo());
} else {
if (varp->attrSplitVar()) {
warnNoSplit(vrefp->varp(), nodep, "its bit range cannot be determined statically");
varp->attrSplitVar(false);
}
if (!consts[0]) {
UINFO(4, "LSB " << nodep->lsbp() << " is expected to be constant, but not\n");
UINFO(4, "LSB " << nodep->lsbp() << " is expected to be constant, but not");
}
if (!consts[1]) {
UINFO(4, "WIDTH " << nodep->widthp() << " is expected to be constant, but not\n");
UINFO(4, "WIDTH " << nodep->widthp() << " is expected to be constant, but not");
}
m_refs.erase(varp);
iterateChildren(nodep);
@@ -1115,8 +1113,7 @@ class SplitPackedVarVisitor final : public VNVisitor, public SplitVarImpl {
// newvar.varp()->trace(varp->isTrace());
m_netp->typeTablep()->addTypesp(dtypep);
varp->addNextHere(newvar.varp());
UINFO(4, newvar.varp()->prettyNameQ()
<< " is added for " << varp->prettyNameQ() << '\n');
UINFO(4, newvar.varp()->prettyNameQ() << " is added for " << varp->prettyNameQ());
}
}
static void updateReferences(AstVar* varp, PackedVarRef& pref,
@@ -1175,7 +1172,7 @@ class SplitPackedVarVisitor final : public VNVisitor, public SplitVarImpl {
ref.dedup();
UINFO(4, "In module " << m_modp->name() << " var " << varp->prettyNameQ()
<< " which has " << ref.lhs().size() << " lhs refs and "
<< ref.rhs().size() << " rhs refs will be split.\n");
<< ref.rhs().size() << " rhs refs will be split.");
std::vector<SplitNewVar> vars
= ref.splitPlan(varp, !varp->isTrace()); // If traced, all bit must be kept
if (vars.empty()) continue;
@@ -1347,8 +1344,7 @@ public:
reason = "its type is unknown"; // LCOV_EXCL_LINE
}
if (reason) {
UINFO(5,
"Check " << nodep->prettyNameQ() << " cannot split because" << reason << endl);
UINFO(5, "Check " << nodep->prettyNameQ() << " cannot split because" << reason);
}
return reason;
}
@@ -1362,7 +1358,7 @@ const char* SplitVarImpl::cannotSplitPackedVarReason(const AstVar* varp) {
// Split class functions
void V3SplitVar::splitVariable(AstNetlist* nodep) {
UINFO(2, __FUNCTION__ << ": " << endl);
UINFO(2, __FUNCTION__ << ":");
SplitVarRefs refs;
{
const SplitUnpackedVarVisitor visitor{nodep};