Forward declare IR::Opcode and IR::Type where possible

This commit is contained in:
MerryMage
2018-02-11 11:46:18 +00:00
parent 6c9b4f0114
commit f378d2ef1b
13 changed files with 112 additions and 57 deletions

View File

@@ -13,6 +13,8 @@
namespace Dynarmic::IR {
enum class Type;
/**
* The Opcodes of our intermediate representation.
* Type signatures for each opcode can be found in opcodes.inc
@@ -30,35 +32,6 @@ enum class Opcode {
constexpr size_t OpcodeCount = static_cast<size_t>(Opcode::NUM_OPCODE);
/**
* The intermediate representation is typed. These are the used by our IR.
*/
enum class Type {
Void = 0,
A32Reg = 1 << 0,
A32ExtReg = 1 << 1,
A64Reg = 1 << 2,
A64Vec = 1 << 3,
Opaque = 1 << 4,
U1 = 1 << 5,
U8 = 1 << 6,
U16 = 1 << 7,
U32 = 1 << 8,
U64 = 1 << 9,
U128 = 1 << 10,
CoprocInfo = 1 << 11,
NZCVFlags = 1 << 12,
Cond = 1 << 13,
};
constexpr Type operator|(Type a, Type b) {
return static_cast<Type>(static_cast<size_t>(a) | static_cast<size_t>(b));
}
constexpr Type operator&(Type a, Type b) {
return static_cast<Type>(static_cast<size_t>(a) & static_cast<size_t>(b));
}
/// Get return type of an opcode
Type GetTypeOf(Opcode op);
@@ -71,13 +44,6 @@ Type GetArgTypeOf(Opcode op, size_t arg_index);
/// Get the name of an opcode.
std::string GetNameOf(Opcode op);
/// Get the name of a type.
std::string GetNameOf(Type type);
/// @returns true if t1 and t2 are compatible types
bool AreTypesCompatible(Type t1, Type t2);
std::ostream& operator<<(std::ostream& o, Opcode opcode);
std::ostream& operator<<(std::ostream& o, Type type);
} // namespace Dynarmic::IR