diff options
author | Rahul Joshi <rjoshi@nvidia.com> | 2025-09-02 07:28:36 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-09-02 07:28:36 -0700 |
commit | 0196d7ec6988c39fa08ba296d28ffb00494f2834 (patch) | |
tree | c38373619ec6c65d324248a833dfe25eb48186c6 /llvm/utils/TableGen/DecoderEmitter.cpp | |
parent | 1ff6bfe7a5c672a7349a5a619d44b4892c8b7f74 (diff) | |
download | llvm-0196d7ec6988c39fa08ba296d28ffb00494f2834.zip llvm-0196d7ec6988c39fa08ba296d28ffb00494f2834.tar.gz llvm-0196d7ec6988c39fa08ba296d28ffb00494f2834.tar.bz2 |
[MC][DecoderEmitter] Fix build warning: explicit specialization cannot have a storage class (#156375)
Move `InsnBitWidth` template into anonymous namespace in the generated
code and move template specialization of `InsnBitWidth` to anonymous
namespace as well, and drop `static` for them. This makes `InsnBitWidth`
completely private to each target and fixes the "explicit specialization
cannot have a storage class" warning as well as any potential linker
errors if `InsnBitWidth` is kept in the `llvm::MCD` namespace.
Diffstat (limited to 'llvm/utils/TableGen/DecoderEmitter.cpp')
-rw-r--r-- | llvm/utils/TableGen/DecoderEmitter.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/utils/TableGen/DecoderEmitter.cpp b/llvm/utils/TableGen/DecoderEmitter.cpp index 354c2a7..fcaf4339 100644 --- a/llvm/utils/TableGen/DecoderEmitter.cpp +++ b/llvm/utils/TableGen/DecoderEmitter.cpp @@ -2479,6 +2479,14 @@ void DecoderEmitter::run(raw_ostream &o) const { #include <assert.h> namespace { + +// InsnBitWidth is essentially a type trait used by the decoder emitter to query +// the supported bitwidth for a given type. But default, the value is 0, making +// it an invalid type for use as `InsnType` when instantiating the decoder. +// Individual targets are expected to provide specializations for these based +// on their usage. +template <typename T> constexpr uint32_t InsnBitWidth = 0; + )"; // Do extra bookkeeping for variable-length encodings. |