+
+ // Check if the instruction clobbers any registers with debug vars.
+ for (MachineInstr::const_mop_iterator MOI = MI->operands_begin(),
+ MOE = MI->operands_end(); MOI != MOE; ++MOI) {
+ if (!MOI->isReg() || !MOI->isDef() || !MOI->getReg())
+ continue;
+ for (const unsigned *AI = TRI->getOverlaps(MOI->getReg());
+ unsigned Reg = *AI; ++AI) {
+ const MDNode *Var = LiveUserVar[Reg];
+ if (!Var)
+ continue;
+ // Reg is now clobbered.
+ LiveUserVar[Reg] = 0;
+
+ // Was MD last defined by a DBG_VALUE referring to Reg?
+ const MachineInstr *Last = LastDbgValue.lookup(Var);
+ if (!Last || Last->getParent() != MI->getParent())
+ continue;
+ if (!isDbgValueInDefinedReg(Last) ||
+ Last->getOperand(0).getReg() != Reg)
+ continue;
+ // MD is clobbered. Make sure the next instruction gets a label.
+ InsnsNeedsLabelAfter.insert(MI);
+ RegClobberInsn[Last] = MI;
+ }
+ }