get_set_elimination_pass: Refactor CPSR related eliminations
This commit is contained in:
parent
4c817b9bd5
commit
e7d02a5439
1 changed files with 18 additions and 20 deletions
|
@ -25,10 +25,12 @@ void GetSetElimination(IR::Block& block) {
|
||||||
std::array<RegisterInfo, 15> reg_info;
|
std::array<RegisterInfo, 15> reg_info;
|
||||||
std::array<RegisterInfo, 32> ext_reg_singles_info;
|
std::array<RegisterInfo, 32> ext_reg_singles_info;
|
||||||
std::array<RegisterInfo, 32> ext_reg_doubles_info;
|
std::array<RegisterInfo, 32> ext_reg_doubles_info;
|
||||||
RegisterInfo n_info;
|
struct CpsrInfo {
|
||||||
RegisterInfo z_info;
|
RegisterInfo n;
|
||||||
RegisterInfo c_info;
|
RegisterInfo z;
|
||||||
RegisterInfo v_info;
|
RegisterInfo c;
|
||||||
|
RegisterInfo v;
|
||||||
|
} cpsr_info;
|
||||||
|
|
||||||
const auto do_set = [&block](RegisterInfo& info, IR::Value value, Iterator set_inst) {
|
const auto do_set = [&block](RegisterInfo& info, IR::Value value, Iterator set_inst) {
|
||||||
if (info.set_instruction_present) {
|
if (info.set_instruction_present) {
|
||||||
|
@ -113,47 +115,43 @@ void GetSetElimination(IR::Block& block) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IR::Opcode::SetNFlag: {
|
case IR::Opcode::SetNFlag: {
|
||||||
do_set(n_info, inst->GetArg(0), inst);
|
do_set(cpsr_info.n, inst->GetArg(0), inst);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IR::Opcode::GetNFlag: {
|
case IR::Opcode::GetNFlag: {
|
||||||
do_get(n_info, inst);
|
do_get(cpsr_info.n, inst);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IR::Opcode::SetZFlag: {
|
case IR::Opcode::SetZFlag: {
|
||||||
do_set(z_info, inst->GetArg(0), inst);
|
do_set(cpsr_info.z, inst->GetArg(0), inst);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IR::Opcode::GetZFlag: {
|
case IR::Opcode::GetZFlag: {
|
||||||
do_get(z_info, inst);
|
do_get(cpsr_info.z, inst);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IR::Opcode::SetCFlag: {
|
case IR::Opcode::SetCFlag: {
|
||||||
do_set(c_info, inst->GetArg(0), inst);
|
do_set(cpsr_info.c, inst->GetArg(0), inst);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IR::Opcode::GetCFlag: {
|
case IR::Opcode::GetCFlag: {
|
||||||
do_get(c_info, inst);
|
do_get(cpsr_info.c, inst);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IR::Opcode::SetVFlag: {
|
case IR::Opcode::SetVFlag: {
|
||||||
do_set(v_info, inst->GetArg(0), inst);
|
do_set(cpsr_info.v, inst->GetArg(0), inst);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IR::Opcode::GetVFlag: {
|
case IR::Opcode::GetVFlag: {
|
||||||
do_get(v_info, inst);
|
do_get(cpsr_info.v, inst);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IR::Opcode::SetCpsr:
|
default: {
|
||||||
case IR::Opcode::GetCpsr: {
|
if (inst->ReadsFromCPSR() || inst->WritesToCPSR()) {
|
||||||
n_info = {};
|
cpsr_info = {};
|
||||||
z_info = {};
|
}
|
||||||
c_info = {};
|
|
||||||
v_info = {};
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue