ir_opt/a64_get_set_elimination_pass: Add handling for NZCV raw get and set operations

This commit is contained in:
Lioncash 2019-03-06 18:46:30 -05:00 committed by MerryMage
parent aa22db534b
commit 6aed4036ef

View file

@ -23,7 +23,7 @@ void A64GetSetElimination(IR::Block& block) {
enum class TrackingType {
W, X,
S, D, Q,
SP, NZCV,
SP, NZCV, NZCVRaw,
};
struct RegisterInfo {
IR::Value register_value;
@ -100,6 +100,10 @@ void A64GetSetElimination(IR::Block& block) {
do_get(sp_info, inst, TrackingType::SP);
break;
}
case IR::Opcode::A64GetNZCVRaw: {
do_get(nzcv_info, inst, TrackingType::NZCVRaw);
break;
}
case IR::Opcode::A64SetW: {
const size_t index = A64::RegNumber(inst->GetArg(0).GetA64RegRef());
do_set(reg_info.at(index), inst->GetArg(1), inst, TrackingType::W);
@ -133,6 +137,10 @@ void A64GetSetElimination(IR::Block& block) {
do_set(nzcv_info, inst->GetArg(0), inst, TrackingType::NZCV);
break;
}
case IR::Opcode::A64SetNZCVRaw: {
do_set(nzcv_info, inst->GetArg(0), inst, TrackingType::NZCVRaw);
break;
}
default: {
if (inst->ReadsFromCPSR() || inst->WritesToCPSR()) {
nzcv_info = {};