reg_alloc: Call DecrementRemainingUses in only one place
This commit is contained in:
parent
51fc9fec05
commit
184db36caf
2 changed files with 3 additions and 17 deletions
|
@ -567,10 +567,6 @@ void EmitX64::EmitLogicalShiftLeft(RegAlloc& reg_alloc, IR::Block& block, IR::In
|
||||||
// TODO: Consider using BMI2 instructions like SHLX when arm-in-host flags is implemented.
|
// TODO: Consider using BMI2 instructions like SHLX when arm-in-host flags is implemented.
|
||||||
|
|
||||||
if (!carry_inst) {
|
if (!carry_inst) {
|
||||||
if (!carry_arg.IsImmediate()) {
|
|
||||||
inst->GetArg(2).GetInst()->DecrementRemainingUses();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shift_arg.IsImmediate()) {
|
if (shift_arg.IsImmediate()) {
|
||||||
Xbyak::Reg32 result = reg_alloc.UseScratchGpr(operand_arg).cvt32();
|
Xbyak::Reg32 result = reg_alloc.UseScratchGpr(operand_arg).cvt32();
|
||||||
u8 shift = shift_arg.GetImmediateU8();
|
u8 shift = shift_arg.GetImmediateU8();
|
||||||
|
@ -669,10 +665,6 @@ void EmitX64::EmitLogicalShiftRight(RegAlloc& reg_alloc, IR::Block& block, IR::I
|
||||||
auto& carry_arg = args[2];
|
auto& carry_arg = args[2];
|
||||||
|
|
||||||
if (!carry_inst) {
|
if (!carry_inst) {
|
||||||
if (!carry_arg.IsImmediate()) {
|
|
||||||
inst->GetArg(2).GetInst()->DecrementRemainingUses();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shift_arg.IsImmediate()) {
|
if (shift_arg.IsImmediate()) {
|
||||||
Xbyak::Reg32 result = reg_alloc.UseScratchGpr(operand_arg).cvt32();
|
Xbyak::Reg32 result = reg_alloc.UseScratchGpr(operand_arg).cvt32();
|
||||||
u8 shift = shift_arg.GetImmediateU8();
|
u8 shift = shift_arg.GetImmediateU8();
|
||||||
|
@ -788,10 +780,6 @@ void EmitX64::EmitArithmeticShiftRight(RegAlloc& reg_alloc, IR::Block& block, IR
|
||||||
auto& carry_arg = args[2];
|
auto& carry_arg = args[2];
|
||||||
|
|
||||||
if (!carry_inst) {
|
if (!carry_inst) {
|
||||||
if (!carry_arg.IsImmediate()) {
|
|
||||||
inst->GetArg(2).GetInst()->DecrementRemainingUses();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shift_arg.IsImmediate()) {
|
if (shift_arg.IsImmediate()) {
|
||||||
u8 shift = shift_arg.GetImmediateU8();
|
u8 shift = shift_arg.GetImmediateU8();
|
||||||
Xbyak::Reg32 result = reg_alloc.UseScratchGpr(operand_arg).cvt32();
|
Xbyak::Reg32 result = reg_alloc.UseScratchGpr(operand_arg).cvt32();
|
||||||
|
@ -880,10 +868,6 @@ void EmitX64::EmitRotateRight(RegAlloc& reg_alloc, IR::Block& block, IR::Inst* i
|
||||||
auto& carry_arg = args[2];
|
auto& carry_arg = args[2];
|
||||||
|
|
||||||
if (!carry_inst) {
|
if (!carry_inst) {
|
||||||
if (!carry_arg.IsImmediate()) {
|
|
||||||
inst->GetArg(2).GetInst()->DecrementRemainingUses();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (shift_arg.IsImmediate()) {
|
if (shift_arg.IsImmediate()) {
|
||||||
u8 shift = shift_arg.GetImmediateU8();
|
u8 shift = shift_arg.GetImmediateU8();
|
||||||
Xbyak::Reg32 result = reg_alloc.UseScratchGpr(operand_arg).cvt32();
|
Xbyak::Reg32 result = reg_alloc.UseScratchGpr(operand_arg).cvt32();
|
||||||
|
|
|
@ -114,6 +114,9 @@ std::array<Argument, 3> RegAlloc::GetArgumentInfo(IR::Inst* inst) {
|
||||||
for (size_t i = 0; i < inst->NumArgs(); i++) {
|
for (size_t i = 0; i < inst->NumArgs(); i++) {
|
||||||
IR::Value arg = inst->GetArg(i);
|
IR::Value arg = inst->GetArg(i);
|
||||||
ret[i].value = arg;
|
ret[i].value = arg;
|
||||||
|
if (!arg.IsImmediate()) {
|
||||||
|
arg.GetInst()->DecrementRemainingUses();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -326,7 +329,6 @@ void RegAlloc::DefineValueImpl(IR::Inst* def_inst, const IR::Value& use_inst) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
use_inst.GetInst()->DecrementRemainingUses();
|
|
||||||
DEBUG_ASSERT_MSG(ValueLocation(use_inst.GetInst()), "use_inst must already be defined");
|
DEBUG_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);
|
||||||
|
|
Loading…
Reference in a new issue