Internals: Favor std::array. No functional change intended.

This commit is contained in:
Wilson Snyder 2025-07-24 02:27:56 -04:00
parent 2287d420ee
commit e995646898
4 changed files with 7 additions and 13 deletions

View File

@ -35,7 +35,7 @@ struct GraphPCNode final {
//
// Unlike the LogicMTasks's, we have no cost info for the generic graph
// accepted by GraphPathChecker, so assume each node has unit cost.
std::array<uint32_t, GraphWay::NUM_WAYS> m_cp;
std::array<uint32_t, GraphWay::NUM_WAYS> m_cp = {};
// Detect if we've seen this node before in a given recursive
// operation. We'll use this in pathExistsInternal() to avoid checking
@ -44,9 +44,7 @@ struct GraphPCNode final {
uint64_t m_seenAtGeneration = 0;
// CONSTRUCTORS
GraphPCNode() {
for (unsigned int& w : m_cp) w = 0;
}
GraphPCNode() {}
~GraphPCNode() = default;
};

View File

@ -332,7 +332,7 @@ private:
// Cost of critical paths going FORWARD from graph-start to the start
// of this vertex, and also going REVERSE from the end of the graph to
// the end of the vertex. Same units as m_cost.
std::array<uint64_t, GraphWay::NUM_WAYS> m_critPathCost;
std::array<uint64_t, GraphWay::NUM_WAYS> m_critPathCost = {};
const uint32_t m_id; // Unique LogicMTask ID number
static uint32_t s_nextId; // Next ID number to use
@ -361,7 +361,6 @@ public:
: V3GraphVertex{graphp}
, m_id{s_nextId++} {
UASSERT(s_nextId < 0xFFFFFFFFUL, "Too many mTaskGraphp");
for (uint64_t& item : m_critPathCost) item = 0;
if (mVtxp) {
m_mVertices.linkBack(mVtxp);
if (const OrderLogicVertex* const olvp = mVtxp->logicp()) {

View File

@ -34,11 +34,11 @@ V3Mutex V3Stats::s_mutex;
class StatsVisitor final : public VNVisitorConst {
struct Counters final {
// Nodes of given type
uint64_t m_statTypeCount[VNType::_ENUM_END];
std::array<uint64_t, VNType::_ENUM_END> m_statTypeCount = {};
// Nodes of given type with given type immediate child
uint64_t m_statAbove[VNType::_ENUM_END][VNType::_ENUM_END];
std::array<std::array<uint64_t, VNType::_ENUM_END>, VNType::_ENUM_END> m_statAbove = {};
// Prediction of given type
uint64_t m_statPred[VBranchPred::_ENUM_END];
std::array<uint64_t, VBranchPred::_ENUM_END> m_statPred = {};
};
// STATE
@ -103,9 +103,6 @@ public:
: m_fastOnly{fastOnly}
, m_accump{fastOnly ? &m_dumpster : &m_counters} {
UINFO(9, "Starting stats, fastOnly=" << fastOnly);
memset(&m_counters, 0, sizeof(m_counters));
memset(&m_dumpster, 0, sizeof(m_dumpster));
iterateConst(nodep);
// Shorthand

View File

@ -293,7 +293,7 @@ class UndrivenVisitor final : public VNVisitorConst {
const VNUser2InUse m_inuser2;
// STATE
std::array<std::vector<UndrivenVarEntry*>, 3> m_entryps; // Nodes to delete when finished
std::array<std::vector<UndrivenVarEntry*>, 3> m_entryps = {}; // Nodes to delete when finished
bool m_inBBox = false; // In black box; mark as driven+used
bool m_inContAssign = false; // In continuous assignment
bool m_inInitialStatic = false; // In InitialStatic