mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-02 02:49:28 +00:00
Avoid explicit specialisation in non-namespace scope.
This commit is contained in:
parent
ab37b00356
commit
d8a11eaba7
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include "Instruction.hpp"
|
#include "Instruction.hpp"
|
||||||
#include "Model.hpp"
|
#include "Model.hpp"
|
||||||
|
#include "../../Numeric/Sizes.hpp"
|
||||||
|
|
||||||
namespace InstructionSet {
|
namespace InstructionSet {
|
||||||
namespace M68k {
|
namespace M68k {
|
||||||
@ -50,30 +51,15 @@ template <Model model> class Predecoder {
|
|||||||
Preinstruction decodeE(uint16_t instruction);
|
Preinstruction decodeE(uint16_t instruction);
|
||||||
Preinstruction decodeF(uint16_t instruction);
|
Preinstruction decodeF(uint16_t instruction);
|
||||||
|
|
||||||
template <Model> struct OperationProperties {};
|
// Yuckiness here: 67 is a count of the number of things contained below in
|
||||||
template <> struct OperationProperties<Model::M68000> {
|
// ExtendedOperation; this acts to ensure ExtendedOperation is the minimum
|
||||||
using OpT = uint8_t;
|
// integer size large enough to hold all actual operations plus the ephemeral
|
||||||
static constexpr OpT OpMax = OpT(Operation::Max68000);
|
// ones used here. Intention is to support table-based decoding, which will mean
|
||||||
};
|
// making those integers less ephemeral, hence the desire to pick a minimum size.
|
||||||
template <> struct OperationProperties<Model::M68010> {
|
using OpT = typename MinIntTypeValue<
|
||||||
using OpT = uint8_t;
|
uint64_t(OperationMax<model>::value) + 67
|
||||||
static constexpr OpT OpMax = OpT(Operation::Max68010);
|
>::type;
|
||||||
};
|
static constexpr auto OpMax = OpT(OperationMax<model>::value);
|
||||||
template <> struct OperationProperties<Model::M68020> {
|
|
||||||
using OpT = uint16_t;
|
|
||||||
static constexpr OpT OpMax = OpT(Operation::Max68020);
|
|
||||||
};
|
|
||||||
template <> struct OperationProperties<Model::M68030> {
|
|
||||||
using OpT = uint16_t;
|
|
||||||
static constexpr OpT OpMax = OpT(Operation::Max68030);
|
|
||||||
};
|
|
||||||
template <> struct OperationProperties<Model::M68040> {
|
|
||||||
using OpT = uint16_t;
|
|
||||||
static constexpr OpT OpMax = OpT(Operation::Max68040);
|
|
||||||
};
|
|
||||||
|
|
||||||
using OpT = typename OperationProperties<model>::OpT;
|
|
||||||
static constexpr OpT OpMax = OperationProperties<model>::OpMax;
|
|
||||||
|
|
||||||
// Specific instruction decoders.
|
// Specific instruction decoders.
|
||||||
template <OpT operation, bool validate = true> Preinstruction decode(uint16_t instruction);
|
template <OpT operation, bool validate = true> Preinstruction decode(uint16_t instruction);
|
||||||
@ -89,7 +75,7 @@ template <Model model> class Predecoder {
|
|||||||
// time that's knowable from the Operation alone, hence the rather awkward
|
// time that's knowable from the Operation alone, hence the rather awkward
|
||||||
// extension of @c Operation.
|
// extension of @c Operation.
|
||||||
enum ExtendedOperation: OpT {
|
enum ExtendedOperation: OpT {
|
||||||
MOVEPtoRl = OperationProperties<model>::OpMax + 1, MOVEPtoRw,
|
MOVEPtoRl = OpMax + 1, MOVEPtoRw,
|
||||||
MOVEPtoMl, MOVEPtoMw,
|
MOVEPtoMl, MOVEPtoMw,
|
||||||
|
|
||||||
MOVEQ,
|
MOVEQ,
|
||||||
|
@ -174,6 +174,24 @@ enum class Operation: uint8_t {
|
|||||||
Max68040 = PTESTW,
|
Max68040 = PTESTW,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Provide per-model max entries in Operation.
|
||||||
|
template <Model> struct OperationMax {};
|
||||||
|
template <> struct OperationMax<Model::M68000> {
|
||||||
|
static constexpr Operation value = Operation::Max68000;
|
||||||
|
};
|
||||||
|
template <> struct OperationMax<Model::M68010> {
|
||||||
|
static constexpr Operation value = Operation::Max68010;
|
||||||
|
};
|
||||||
|
template <> struct OperationMax<Model::M68020> {
|
||||||
|
static constexpr Operation value = Operation::Max68020;
|
||||||
|
};
|
||||||
|
template <> struct OperationMax<Model::M68030> {
|
||||||
|
static constexpr Operation value = Operation::Max68030;
|
||||||
|
};
|
||||||
|
template <> struct OperationMax<Model::M68040> {
|
||||||
|
static constexpr Operation value = Operation::Max68040;
|
||||||
|
};
|
||||||
|
|
||||||
const char *to_string(Operation op);
|
const char *to_string(Operation op);
|
||||||
|
|
||||||
template <Model model>
|
template <Model model>
|
||||||
|
Loading…
Reference in New Issue
Block a user