2016-07-01 14:01:06 +01:00
|
|
|
/* This file is part of the dynarmic project.
|
|
|
|
* Copyright (c) 2016 MerryMage
|
|
|
|
* This software may be used and distributed according to the terms of the GNU
|
|
|
|
* General Public License version 2 or any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common/common_types.h"
|
|
|
|
|
|
|
|
namespace Dynarmic {
|
|
|
|
namespace IR {
|
|
|
|
|
2016-08-12 18:17:31 +01:00
|
|
|
/**
|
|
|
|
* The Opcodes of our intermediate representation.
|
|
|
|
* Type signatures for each opcode can be found in opcodes.inc
|
|
|
|
*/
|
2016-07-01 14:01:06 +01:00
|
|
|
enum class Opcode {
|
|
|
|
#define OPCODE(name, type, ...) name,
|
|
|
|
#include "opcodes.inc"
|
|
|
|
#undef OPCODE
|
|
|
|
NUM_OPCODE
|
|
|
|
};
|
|
|
|
|
|
|
|
constexpr size_t OpcodeCount = static_cast<size_t>(Opcode::NUM_OPCODE);
|
|
|
|
|
2016-08-12 18:17:31 +01:00
|
|
|
/**
|
|
|
|
* The intermediate representation is typed. These are the used by our IR.
|
|
|
|
*/
|
|
|
|
enum class Type {
|
2016-08-17 13:29:05 +01:00
|
|
|
Void,
|
|
|
|
RegRef,
|
|
|
|
ExtRegRef,
|
|
|
|
Opaque,
|
|
|
|
U1,
|
|
|
|
U8,
|
|
|
|
U16,
|
|
|
|
U32,
|
|
|
|
U64,
|
|
|
|
F32,
|
|
|
|
F64,
|
2016-12-31 10:46:13 +00:00
|
|
|
CoprocInfo,
|
2016-08-12 18:17:31 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/// Get return type of an opcode
|
|
|
|
Type GetTypeOf(Opcode op);
|
|
|
|
|
|
|
|
/// Get the number of arguments an opcode accepts
|
|
|
|
size_t GetNumArgsOf(Opcode op);
|
|
|
|
|
|
|
|
/// Get the required type of an argument of an opcode
|
|
|
|
Type GetArgTypeOf(Opcode op, size_t arg_index);
|
|
|
|
|
|
|
|
/// Get the name of an opcode.
|
|
|
|
const char* GetNameOf(Opcode op);
|
|
|
|
|
2016-08-17 13:29:05 +01:00
|
|
|
/// Get the name of a type.
|
|
|
|
const char* GetNameOf(Type type);
|
|
|
|
|
2016-08-19 01:34:14 +01:00
|
|
|
/// @returns true if t1 and t2 are compatible types
|
|
|
|
bool AreTypesCompatible(Type t1, Type t2);
|
|
|
|
|
2016-07-01 14:01:06 +01:00
|
|
|
} // namespace Arm
|
|
|
|
} // namespace Dynarmic
|