From 818347f99b3a463386277f08bf9778da020fa093 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sun, 13 Nov 2022 09:26:46 -0500 Subject: [PATCH] Internals: Fix some unnecessary member paddings. No functional change intended. --- include/verilated.h | 2 +- src/V3Ast.h | 8 ++++---- src/V3AstNodeDType.h | 4 ++-- src/V3AstNodeOther.h | 39 ++++++++++++++++++++------------------- src/V3Cdc.cpp | 2 +- src/V3EmitCConstInit.h | 2 +- src/V3File.h | 4 ++-- src/V3PreLex.h | 2 +- src/V3String.h | 2 +- src/VlcSource.h | 2 +- src/verilog.y | 14 +++++++------- 11 files changed, 41 insertions(+), 40 deletions(-) diff --git a/include/verilated.h b/include/verilated.h index e07c8f878..09a8c8670 100644 --- a/include/verilated.h +++ b/include/verilated.h @@ -364,8 +364,8 @@ protected: // assumption is that the restore is allowed to pass different arguments struct NonSerializedCommandArgs { // Medium speed - bool m_argVecLoaded = false; // Ever loaded argument list std::vector m_argVec; // Aargument list + bool m_argVecLoaded = false; // Ever loaded argument list } m_args VL_GUARDED_BY(m_argMutex); // Implementation details diff --git a/src/V3Ast.h b/src/V3Ast.h index eaf3f6e58..778b8f252 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -1179,9 +1179,9 @@ class VBasicTypeKey final { public: const int m_width; // From AstNodeDType: Bit width of operation const int m_widthMin; // From AstNodeDType: If unsized, bitwidth of minimum implementation + const VNumRange m_nrange; // From AstBasicDType: Numeric msb/lsb (if non-opaque keyword) const VSigning m_numeric; // From AstNodeDType: Node is signed const VBasicDTypeKwd m_keyword; // From AstBasicDType: What keyword created basic type - const VNumRange m_nrange; // From AstBasicDType: Numeric msb/lsb (if non-opaque keyword) bool operator==(const VBasicTypeKey& rhs) const { return m_width == rhs.m_width && m_widthMin == rhs.m_widthMin && m_numeric == rhs.m_numeric && m_keyword == rhs.m_keyword && m_nrange == rhs.m_nrange; @@ -1203,9 +1203,9 @@ public: const VNumRange& nrange) : m_width{width} , m_widthMin{widthMin} + , m_nrange{nrange} , m_numeric{numeric} - , m_keyword{kwd} - , m_nrange{nrange} {} + , m_keyword{kwd} {} ~VBasicTypeKey() = default; }; @@ -1419,8 +1419,8 @@ protected: }; AstNode* m_oldp = nullptr; // The old node that was linked to this point in the tree AstNode* m_backp = nullptr; - RelinkWhatEn m_chg = RELINK_BAD; AstNode** m_iterpp = nullptr; + RelinkWhatEn m_chg = RELINK_BAD; public: VNRelinker() = default; diff --git a/src/V3AstNodeDType.h b/src/V3AstNodeDType.h index a69c0ad8d..45f5dac64 100644 --- a/src/V3AstNodeDType.h +++ b/src/V3AstNodeDType.h @@ -200,10 +200,10 @@ private: using MemberNameMap = std::map; // MEMBERS string m_name; // Name from upper typedef, if any - bool m_packed; - bool m_isFourstate = false; // V3Width computes MemberNameMap m_members; const int m_uniqueNum; + bool m_packed; + bool m_isFourstate = false; // V3Width computes protected: AstNodeUOrStructDType(VNType t, FileLine* fl, VSigning numericUnpack) diff --git a/src/V3AstNodeOther.h b/src/V3AstNodeOther.h index a3c741ce8..77e3c6234 100644 --- a/src/V3AstNodeOther.h +++ b/src/V3AstNodeOther.h @@ -201,6 +201,11 @@ private: const string m_origName; // Name of the module, ignoring name() changes, for dot lookup string m_someInstanceName; // Hierarchical name of some arbitrary instance of this module. // Used for user messages only. + int m_level = 0; // 1=top module, 2=cell off top module, ... + VLifetime m_lifetime; // Lifetime + VTimescale m_timeunit; // Global time unit + VOptionBool m_unconnectedDrive; // State of `unconnected_drive + bool m_modPublic : 1; // Module has public references bool m_modTrace : 1; // Tracing this module bool m_inLibrary : 1; // From a library, no error if not used, never top level @@ -209,10 +214,6 @@ private: bool m_internal : 1; // Internally created bool m_recursive : 1; // Recursive module bool m_recursiveClone : 1; // If recursive, what module it clones, otherwise nullptr - int m_level = 0; // 1=top module, 2=cell off top module, ... - VLifetime m_lifetime; // Lifetime - VTimescale m_timeunit; // Global time unit - VOptionBool m_unconnectedDrive; // State of `unconnected_drive protected: AstNodeModule(VNType t, FileLine* fl, const string& name) : AstNode{t, fl} @@ -356,14 +357,14 @@ class AstNodeCoverOrAssert VL_NOT_FINAL : public AstNodeStmt { // @astgen op2 := sentreep : Optional[AstSenTree] // op3 used by some sub-types only // @astgen op4 := passsp: List[AstNode] // Statments when propp is passing/truthly - const bool m_immediate; // Immediate assertion/cover string m_name; // Name to report + const bool m_immediate; // Immediate assertion/cover public: AstNodeCoverOrAssert(VNType t, FileLine* fl, AstNode* propp, AstNode* passsp, bool immediate, const string& name = "") : AstNodeStmt{t, fl} - , m_immediate{immediate} - , m_name{name} { + , m_name{name} + , m_immediate{immediate} { this->propp(propp); this->addPasssp(passsp); } @@ -702,14 +703,14 @@ class AstCUse final : public AstNode { // C++ use of a class or #include; indicates need of forward declaration // Parents: NODEMODULE private: - const VUseType m_useType; // What sort of use this is const string m_name; + const VUseType m_useType; // What sort of use this is public: AstCUse(FileLine* fl, VUseType useType, const string& name) : ASTGEN_SUPER_CUse(fl) - , m_useType{useType} - , m_name{name} {} + , m_name{name} + , m_useType{useType} {} ASTGEN_MEMBERS_AstCUse; void dump(std::ostream& str = std::cout) const override; string name() const override { return m_name; } @@ -1170,8 +1171,8 @@ class AstModportFTaskRef final : public AstNode { // PARENT: AstModport private: string m_name; // Name of the variable referenced - bool m_export; // Type of the function (import/export) AstNodeFTask* m_ftaskp = nullptr; // Link to the function + bool m_export; // Type of the function (import/export) public: AstModportFTaskRef(FileLine* fl, const string& name, bool isExport) : ASTGEN_SUPER_ModportFTaskRef(fl) @@ -1193,8 +1194,8 @@ class AstModportVarRef final : public AstNode { // PARENT: AstModport private: string m_name; // Name of the variable referenced - VDirection m_direction; // Direction of the variable (in/out) AstVar* m_varp = nullptr; // Link to the actual Var + VDirection m_direction; // Direction of the variable (in/out) public: AstModportVarRef(FileLine* fl, const string& name, VDirection::en direction) : ASTGEN_SUPER_ModportVarRef(fl) @@ -1627,8 +1628,8 @@ class AstTypedef final : public AstNode { // @astgen op4 := attrsp : List[AstNode] // Attributes during early parse string m_name; - bool m_attrPublic = false; string m_tag; // Holds the string of the verilator tag -- used in XML output. + bool m_attrPublic = false; public: AstTypedef(FileLine* fl, const string& name, AstNode* attrsp, VFlagChildDType, AstNodeDType* dtp) @@ -2515,13 +2516,13 @@ public: class AstComment final : public AstNodeStmt { // Some comment to put into the output stream // Parents: {statement list} - const bool m_showAt; // Show "at " const string m_name; // Text of comment + const bool m_showAt; // Show "at " public: AstComment(FileLine* fl, const string& name, bool showAt = false) : ASTGEN_SUPER_Comment(fl) - , m_showAt{showAt} - , m_name{name} {} + , m_name{name} + , m_showAt{showAt} {} ASTGEN_MEMBERS_AstComment; string name() const override { return m_name; } // * = Text bool same(const AstNode* samep) const override { return true; } // Ignore name in comments @@ -3227,15 +3228,15 @@ class AstTraceInc final : public AstNodeStmt { private: AstTraceDecl* m_declp; // Pointer to declaration - const bool m_full; // Is this a full vs incremental dump const uint32_t m_baseCode; // Trace code base value in function containing this AstTraceInc + const bool m_full; // Is this a full vs incremental dump public: AstTraceInc(FileLine* fl, AstTraceDecl* declp, bool full, uint32_t baseCode = 0) : ASTGEN_SUPER_TraceInc(fl) , m_declp{declp} - , m_full{full} - , m_baseCode{baseCode} { + , m_baseCode{baseCode} + , m_full{full} { dtypeFrom(declp); this->valuep( declp->valuep()->cloneTree(true)); // TODO: maybe use reference to TraceDecl instead? diff --git a/src/V3Cdc.cpp b/src/V3Cdc.cpp index 0bd371111..54edca7c1 100644 --- a/src/V3Cdc.cpp +++ b/src/V3Cdc.cpp @@ -177,8 +177,8 @@ public: class CdcWidthVisitor final : public CdcBaseVisitor { private: - int m_maxLineno = 0; size_t m_maxFilenameLen = 0; + int m_maxLineno = 0; void visit(AstNode* nodep) override { iterateChildren(nodep); diff --git a/src/V3EmitCConstInit.h b/src/V3EmitCConstInit.h index 9b4c2b4e9..adc317b36 100644 --- a/src/V3EmitCConstInit.h +++ b/src/V3EmitCConstInit.h @@ -28,8 +28,8 @@ class EmitCConstInit VL_NOT_FINAL : public EmitCBaseVisitor { // MEMBERS - bool m_inUnpacked = false; uint32_t m_unpackedWord = 0; + bool m_inUnpacked = false; // METHODS diff --git a/src/V3File.h b/src/V3File.h index 38f4dc6ff..eb6673e38 100644 --- a/src/V3File.h +++ b/src/V3File.h @@ -195,9 +195,9 @@ class V3OutFile VL_NOT_FINAL : public V3OutFormatter { static constexpr std::size_t WRITE_BUFFER_SIZE_BYTES = 128 * 1024; // MEMBERS - std::unique_ptr> m_bufferp; // Write buffer - std::size_t m_usedBytes = 0; // Number of bytes stored in m_bufferp FILE* m_fp = nullptr; + std::size_t m_usedBytes = 0; // Number of bytes stored in m_bufferp + std::unique_ptr> m_bufferp; // Write buffer public: V3OutFile(const string& filename, V3OutFormatter::Language lang); diff --git a/src/V3PreLex.h b/src/V3PreLex.h index 4389c506d..3a001153f 100644 --- a/src/V3PreLex.h +++ b/src/V3PreLex.h @@ -132,9 +132,9 @@ public: V3PreLex* const m_lexp; // Lexer, for resource tracking std::deque m_buffers; // Buffer of characters to process int m_ignNewlines = 0; // Ignore multiline newlines + int m_termState = 0; // Termination fsm bool m_eof = false; // "EOF" buffer bool m_file = false; // Buffer is start of new file - int m_termState = 0; // Termination fsm VPreStream(FileLine* fl, V3PreLex* lexp) : m_curFilelinep{fl} , m_lexp{lexp} { diff --git a/src/V3String.h b/src/V3String.h index 7aacdb150..e004347f5 100644 --- a/src/V3String.h +++ b/src/V3String.h @@ -132,8 +132,8 @@ class VHashSha256 final { // MEMBERS uint32_t m_inthash[8]; // Intermediate hash, in host order string m_remainder; // Unhashed data - bool m_final = false; // Finalized size_t m_totLength = 0; // Total all-chunk length as needed by output digest + bool m_final = false; // Finalized public: // CONSTRUCTORS VHashSha256() { diff --git a/src/VlcSource.h b/src/VlcSource.h index b1ec313f2..af711f0af 100644 --- a/src/VlcSource.h +++ b/src/VlcSource.h @@ -67,8 +67,8 @@ public: private: // MEMBERS string m_name; //< Name of the source file - bool m_needed = false; //< Need to annotate; has low coverage LinenoMap m_lines; //< Map of each annotated line + bool m_needed = false; //< Need to annotate; has low coverage public: // CONSTRUCTORS diff --git a/src/verilog.y b/src/verilog.y index 846fde896..330cd4c0f 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -75,11 +75,6 @@ class V3ParseGrammar { public: - bool m_impliedDecl = false; // Allow implied wire declarations - VVarType m_varDecl; // Type for next signal declaration (reg/wire/etc) - bool m_varDeclTyped = false; // Var got reg/wire for dedup check - VDirection m_varIO; // Direction for next signal declaration (reg/wire/etc) - VLifetime m_varLifetime; // Static/Automatic for next signal AstVar* m_varAttrp = nullptr; // Current variable for attribute adding AstRange* m_gateRangep = nullptr; // Current range for gate declarations AstCase* m_caseAttrp = nullptr; // Current case statement for attribute adding @@ -88,10 +83,15 @@ public: AstDelay* m_netDelayp = nullptr; // Pointer to delay for next signal declaration AstStrengthSpec* m_netStrengthp = nullptr; // Pointer to strength for next net declaration AstNodeModule* m_modp = nullptr; // Last module for timeunits - bool m_pinAnsi = false; // In ANSI port list FileLine* m_instModuleFl = nullptr; // Fileline of module referenced for instantiations - string m_instModule; // Name of module referenced for instantiations AstPin* m_instParamp = nullptr; // Parameters for instantiations + string m_instModule; // Name of module referenced for instantiations + VVarType m_varDecl; // Type for next signal declaration (reg/wire/etc) + VDirection m_varIO; // Direction for next signal declaration (reg/wire/etc) + VLifetime m_varLifetime; // Static/Automatic for next signal + bool m_impliedDecl = false; // Allow implied wire declarations + bool m_varDeclTyped = false; // Var got reg/wire for dedup check + bool m_pinAnsi = false; // In ANSI port list bool m_tracingParse = true; // Tracing disable for parser bool m_insideProperty = false; // Is inside property declaration bool m_typedPropertyPort = false; // True if typed property port occured on port lists