reg_alloc: Only exchange GPRs

This commit is contained in:
MerryMage 2018-02-18 23:24:15 +00:00
parent 9df3793af0
commit 84f1c9b7f4

View file

@ -34,10 +34,8 @@ static u64 ImmediateToU64(const IR::Value& imm) {
} }
} }
static bool IsSameHostLocClass(HostLoc a, HostLoc b) { static bool CanExchange(HostLoc a, HostLoc b) {
return (HostLocIsGPR(a) && HostLocIsGPR(b)) return HostLocIsGPR(a) && HostLocIsGPR(b);
|| (HostLocIsXMM(a) && HostLocIsXMM(b))
|| (HostLocIsSpill(a) && HostLocIsSpill(b));
} }
// Minimum number of bits required to represent a type // Minimum number of bits required to represent a type
@ -302,7 +300,7 @@ HostLoc RegAlloc::UseImpl(IR::Value use_value, HostLocList desired_locations) {
} }
const HostLoc destination_location = SelectARegister(desired_locations); const HostLoc destination_location = SelectARegister(desired_locations);
if (IsSameHostLocClass(destination_location, current_location)) { if (CanExchange(destination_location, current_location)) {
Exchange(destination_location, current_location); Exchange(destination_location, current_location);
} else { } else {
MoveOutOfTheWay(destination_location); MoveOutOfTheWay(destination_location);