IR: Add IR type CoprocInfo
This commit is contained in:
parent
890b2f75ad
commit
d8a37e287c
4 changed files with 19 additions and 3 deletions
|
@ -29,7 +29,7 @@ static const std::map<Opcode, Meta> opcode_info {{
|
|||
#define OPCODE(name, type, ...) { Opcode::name, { #name, type, { __VA_ARGS__ } } },
|
||||
#include "opcodes.inc"
|
||||
#undef OPCODE
|
||||
}};
|
||||
}};
|
||||
|
||||
} // namespace OpcodeInfo
|
||||
|
||||
|
@ -50,8 +50,8 @@ const char* GetNameOf(Opcode op) {
|
|||
}
|
||||
|
||||
const char* GetNameOf(Type type) {
|
||||
const static std::array<const char*, 11> names = {
|
||||
"Void", "RegRef", "ExtRegRef", "Opaque", "U1", "U8", "U16", "U32", "U64", "F32", "F64"
|
||||
const static std::array<const char*, 12> names = {
|
||||
"Void", "RegRef", "ExtRegRef", "Opaque", "U1", "U8", "U16", "U32", "U64", "F32", "F64", "CoprocInfo"
|
||||
};
|
||||
return names.at(static_cast<size_t>(type));
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ enum class Type {
|
|||
U64,
|
||||
F32,
|
||||
F64,
|
||||
CoprocInfo,
|
||||
};
|
||||
|
||||
/// Get return type of an opcode
|
||||
|
|
|
@ -39,6 +39,10 @@ Value::Value(u64 value) : type(Type::U64) {
|
|||
inner.imm_u64 = value;
|
||||
}
|
||||
|
||||
Value::Value(std::array<u8, 8> value) : type(Type::CoprocInfo) {
|
||||
inner.imm_coproc = value;
|
||||
}
|
||||
|
||||
bool Value::IsImmediate() const {
|
||||
if (type == Type::Opaque)
|
||||
return inner.inst->GetOpcode() == Opcode::Identity ? inner.inst->GetArg(0).IsImmediate() : false;
|
||||
|
@ -103,5 +107,12 @@ u64 Value::GetU64() const {
|
|||
return inner.imm_u64;
|
||||
}
|
||||
|
||||
std::array<u8, 8> Value::GetCoprocInfo() const {
|
||||
if (type == Type::Opaque && inner.inst->GetOpcode() == Opcode::Identity)
|
||||
return inner.inst->GetArg(0).GetCoprocInfo();
|
||||
DEBUG_ASSERT(type == Type::CoprocInfo);
|
||||
return inner.imm_coproc;
|
||||
}
|
||||
|
||||
} // namespace IR
|
||||
} // namespace Dynarmic
|
||||
|
|
|
@ -28,6 +28,7 @@ public:
|
|||
explicit Value(u8 value);
|
||||
explicit Value(u32 value);
|
||||
explicit Value(u64 value);
|
||||
explicit Value(std::array<u8, 8> value);
|
||||
|
||||
bool IsEmpty() const;
|
||||
bool IsImmediate() const;
|
||||
|
@ -40,6 +41,7 @@ public:
|
|||
u8 GetU8() const;
|
||||
u32 GetU32() const;
|
||||
u64 GetU64() const;
|
||||
std::array<u8, 8> GetCoprocInfo() const;
|
||||
|
||||
private:
|
||||
Type type;
|
||||
|
@ -52,8 +54,10 @@ private:
|
|||
u8 imm_u8;
|
||||
u32 imm_u32;
|
||||
u64 imm_u64;
|
||||
std::array<u8, 8> imm_coproc;
|
||||
} inner;
|
||||
};
|
||||
static_assert(sizeof(Value) <= 2 * sizeof(u64), "IR::Value should be kept small in size");
|
||||
|
||||
} // namespace IR
|
||||
} // namespace Dynarmic
|
||||
|
|
Loading…
Reference in a new issue