diff --git a/src/frontend/ir/value.cpp b/src/frontend/ir/value.cpp index 409ed804..8ade5af2 100644 --- a/src/frontend/ir/value.cpp +++ b/src/frontend/ir/value.cpp @@ -31,6 +31,10 @@ Value::Value(u8 value) : type(Type::U8) { inner.imm_u8 = value; } +Value::Value(u16 value) : type(Type::U16) { + inner.imm_u16 = value; +} + Value::Value(u32 value) : type(Type::U32) { inner.imm_u32 = value; } @@ -93,6 +97,13 @@ u8 Value::GetU8() const { return inner.imm_u8; } +u16 Value::GetU16() const { + if (type == Type::Opaque && inner.inst->GetOpcode() == Opcode::Identity) + return inner.inst->GetArg(0).GetU16(); + DEBUG_ASSERT(type == Type::U16); + return inner.imm_u16; +} + u32 Value::GetU32() const { if (type == Type::Opaque && inner.inst->GetOpcode() == Opcode::Identity) return inner.inst->GetArg(0).GetU32(); diff --git a/src/frontend/ir/value.h b/src/frontend/ir/value.h index ec1bcc0e..554681ac 100644 --- a/src/frontend/ir/value.h +++ b/src/frontend/ir/value.h @@ -26,6 +26,7 @@ public: explicit Value(Arm::ExtReg value); explicit Value(bool value); explicit Value(u8 value); + explicit Value(u16 value); explicit Value(u32 value); explicit Value(u64 value); explicit Value(std::array value); @@ -39,6 +40,7 @@ public: Arm::ExtReg GetExtRegRef() const; bool GetU1() const; u8 GetU8() const; + u16 GetU16() const; u32 GetU32() const; u64 GetU64() const; std::array GetCoprocInfo() const; @@ -52,6 +54,7 @@ private: Arm::ExtReg imm_extregref; bool imm_u1; u8 imm_u8; + u16 imm_u16; u32 imm_u32; u64 imm_u64; std::array imm_coproc;