mirror of
https://github.com/verilator/verilator.git
synced 2024-12-29 10:47:34 +00:00
Internals: Support VL_UNREACHABLE in C++23/MSVC. No functional change intended.
This commit is contained in:
parent
aac0186871
commit
9689a4f58a
@ -67,11 +67,21 @@
|
||||
# endif
|
||||
# define VL_LIKELY(x) __builtin_expect(!!(x), 1) // Prefer over C++20 [[likely]]
|
||||
# define VL_UNLIKELY(x) __builtin_expect(!!(x), 0) // Prefer over C++20 [[unlikely]]
|
||||
# define VL_UNREACHABLE __builtin_unreachable() // C++23 std::unreachable()
|
||||
# define VL_PREFETCH_RD(p) __builtin_prefetch((p), 0)
|
||||
# define VL_PREFETCH_RW(p) __builtin_prefetch((p), 1)
|
||||
#endif
|
||||
|
||||
#ifdef __cpp_lib_unreachable
|
||||
/// Statement that may never be reached (for coverage etc)
|
||||
# define VL_UNREACHABLE std::unreachable() // C++23
|
||||
#elif defined(__GNUC__)
|
||||
# define VL_UNREACHABLE __builtin_unreachable()
|
||||
#elif defined(_MSC_VER) // MSVC
|
||||
# define VL_UNREACHABLE __assume(false)
|
||||
#else
|
||||
# define VL_UNREACHABLE
|
||||
#endif
|
||||
|
||||
// Function acquires a capability/lock (-fthread-safety)
|
||||
#define VL_ACQUIRE(...) \
|
||||
VL_CLANG_ATTR(annotate("ACQUIRE")) \
|
||||
@ -179,9 +189,6 @@
|
||||
#endif
|
||||
/// Boolean expression never hit by users (branch coverage disabled)
|
||||
# define VL_UNCOVERABLE(x) VL_UNLIKELY(x)
|
||||
#ifndef VL_UNREACHABLE
|
||||
# define VL_UNREACHABLE ///< Statement that may never be reached (for coverage etc)
|
||||
#endif
|
||||
#ifndef VL_PREFETCH_RD
|
||||
# define VL_PREFETCH_RD(p) ///< Prefetch pointer argument with read intent
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user