[llvm] r266029 - [RegBankSelect] Teach the repairing code how to handle physical

Quentin Colombet via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 11 17:38:52 PDT 2016


Author: qcolombet
Date: Mon Apr 11 19:38:51 2016
New Revision: 266029

URL: http://llvm.org/viewvc/llvm-project?rev=266029&view=rev
Log:
[RegBankSelect] Teach the repairing code how to handle physical
registers.

Modified:
    llvm/trunk/lib/CodeGen/GlobalISel/RegBankSelect.cpp

Modified: llvm/trunk/lib/CodeGen/GlobalISel/RegBankSelect.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/RegBankSelect.cpp?rev=266029&r1=266028&r2=266029&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/RegBankSelect.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/RegBankSelect.cpp Mon Apr 11 19:38:51 2016
@@ -63,7 +63,10 @@ RegBankSelect::repairReg(unsigned Reg,
   assert(ValMapping.BreakDown.size() == 1 &&
          "Support for complex break down not supported yet");
   const RegisterBankInfo::PartialMapping &PartialMap = ValMapping.BreakDown[0];
-  assert(PartialMap.Mask.getBitWidth() == MRI->getSize(Reg) &&
+  assert(PartialMap.Mask.getBitWidth() ==
+             (TargetRegisterInfo::isPhysicalRegister(Reg)
+                  ? TRI->getMinimalPhysRegClass(Reg)->getSize() * 8
+                  : MRI->getSize(Reg)) &&
          "Repairing other than copy not implemented yet");
   // If the MIRBuilder is configured to insert somewhere else than
   // DefUseMI, we may not use this function like was it first
@@ -207,7 +210,8 @@ void RegBankSelect::assignInstr(MachineI
     // Therefore, create a new temporary for Reg.
     assert(ValMapping.BreakDown.size() == 1 &&
            "Support for complex break down not supported yet");
-    if (MRI->getRegClassOrRegBank(Reg)) {
+    if (TargetRegisterInfo::isPhysicalRegister(Reg) ||
+        MRI->getRegClassOrRegBank(Reg)) {
       if (!MO.isDef() && MI.isPHI()) {
         // Phis are already copies, so there is nothing to repair.
         // Note: This will not hold when we support break downs with




More information about the llvm-commits mailing list