[AArch64] Slight cleanup in FPLoadBalancing
authorJames Molloy <james.molloy@arm.com>
Fri, 26 Feb 2016 09:10:53 +0000 (09:10 +0000)
committerJames Molloy <james.molloy@arm.com>
Fri, 26 Feb 2016 09:10:53 +0000 (09:10 +0000)
Instead of the convoluted if-statment we can just use getColor. This also fixes
a bug where we relied upon the parity of tablegen-generated register indexes
(instead of using the machine encoding).

llvm-svn: 261990

llvm/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp

index 3d1ab4e..61dc157 100644 (file)
@@ -530,8 +530,7 @@ int AArch64A57FPLoadBalancing::scavengeRegister(Chain *G, Color C,
   for (auto Reg : Ord) {
     if (!AvailableRegs[Reg])
       continue;
-    if ((C == Color::Even && (Reg % 2) == 0) ||
-        (C == Color::Odd && (Reg % 2) == 1))
+    if (C == getColor(Reg))
       return Reg;
   }