diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2013-04-08 18:41:23 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2013-04-08 18:41:23 +0000 | 
| commit | 4a16efa3e43e35f0cc9efe3a67f620f0017c3d36 (patch) | |
| tree | 06099edc18d30894081a822b756f117cbe0b8207 /lib/CodeGen/MachineInstrBundle.cpp | |
| parent | 482e7bddf617ae804dc47133cb07eb4aa81e45de (diff) | |
Notes
Diffstat (limited to 'lib/CodeGen/MachineInstrBundle.cpp')
| -rw-r--r-- | lib/CodeGen/MachineInstrBundle.cpp | 28 | 
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/CodeGen/MachineInstrBundle.cpp b/lib/CodeGen/MachineInstrBundle.cpp index 1f7fbfc719b0..77bcd1d7c8e3 100644 --- a/lib/CodeGen/MachineInstrBundle.cpp +++ b/lib/CodeGen/MachineInstrBundle.cpp @@ -8,14 +8,14 @@  //===----------------------------------------------------------------------===//  #include "llvm/CodeGen/MachineInstrBundle.h" +#include "llvm/ADT/SmallSet.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/CodeGen/MachineFunctionPass.h"  #include "llvm/CodeGen/MachineInstrBuilder.h"  #include "llvm/CodeGen/Passes.h" -#include "llvm/CodeGen/MachineFunctionPass.h"  #include "llvm/Target/TargetInstrInfo.h"  #include "llvm/Target/TargetMachine.h"  #include "llvm/Target/TargetRegisterInfo.h" -#include "llvm/ADT/SmallSet.h" -#include "llvm/ADT/SmallVector.h"  using namespace llvm;  namespace { @@ -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<unsigned, 32> LocalDefs;    SmallSet<unsigned, 32> LocalDefSet; @@ -177,7 +179,6 @@ void llvm::finalizeBundle(MachineBasicBlock &MBB,        }      } -    FirstMI->setIsInsideBundle();      Defs.clear();    } @@ -223,14 +224,13 @@ bool llvm::finalizeBundles(MachineFunction &MF) {    bool Changed = false;    for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) {      MachineBasicBlock &MBB = *I; -      MachineBasicBlock::instr_iterator MII = MBB.instr_begin(); -    assert(!MII->isInsideBundle() && -           "First instr cannot be inside bundle before finalization!"); -      MachineBasicBlock::instr_iterator MIE = MBB.instr_end();      if (MII == MIE)        continue; +    assert(!MII->isInsideBundle() && +           "First instr cannot be inside bundle before finalization!"); +      for (++MII; MII != MIE; ) {        if (!MII->isInsideBundle())          ++MII; @@ -281,7 +281,7 @@ MachineOperandIteratorBase::PhysRegInfo  MachineOperandIteratorBase::analyzePhysReg(unsigned Reg,                                             const TargetRegisterInfo *TRI) {    bool AllDefsDead = true; -  PhysRegInfo PRI = {false, false, false, false, false, false, false}; +  PhysRegInfo PRI = {false, false, false, false, false, false};    assert(TargetRegisterInfo::isPhysicalRegister(Reg) &&           "analyzePhysReg not given a physical register!"); @@ -305,7 +305,9 @@ MachineOperandIteratorBase::analyzePhysReg(unsigned Reg,        // Reg or a super-reg is read, and perhaps killed also.        PRI.Reads = true;        PRI.Kills = MO.isKill(); -    } if (IsRegOrOverlapping && MO.readsReg()) { +    } + +    if (IsRegOrOverlapping && MO.readsReg()) {        PRI.ReadsOverlap = true;// Reg or an overlapping register is read.      }  | 
