dynarmic/src/frontend/ir/opcodes.h

50 lines
1.1 KiB
C
Raw Normal View History

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
2018-01-27 23:42:30 +00:00
#include <iosfwd>
#include <string>
2016-07-01 14:01:06 +01:00
#include "common/common_types.h"
namespace Dynarmic::IR {
2016-07-01 14:01:06 +01:00
enum class Type;
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,
2018-01-01 16:19:43 +00:00
#define A32OPC(name, type, ...) A32##name,
2018-01-07 00:11:57 +00:00
#define A64OPC(name, type, ...) A64##name,
2016-07-01 14:01:06 +01:00
#include "opcodes.inc"
#undef OPCODE
2018-01-01 16:19:43 +00:00
#undef A32OPC
2018-01-07 00:11:57 +00:00
#undef A64OPC
2016-07-01 14:01:06 +01:00
NUM_OPCODE
};
constexpr size_t OpcodeCount = static_cast<size_t>(Opcode::NUM_OPCODE);
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.
2018-01-27 23:42:30 +00:00
std::string GetNameOf(Opcode op);
2016-08-12 18:17:31 +01:00
2018-01-27 23:42:30 +00:00
std::ostream& operator<<(std::ostream& o, Opcode opcode);
} // namespace Dynarmic::IR