mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-02 07:22:24 +00:00
Don't reuse stack space for now
This commit is contained in:
parent
f18971022d
commit
8a0fe21b4e
@ -167,12 +167,7 @@ void EmitContext::SpillInst(RegAllocContext& ctx, const ActiveInstInterval& inte
|
|||||||
ActiveIntervalList& active_intervals) {
|
ActiveIntervalList& active_intervals) {
|
||||||
const auto get_operand = [&](IR::Inst* inst) -> Operand {
|
const auto get_operand = [&](IR::Inst* inst) -> Operand {
|
||||||
size_t current_sp = inst_stack_space;
|
size_t current_sp = inst_stack_space;
|
||||||
if (ctx.free_stack_slots.empty()) {
|
inst_stack_space += 8;
|
||||||
inst_stack_space += 8;
|
|
||||||
} else {
|
|
||||||
current_sp += ctx.free_stack_slots.back();
|
|
||||||
ctx.free_stack_slots.pop_back();
|
|
||||||
}
|
|
||||||
switch (GetRegBytesOfType(IR::Value(inst))) {
|
switch (GetRegBytesOfType(IR::Value(inst))) {
|
||||||
case 1:
|
case 1:
|
||||||
return byte[r11 + current_sp];
|
return byte[r11 + current_sp];
|
||||||
@ -192,14 +187,12 @@ void EmitContext::SpillInst(RegAllocContext& ctx, const ActiveInstInterval& inte
|
|||||||
[](const ActiveInstInterval& a, const ActiveInstInterval& b) { return a.end < b.end; });
|
[](const ActiveInstInterval& a, const ActiveInstInterval& b) { return a.end < b.end; });
|
||||||
if (spill_candidate == active_intervals.end() || spill_candidate->end <= interval.start) {
|
if (spill_candidate == active_intervals.end() || spill_candidate->end <= interval.start) {
|
||||||
inst_to_operands[interval.inst][interval.component] = get_operand(interval.inst);
|
inst_to_operands[interval.inst][interval.component] = get_operand(interval.inst);
|
||||||
ctx.active_spill_intervals.push_back(interval);
|
|
||||||
} else {
|
} else {
|
||||||
Operands& operands = inst_to_operands[spill_candidate->inst];
|
Operands& operands = inst_to_operands[spill_candidate->inst];
|
||||||
Reg reg = operands[spill_candidate->component].Reg();
|
OperandHolder op = operands[spill_candidate->component];
|
||||||
inst_to_operands[interval.inst][interval.component] =
|
inst_to_operands[interval.inst][interval.component] =
|
||||||
reg.isXMM() ? reg : ResizeRegToType(reg, interval.inst);
|
op.IsXmm() ? op : ResizeRegToType(op.Reg(), interval.inst);
|
||||||
operands[spill_candidate->component] = get_operand(spill_candidate->inst);
|
operands[spill_candidate->component] = get_operand(spill_candidate->inst);
|
||||||
ctx.active_spill_intervals.push_back(*spill_candidate);
|
|
||||||
*spill_candidate = interval;
|
*spill_candidate = interval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -304,16 +297,6 @@ void EmitContext::AllocateRegisters() {
|
|||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto it = ctx.active_spill_intervals.begin();
|
|
||||||
it != ctx.active_spill_intervals.end();) {
|
|
||||||
if (it->end < interval.start) {
|
|
||||||
const Address& addr = inst_to_operands[it->inst][it->component].Mem();
|
|
||||||
ctx.free_stack_slots.push_back(addr.getDisp());
|
|
||||||
it = ctx.active_spill_intervals.erase(it);
|
|
||||||
} else {
|
|
||||||
++it;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
u8 num_components = GetNumComponentsOfType(interval.inst);
|
u8 num_components = GetNumComponentsOfType(interval.inst);
|
||||||
bool is_floating = IsFloatingType(interval.inst);
|
bool is_floating = IsFloatingType(interval.inst);
|
||||||
auto& operands = inst_to_operands[interval.inst];
|
auto& operands = inst_to_operands[interval.inst];
|
||||||
|
@ -154,10 +154,8 @@ private:
|
|||||||
struct RegAllocContext {
|
struct RegAllocContext {
|
||||||
boost::container::static_vector<Xbyak::Reg64, NumGPRegs> free_gp_regs;
|
boost::container::static_vector<Xbyak::Reg64, NumGPRegs> free_gp_regs;
|
||||||
boost::container::static_vector<Xbyak::Xmm, NumXmmRegs> free_xmm_regs;
|
boost::container::static_vector<Xbyak::Xmm, NumXmmRegs> free_xmm_regs;
|
||||||
boost::container::small_vector<size_t, 8> free_stack_slots;
|
|
||||||
ActiveIntervalList active_gp_intervals;
|
ActiveIntervalList active_gp_intervals;
|
||||||
ActiveIntervalList active_xmm_intervals;
|
ActiveIntervalList active_xmm_intervals;
|
||||||
ActiveIntervalList active_spill_intervals;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
using FlatInstList = boost::container::small_vector<IR::Inst*, 64>;
|
using FlatInstList = boost::container::small_vector<IR::Inst*, 64>;
|
||||||
|
Loading…
Reference in New Issue
Block a user