[PATCH] D48019: [mips] Handle branch expansion corner cases

Simon Dardis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 11 08:05:53 PDT 2018


sdardis added inline comments.


================
Comment at: lib/Target/Mips/MipsBranchExpansion.cpp:636
+
+    if (STI->hasMips32r6() && isInt<28>(I.Offset)) {
+      // R6:
----------------
Use isBranchOffsetInRange rather than isInt<28>. It does the same thing but performs information hiding.


================
Comment at: lib/Target/Mips/MipsBranchExpansion.cpp:699-704
+        unsigned JROp =
+            STI->useIndirectJumpsHazard()
+                ? (STI->hasMips32r6() ? Mips::JR_HB_R6 : Mips::JR_HB)
+                : (STI->hasMips32r6()
+                       ? (STI->inMicroMipsMode() ? Mips::JIC_MMR6 : Mips::JIC)
+                       : Mips::JR);
----------------
Separate out this into a private function of this class and replace all the occurrences of similar logic with a call to the new function.


================
Comment at: lib/Target/Mips/MipsBranchExpansion.cpp:713
+      }
+      BuildMI(*LongBrMBB, Pos, DL, TII->get(Mips::NOP));
+    }
----------------
This nop is unneeded for MIPSR6 when using jrc or bc.


================
Comment at: lib/Target/Mips/MipsBranchExpansion.cpp:786
 
-  initMBBInfo();
-
   SmallVectorImpl<MBBInfo>::iterator I, E = MBBInfos.end();
   bool EverMadeChange = false, MadeChange = true;
----------------
These variables are unused.


Repository:
  rL LLVM

https://reviews.llvm.org/D48019





More information about the llvm-commits mailing list