From: Jakob Stoklund Olesen Date: Thu, 13 Dec 2012 23:23:46 +0000 (+0000) Subject: Use the new MI bundling API in MachineInstrBundle itself. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=caf946edf3478fcd00a572de380d9bf0fc00fd26;p=oota-llvm.git 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170159 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/MachineInstrBundle.cpp b/lib/CodeGen/MachineInstrBundle.cpp index dd46ecb17de..ffca550f8b6 100644 --- a/lib/CodeGen/MachineInstrBundle.cpp +++ b/lib/CodeGen/MachineInstrBundle.cpp @@ -47,8 +47,8 @@ bool UnpackMachineBundles::runOnMachineFunction(MachineFunction &MF) { // 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 @@ void llvm::finalizeBundle(MachineBasicBlock &MBB, 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 LocalDefs; SmallSet LocalDefSet; @@ -177,7 +179,6 @@ void llvm::finalizeBundle(MachineBasicBlock &MBB, } } - FirstMI->setIsInsideBundle(); Defs.clear(); }