Prefer ASSERT to DEBUG_ASSERT

This commit is contained in:
MerryMage 2017-02-26 23:27:41 +00:00
parent 135346eb2e
commit 92a01b0cd8
4 changed files with 27 additions and 27 deletions

View file

@ -10,12 +10,12 @@ namespace Dynarmic {
namespace BackendX64 { namespace BackendX64 {
Xbyak::Reg64 HostLocToReg64(HostLoc loc) { Xbyak::Reg64 HostLocToReg64(HostLoc loc) {
DEBUG_ASSERT(HostLocIsGPR(loc)); ASSERT(HostLocIsGPR(loc));
return Xbyak::Reg64(static_cast<int>(loc)); return Xbyak::Reg64(static_cast<int>(loc));
} }
Xbyak::Xmm HostLocToXmm(HostLoc loc) { Xbyak::Xmm HostLocToXmm(HostLoc loc) {
DEBUG_ASSERT(HostLocIsXMM(loc)); ASSERT(HostLocIsXMM(loc));
return Xbyak::Xmm(static_cast<int>(loc) - static_cast<int>(HostLoc::XMM0)); return Xbyak::Xmm(static_cast<int>(loc) - static_cast<int>(HostLoc::XMM0));
} }
@ -23,7 +23,7 @@ Xbyak::Address SpillToOpArg(HostLoc loc) {
using namespace Xbyak::util; using namespace Xbyak::util;
static_assert(std::is_same<decltype(JitState::Spill[0]), u64&>::value, "Spill must be u64"); static_assert(std::is_same<decltype(JitState::Spill[0]), u64&>::value, "Spill must be u64");
DEBUG_ASSERT(HostLocIsSpill(loc)); ASSERT(HostLocIsSpill(loc));
size_t i = static_cast<size_t>(loc) - static_cast<size_t>(HostLoc::FirstSpill); size_t i = static_cast<size_t>(loc) - static_cast<size_t>(HostLoc::FirstSpill);
return qword[r15 + offsetof(JitState, Spill) + i * sizeof(u64)]; return qword[r15 + offsetof(JitState, Spill) + i * sizeof(u64)];

View file

@ -362,12 +362,12 @@ boost::optional<HostLoc> RegAlloc::ValueLocation(const IR::Inst* value) const {
} }
void RegAlloc::DefineValueImpl(IR::Inst* def_inst, HostLoc host_loc) { void RegAlloc::DefineValueImpl(IR::Inst* def_inst, HostLoc host_loc) {
DEBUG_ASSERT_MSG(!ValueLocation(def_inst), "def_inst has already been defined"); ASSERT_MSG(!ValueLocation(def_inst), "def_inst has already been defined");
LocInfo(host_loc).AddValue(def_inst); LocInfo(host_loc).AddValue(def_inst);
} }
void RegAlloc::DefineValueImpl(IR::Inst* def_inst, const IR::Value& use_inst) { void RegAlloc::DefineValueImpl(IR::Inst* def_inst, const IR::Value& use_inst) {
DEBUG_ASSERT_MSG(!ValueLocation(def_inst), "def_inst has already been defined"); ASSERT_MSG(!ValueLocation(def_inst), "def_inst has already been defined");
if (use_inst.IsImmediate()) { if (use_inst.IsImmediate()) {
HostLoc location = ScratchImpl(any_gpr); HostLoc location = ScratchImpl(any_gpr);
@ -376,7 +376,7 @@ void RegAlloc::DefineValueImpl(IR::Inst* def_inst, const IR::Value& use_inst) {
return; return;
} }
DEBUG_ASSERT_MSG(ValueLocation(use_inst.GetInst()), "use_inst must already be defined"); ASSERT_MSG(ValueLocation(use_inst.GetInst()), "use_inst must already be defined");
HostLoc location = *ValueLocation(use_inst.GetInst()); HostLoc location = *ValueLocation(use_inst.GetInst());
DefineValueImpl(def_inst, location); DefineValueImpl(def_inst, location);
} }
@ -456,12 +456,12 @@ HostLoc RegAlloc::FindFreeSpill() const {
} }
HostLocInfo& RegAlloc::LocInfo(HostLoc loc) { HostLocInfo& RegAlloc::LocInfo(HostLoc loc) {
DEBUG_ASSERT(loc != HostLoc::RSP && loc != HostLoc::R15); ASSERT(loc != HostLoc::RSP && loc != HostLoc::R15);
return hostloc_info[static_cast<size_t>(loc)]; return hostloc_info[static_cast<size_t>(loc)];
} }
const HostLocInfo& RegAlloc::LocInfo(HostLoc loc) const { const HostLocInfo& RegAlloc::LocInfo(HostLoc loc) const {
DEBUG_ASSERT(loc != HostLoc::RSP && loc != HostLoc::R15); ASSERT(loc != HostLoc::RSP && loc != HostLoc::R15);
return hostloc_info[static_cast<size_t>(loc)]; return hostloc_info[static_cast<size_t>(loc)];
} }

View file

@ -255,13 +255,13 @@ Inst* Inst::GetAssociatedPseudoOperation(Opcode opcode) {
// This is faster than doing a search through the block. // This is faster than doing a search through the block.
switch (opcode) { switch (opcode) {
case IR::Opcode::GetCarryFromOp: case IR::Opcode::GetCarryFromOp:
DEBUG_ASSERT(!carry_inst || carry_inst->GetOpcode() == Opcode::GetCarryFromOp); ASSERT(!carry_inst || carry_inst->GetOpcode() == Opcode::GetCarryFromOp);
return carry_inst; return carry_inst;
case IR::Opcode::GetOverflowFromOp: case IR::Opcode::GetOverflowFromOp:
DEBUG_ASSERT(!overflow_inst || overflow_inst->GetOpcode() == Opcode::GetOverflowFromOp); ASSERT(!overflow_inst || overflow_inst->GetOpcode() == Opcode::GetOverflowFromOp);
return overflow_inst; return overflow_inst;
case IR::Opcode::GetGEFromOp: case IR::Opcode::GetGEFromOp:
DEBUG_ASSERT(!ge_inst || ge_inst->GetOpcode() == Opcode::GetGEFromOp); ASSERT(!ge_inst || ge_inst->GetOpcode() == Opcode::GetGEFromOp);
return ge_inst; return ge_inst;
default: default:
break; break;
@ -278,15 +278,15 @@ Type Inst::GetType() const {
} }
Value Inst::GetArg(size_t index) const { Value Inst::GetArg(size_t index) const {
DEBUG_ASSERT(index < GetNumArgsOf(op)); ASSERT(index < GetNumArgsOf(op));
DEBUG_ASSERT(!args[index].IsEmpty()); ASSERT(!args[index].IsEmpty());
return args[index]; return args[index];
} }
void Inst::SetArg(size_t index, Value value) { void Inst::SetArg(size_t index, Value value) {
DEBUG_ASSERT(index < GetNumArgsOf(op)); ASSERT(index < GetNumArgsOf(op));
DEBUG_ASSERT(AreTypesCompatible(value.GetType(), GetArgTypeOf(op, index))); ASSERT(AreTypesCompatible(value.GetType(), GetArgTypeOf(op, index)));
if (!args[index].IsImmediate()) { if (!args[index].IsImmediate()) {
UndoUse(args[index]); UndoUse(args[index]);
@ -346,15 +346,15 @@ void Inst::UndoUse(const Value& value) {
switch (op){ switch (op){
case Opcode::GetCarryFromOp: case Opcode::GetCarryFromOp:
DEBUG_ASSERT(value.GetInst()->carry_inst->GetOpcode() == Opcode::GetCarryFromOp); ASSERT(value.GetInst()->carry_inst->GetOpcode() == Opcode::GetCarryFromOp);
value.GetInst()->carry_inst = nullptr; value.GetInst()->carry_inst = nullptr;
break; break;
case Opcode::GetOverflowFromOp: case Opcode::GetOverflowFromOp:
DEBUG_ASSERT(value.GetInst()->overflow_inst->GetOpcode() == Opcode::GetOverflowFromOp); ASSERT(value.GetInst()->overflow_inst->GetOpcode() == Opcode::GetOverflowFromOp);
value.GetInst()->overflow_inst = nullptr; value.GetInst()->overflow_inst = nullptr;
break; break;
case Opcode::GetGEFromOp: case Opcode::GetGEFromOp:
DEBUG_ASSERT(value.GetInst()->ge_inst->GetOpcode() == Opcode::GetGEFromOp); ASSERT(value.GetInst()->ge_inst->GetOpcode() == Opcode::GetGEFromOp);
value.GetInst()->ge_inst = nullptr; value.GetInst()->ge_inst = nullptr;
break; break;
default: default:

View file

@ -69,59 +69,59 @@ Type Value::GetType() const {
} }
Arm::Reg Value::GetRegRef() const { Arm::Reg Value::GetRegRef() const {
DEBUG_ASSERT(type == Type::RegRef); ASSERT(type == Type::RegRef);
return inner.imm_regref; return inner.imm_regref;
} }
Arm::ExtReg Value::GetExtRegRef() const { Arm::ExtReg Value::GetExtRegRef() const {
DEBUG_ASSERT(type == Type::ExtRegRef); ASSERT(type == Type::ExtRegRef);
return inner.imm_extregref; return inner.imm_extregref;
} }
Inst* Value::GetInst() const { Inst* Value::GetInst() const {
DEBUG_ASSERT(type == Type::Opaque); ASSERT(type == Type::Opaque);
return inner.inst; return inner.inst;
} }
bool Value::GetU1() const { bool Value::GetU1() const {
if (type == Type::Opaque && inner.inst->GetOpcode() == Opcode::Identity) if (type == Type::Opaque && inner.inst->GetOpcode() == Opcode::Identity)
return inner.inst->GetArg(0).GetU1(); return inner.inst->GetArg(0).GetU1();
DEBUG_ASSERT(type == Type::U1); ASSERT(type == Type::U1);
return inner.imm_u1; return inner.imm_u1;
} }
u8 Value::GetU8() const { u8 Value::GetU8() const {
if (type == Type::Opaque && inner.inst->GetOpcode() == Opcode::Identity) if (type == Type::Opaque && inner.inst->GetOpcode() == Opcode::Identity)
return inner.inst->GetArg(0).GetU8(); return inner.inst->GetArg(0).GetU8();
DEBUG_ASSERT(type == Type::U8); ASSERT(type == Type::U8);
return inner.imm_u8; return inner.imm_u8;
} }
u16 Value::GetU16() const { u16 Value::GetU16() const {
if (type == Type::Opaque && inner.inst->GetOpcode() == Opcode::Identity) if (type == Type::Opaque && inner.inst->GetOpcode() == Opcode::Identity)
return inner.inst->GetArg(0).GetU16(); return inner.inst->GetArg(0).GetU16();
DEBUG_ASSERT(type == Type::U16); ASSERT(type == Type::U16);
return inner.imm_u16; return inner.imm_u16;
} }
u32 Value::GetU32() const { u32 Value::GetU32() const {
if (type == Type::Opaque && inner.inst->GetOpcode() == Opcode::Identity) if (type == Type::Opaque && inner.inst->GetOpcode() == Opcode::Identity)
return inner.inst->GetArg(0).GetU32(); return inner.inst->GetArg(0).GetU32();
DEBUG_ASSERT(type == Type::U32); ASSERT(type == Type::U32);
return inner.imm_u32; return inner.imm_u32;
} }
u64 Value::GetU64() const { u64 Value::GetU64() const {
if (type == Type::Opaque && inner.inst->GetOpcode() == Opcode::Identity) if (type == Type::Opaque && inner.inst->GetOpcode() == Opcode::Identity)
return inner.inst->GetArg(0).GetU64(); return inner.inst->GetArg(0).GetU64();
DEBUG_ASSERT(type == Type::U64); ASSERT(type == Type::U64);
return inner.imm_u64; return inner.imm_u64;
} }
std::array<u8, 8> Value::GetCoprocInfo() const { std::array<u8, 8> Value::GetCoprocInfo() const {
if (type == Type::Opaque && inner.inst->GetOpcode() == Opcode::Identity) if (type == Type::Opaque && inner.inst->GetOpcode() == Opcode::Identity)
return inner.inst->GetArg(0).GetCoprocInfo(); return inner.inst->GetArg(0).GetCoprocInfo();
DEBUG_ASSERT(type == Type::CoprocInfo); ASSERT(type == Type::CoprocInfo);
return inner.imm_coproc; return inner.imm_coproc;
} }