Internals: Deprecate VL_ATTR_ALIGNED, use alignas instead.

This commit is contained in:
Wilson Snyder 2023-05-02 21:21:10 -04:00
parent 7708c88e32
commit dc25be536c
4 changed files with 8 additions and 13 deletions

View File

@ -38,7 +38,6 @@
// Compiler pragma abstraction // Compiler pragma abstraction
#ifdef __GNUC__ #ifdef __GNUC__
# define VL_ATTR_ALIGNED(alignment) __attribute__((aligned(alignment)))
# define VL_ATTR_ALWINLINE __attribute__((always_inline)) inline # define VL_ATTR_ALWINLINE __attribute__((always_inline)) inline
# define VL_ATTR_NOINLINE __attribute__((noinline)) # define VL_ATTR_NOINLINE __attribute__((noinline))
# define VL_ATTR_COLD __attribute__((cold)) # define VL_ATTR_COLD __attribute__((cold))
@ -78,9 +77,6 @@
#endif #endif
// Defaults for unsupported compiler features // Defaults for unsupported compiler features
#ifndef VL_ATTR_ALIGNED
# define VL_ATTR_ALIGNED(alignment) ///< Attribute to align structure to byte alignment
#endif
#ifndef VL_ATTR_ALWINLINE #ifndef VL_ATTR_ALWINLINE
# define VL_ATTR_ALWINLINE ///< Attribute to inline, even when not optimizing # define VL_ATTR_ALWINLINE ///< Attribute to inline, even when not optimizing
#endif #endif
@ -142,6 +138,7 @@
#ifndef VL_NO_LEGACY #ifndef VL_NO_LEGACY
# define VL_ATTR_ALIGNED(alignment) // Deprecated
# define VL_FUNC __func__ // Deprecated # define VL_FUNC __func__ // Deprecated
# define VL_THREAD // Deprecated # define VL_THREAD // Deprecated
# define VL_THREAD_LOCAL thread_local // Deprecated # define VL_THREAD_LOCAL thread_local // Deprecated

View File

@ -300,6 +300,7 @@ class EmitCHeader final : public EmitCConstInit {
// Open class body {{{ // Open class body {{{
puts("\nclass "); puts("\nclass ");
if (!VN_IS(modp, Class)) puts("alignas(VL_CACHE_LINE_BYTES) ");
puts(prefixNameProtect(modp)); puts(prefixNameProtect(modp));
if (const AstClass* const classp = VN_CAST(modp, Class)) { if (const AstClass* const classp = VN_CAST(modp, Class)) {
puts(" : public "); puts(" : public ");
@ -329,11 +330,7 @@ class EmitCHeader final : public EmitCConstInit {
emitTextSection(modp, VNType::atScInt); emitTextSection(modp, VNType::atScInt);
// Close class body // Close class body
if (!VN_IS(modp, Class)) { puts("};\n");
puts("} VL_ATTR_ALIGNED(VL_CACHE_LINE_BYTES);\n");
} else {
puts("};\n");
}
// }}} // }}}
// Emit out of class function declarations // Emit out of class function declarations

View File

@ -89,7 +89,7 @@ class EmitCModel final : public EmitCFunc {
puts("\n"); puts("\n");
puts("// This class is the main interface to the Verilated model\n"); puts("// This class is the main interface to the Verilated model\n");
puts("class " + topClassName() + " VL_NOT_FINAL : "); puts("class alignas(VL_CACHE_LINE_BYTES) " + topClassName() + " VL_NOT_FINAL : ");
if (optSystemC()) { if (optSystemC()) {
// SC_MODULE, but with multiple-inheritance of VerilatedModel // SC_MODULE, but with multiple-inheritance of VerilatedModel
puts("public ::sc_core::sc_module, "); puts("public ::sc_core::sc_module, ");
@ -238,7 +238,7 @@ class EmitCModel final : public EmitCFunc {
puts("std::unique_ptr<VerilatedTraceConfig> traceConfig() const override final;\n"); puts("std::unique_ptr<VerilatedTraceConfig> traceConfig() const override final;\n");
} }
puts("} VL_ATTR_ALIGNED(VL_CACHE_LINE_BYTES);\n"); puts("};\n");
ofp()->putsEndGuard(); ofp()->putsEndGuard();

View File

@ -440,7 +440,8 @@ void EmitCSyms::emitSymHdr() {
} }
puts("\n// SYMS CLASS (contains all model state)\n"); puts("\n// SYMS CLASS (contains all model state)\n");
puts("class " + symClassName() + " final : public VerilatedSyms {\n"); puts("class alignas(VL_CACHE_LINE_BYTES)" + symClassName()
+ " final : public VerilatedSyms {\n");
ofp()->putsPrivate(false); // public: ofp()->putsPrivate(false); // public:
puts("// INTERNAL STATE\n"); puts("// INTERNAL STATE\n");
@ -554,7 +555,7 @@ void EmitCSyms::emitSymHdr() {
puts("void " + protect("__Vserialize") + "(VerilatedSerialize& os);\n"); puts("void " + protect("__Vserialize") + "(VerilatedSerialize& os);\n");
puts("void " + protect("__Vdeserialize") + "(VerilatedDeserialize& os);\n"); puts("void " + protect("__Vdeserialize") + "(VerilatedDeserialize& os);\n");
} }
puts("} VL_ATTR_ALIGNED(VL_CACHE_LINE_BYTES);\n"); puts("};\n");
ofp()->putsEndGuard(); ofp()->putsEndGuard();
VL_DO_CLEAR(delete m_ofp, m_ofp = nullptr); VL_DO_CLEAR(delete m_ofp, m_ofp = nullptr);