[Hexagon] NFC Using canonicalizePacket to compound/duplex/pad packets rather than...
authorColin LeMahieu <colinl@codeaurora.org>
Thu, 3 Dec 2015 16:37:21 +0000 (16:37 +0000)
committerColin LeMahieu <colinl@codeaurora.org>
Thu, 3 Dec 2015 16:37:21 +0000 (16:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254616 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Hexagon/HexagonAsmPrinter.cpp

index 19769258ee89a6e5b97dc08937d3fd795922375d..8a6d6555d90109c6aef6675191e72ddb91e1643d 100644 (file)
@@ -191,29 +191,23 @@ void HexagonAsmPrinter::EmitInstruction(const MachineInstr *MI) {
     MachineBasicBlock::const_instr_iterator MII = MI->getIterator();
     unsigned IgnoreCount = 0;
 
-    for (++MII; MII != MBB->instr_end() && MII->isInsideBundle(); ++MII) {
+    for (++MII; MII != MBB->instr_end() && MII->isInsideBundle(); ++MII)
       if (MII->getOpcode() == TargetOpcode::DBG_VALUE ||
           MII->getOpcode() == TargetOpcode::IMPLICIT_DEF)
         ++IgnoreCount;
-      else {
+      else
         HexagonLowerToMC(MCII, &*MII, MCB, *this);
-      }
-    }
   }
-  else {
+  else
     HexagonLowerToMC(MCII, MI, MCB, *this);
-    HexagonMCInstrInfo::padEndloop(OutStreamer->getContext(), MCB);
-  }
-  // Examine the packet and try to find instructions that can be converted
-  // to compounds.
-  HexagonMCInstrInfo::tryCompound(MCII, OutStreamer->getContext(), MCB);
-  // Examine the packet and convert pairs of instructions to duplex
-  // instructions when possible.
-  SmallVector<DuplexCandidate, 8> possibleDuplexes;
-  possibleDuplexes = HexagonMCInstrInfo::getDuplexPossibilties(MCII, MCB);
-  HexagonMCShuffle(MCII, *Subtarget, OutStreamer->getContext(), MCB,
-                   possibleDuplexes);
-  EmitToStreamer(*OutStreamer, MCB);
+
+  bool Ok = HexagonMCInstrInfo::canonicalizePacket(
+      MCII, *Subtarget, OutStreamer->getContext(), MCB, nullptr);
+  assert(Ok);
+  (void)Ok;
+  if(HexagonMCInstrInfo::bundleSize(MCB) == 0)
+    return;
+  OutStreamer->EmitInstruction(MCB, getSubtargetInfo());
 }
 
 extern "C" void LLVMInitializeHexagonAsmPrinter() {