[llvm-commits] [llvm] r170159 - /llvm/trunk/lib/CodeGen/MachineInstrBundle.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Thu Dec 13 15:23:46 PST 2012


Author: stoklund
Date: Thu Dec 13 17:23:46 2012
New Revision: 170159

URL: http://llvm.org/viewvc/llvm-project?rev=170159&view=rev
Log:
Use the new MI bundling API in MachineInstrBundle itself.

The new API is higher level than just manipulating the bundle flags
directly, and the setIsInsideBundle() function will disappear soon.

Modified:
    llvm/trunk/lib/CodeGen/MachineInstrBundle.cpp

Modified: llvm/trunk/lib/CodeGen/MachineInstrBundle.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstrBundle.cpp?rev=170159&r1=170158&r2=170159&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineInstrBundle.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineInstrBundle.cpp Thu Dec 13 17:23:46 2012
@@ -47,8 +47,8 @@
       // Remove BUNDLE instruction and the InsideBundle flags from bundled
       // instructions.
       if (MI->isBundle()) {
-        while (++MII != MIE && MII->isInsideBundle()) {
-          MII->setIsInsideBundle(false);
+        while (++MII != MIE && MII->isBundledWithPred()) {
+          MII->unbundleFromPred();
           for (unsigned i = 0, e = MII->getNumOperands(); i != e; ++i) {
             MachineOperand &MO = MII->getOperand(i);
             if (MO.isReg() && MO.isInternalRead())
@@ -101,13 +101,15 @@
                           MachineBasicBlock::instr_iterator FirstMI,
                           MachineBasicBlock::instr_iterator LastMI) {
   assert(FirstMI != LastMI && "Empty bundle?");
+  MIBundleBuilder Bundle(MBB, FirstMI, LastMI);
 
   const TargetMachine &TM = MBB.getParent()->getTarget();
   const TargetInstrInfo *TII = TM.getInstrInfo();
   const TargetRegisterInfo *TRI = TM.getRegisterInfo();
 
-  MachineInstrBuilder MIB = BuildMI(MBB, FirstMI, FirstMI->getDebugLoc(),
+  MachineInstrBuilder MIB = BuildMI(*MBB.getParent(), FirstMI->getDebugLoc(),
                                     TII->get(TargetOpcode::BUNDLE));
+  Bundle.prepend(MIB);
 
   SmallVector<unsigned, 32> LocalDefs;
   SmallSet<unsigned, 32> LocalDefSet;
@@ -177,7 +179,6 @@
       }
     }
 
-    FirstMI->setIsInsideBundle();
     Defs.clear();
   }
 





More information about the llvm-commits mailing list