Skip to content

Commit 1d284cd

Browse files
committed
[MC][DecoderEmitter] Fix buuld warning: explicit specialization cannot have a storage class
1 parent e8b5fbd commit 1d284cd

File tree

4 files changed

+19
-16
lines changed

4 files changed

+19
-16
lines changed

llvm/include/llvm/MC/MCDecoder.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,6 @@ insertBits(IntType &field, IntType bits, unsigned startBit, unsigned numBits) {
7272
field |= bits << startBit;
7373
}
7474

75-
// InsnBitWidth is essentially a type trait used by the decoder emitter to query
76-
// the supported bitwidth for a given type. But default, the value is 0, making
77-
// it an invalid type for use as `InsnType` when instantiating the decoder.
78-
// Individual targets are expected to provide specializations for these based
79-
// on their usage.
80-
template <typename T> static constexpr uint32_t InsnBitWidth = 0;
81-
8275
} // namespace llvm::MCD
8376

8477
#endif // LLVM_MC_MCDECODER_H

llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -447,13 +447,13 @@ static DecodeStatus decodeVersionImm(MCInst &Inst, unsigned Imm,
447447

448448
#include "AMDGPUGenDisassemblerTables.inc"
449449

450+
namespace {
450451
// Define bitwidths for various types used to instantiate the decoder.
451-
template <> inline constexpr uint32_t llvm::MCD::InsnBitWidth<uint32_t> = 32;
452-
template <> inline constexpr uint32_t llvm::MCD::InsnBitWidth<uint64_t> = 64;
453-
template <>
454-
inline constexpr uint32_t llvm::MCD::InsnBitWidth<std::bitset<96>> = 96;
455-
template <>
456-
inline constexpr uint32_t llvm::MCD::InsnBitWidth<std::bitset<128>> = 128;
452+
template <> constexpr uint32_t InsnBitWidth<uint32_t> = 32;
453+
template <> constexpr uint32_t InsnBitWidth<uint64_t> = 64;
454+
template <> constexpr uint32_t InsnBitWidth<std::bitset<96>> = 96;
455+
template <> constexpr uint32_t InsnBitWidth<std::bitset<128>> = 128;
456+
} // namespace
457457

458458
//===----------------------------------------------------------------------===//
459459
//

llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -701,11 +701,13 @@ static constexpr DecoderListEntry DecoderList32[]{
701701
{DecoderTableZdinxRV32Only32, {}, "RV32-only Zdinx (Double in Integer)"},
702702
};
703703

704+
namespace {
704705
// Define bitwidths for various types used to instantiate the decoder.
705-
template <> inline constexpr uint32_t llvm::MCD::InsnBitWidth<uint16_t> = 16;
706-
template <> inline constexpr uint32_t llvm::MCD::InsnBitWidth<uint32_t> = 32;
706+
template <> constexpr uint32_t InsnBitWidth<uint16_t> = 16;
707+
template <> constexpr uint32_t InsnBitWidth<uint32_t> = 32;
707708
// Use uint64_t to represent 48 bit instructions.
708-
template <> inline constexpr uint32_t llvm::MCD::InsnBitWidth<uint64_t> = 48;
709+
template <> constexpr uint32_t InsnBitWidth<uint64_t> = 48;
710+
} // namespace
709711

710712
DecodeStatus RISCVDisassembler::getInstruction32(MCInst &MI, uint64_t &Size,
711713
ArrayRef<uint8_t> Bytes,

llvm/utils/TableGen/DecoderEmitter.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2479,6 +2479,14 @@ void DecoderEmitter::run(raw_ostream &o) const {
24792479
#include <assert.h>
24802480
24812481
namespace {
2482+
2483+
// InsnBitWidth is essentially a type trait used by the decoder emitter to query
2484+
// the supported bitwidth for a given type. But default, the value is 0, making
2485+
// it an invalid type for use as `InsnType` when instantiating the decoder.
2486+
// Individual targets are expected to provide specializations for these based
2487+
// on their usage.
2488+
template <typename T> static constexpr uint32_t InsnBitWidth = 0;
2489+
24822490
)";
24832491

24842492
// Do extra bookkeeping for variable-length encodings.

0 commit comments

Comments
 (0)