Use static constexpr for RegTraits to make it possible to use asmjit in CLR environment (fixes #386)

This commit is contained in:
Matthias Moninger
2022-11-10 17:58:41 +02:00
committed by GitHub
parent 5af57595a9
commit 0c03ed2f74

View File

@@ -1082,19 +1082,19 @@ template<> \
struct RegTraits<REG_TYPE> { \ struct RegTraits<REG_TYPE> { \
typedef REG RegT; \ typedef REG RegT; \
\ \
enum : uint32_t { \ static constexpr uint32_t kValid = 1; \
kValid = uint32_t(true), \ static constexpr uint32_t kCount = COUNT; \
kCount = uint32_t(COUNT), \ static constexpr RegType kType = REG_TYPE; \
kType = uint32_t(REG_TYPE), \ static constexpr RegGroup kGroup = GROUP; \
kGroup = uint32_t(GROUP), \ static constexpr uint32_t kSize = SIZE; \
kSize = uint32_t(SIZE), \ static constexpr TypeId kTypeId = TYPE_ID; \
kTypeId = uint32_t(TYPE_ID), \ \
static constexpr uint32_t kSignature = \
(OperandSignature::fromOpType(OperandType::kReg) | \
OperandSignature::fromRegType(kType) | \
OperandSignature::fromRegGroup(kGroup) | \
OperandSignature::fromSize(kSize)).bits(); \
\ \
kSignature = (OperandSignature::fromOpType(OperandType::kReg) | \
OperandSignature::fromRegType(REG_TYPE) | \
OperandSignature::fromRegGroup(GROUP) | \
OperandSignature::fromSize(kSize)).bits(), \
}; \
} }
//! Adds constructors and member functions to a class that implements abstract register. Abstract register is register //! Adds constructors and member functions to a class that implements abstract register. Abstract register is register
@@ -1135,12 +1135,10 @@ public: \
//! signature. //! signature.
#define ASMJIT_DEFINE_FINAL_REG(REG, BASE, TRAITS) \ #define ASMJIT_DEFINE_FINAL_REG(REG, BASE, TRAITS) \
public: \ public: \
enum : uint32_t { \ static constexpr RegType kThisType = TRAITS::kType; \
kThisType = TRAITS::kType, \ static constexpr RegGroup kThisGroup = TRAITS::kGroup; \
kThisGroup = TRAITS::kGroup, \ static constexpr uint32_t kThisSize = TRAITS::kSize; \
kThisSize = TRAITS::kSize, \ static constexpr uint32_t kSignature = TRAITS::kSignature; \
kSignature = TRAITS::kSignature \
}; \
\ \
ASMJIT_DEFINE_ABSTRACT_REG(REG, BASE) \ ASMJIT_DEFINE_ABSTRACT_REG(REG, BASE) \
\ \