llvm.org GIT mirror llvm / 24c2e5c
Adding kill info to val#. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40925 91177308-0d34-0410-b5e6-96231b3b80d8 Evan Cheng 12 years ago
2 changed file(s) with 25 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
165165 /// addKillForValNum - Add a kill instruction index to the specified value
166166 /// number.
167167 void addKillForValNum(unsigned ValNo, unsigned KillIdx) {
168 assert(ValNo < ValueNumberInfo.size());
168169 ValueNumberInfo[ValNo].kills.push_back(KillIdx);
170 }
171
172 /// replaceKillForValNum - Replace a kill index of the specified value with
173 /// a new kill index.
174 bool replaceKillForValNum(unsigned ValNo, unsigned OldKill,
175 unsigned NewKill) {
176 SmallVector kills = ValueNumberInfo[ValNo].kills;
177 SmallVector::iterator I =
178 std::find(kills.begin(), kills.end(), OldKill);
179 if (I == kills.end())
180 return false;
181 kills.erase(I);
182 kills.push_back(NewKill);
183 return true;
169184 }
170185
171186 VNInfo getValNumInfo(unsigned ValNo) const {
456456 LiveRange LR(DefIndex, RedefIndex, ValNo);
457457 DOUT << " replace range with " << LR;
458458 interval.addRange(LR);
459 interval.addKillForValNum(ValNo, RedefIndex);
459460
460461 // If this redefinition is dead, we need to add a dummy unit live
461462 // range covering the def slot.
480481 DOUT << " Removing [" << Start << "," << End << "] from: ";
481482 interval.print(DOUT, mri_); DOUT << "\n";
482483 interval.removeRange(Start, End);
484 bool replaced = interval.replaceKillForValNum(0, End, Start);
485 assert(replaced && "Incorrect kill info?");
483486 DOUT << " RESULT: "; interval.print(DOUT, mri_);
484487
485488 // Replace the interval with one of a NEW value number. Note that this
487490 LiveRange LR(Start, End, interval.getNextValue(~0, 0));
488491 DOUT << " replace range with " << LR;
489492 interval.addRange(LR);
493 interval.addKillForValNum(LR.ValId, End);
490494 DOUT << " RESULT: "; interval.print(DOUT, mri_);
491495 }
492496
502506 else
503507 ValNum = interval.getNextValue(defIndex, SrcReg);
504508
505 LiveRange LR(defIndex,
506 getInstructionIndex(&mbb->back()) + InstrSlots::NUM, ValNum);
509 unsigned killIndex = getInstructionIndex(&mbb->back()) + InstrSlots::NUM;
510 LiveRange LR(defIndex, killIndex, ValNum);
507511 interval.addRange(LR);
512 interval.addKillForValNum(ValNum, killIndex);
508513 DOUT << " +" << LR;
509514 }
510515 }
569574 ? OldLR->ValId : interval.getNextValue(start, SrcReg);
570575 LiveRange LR(start, end, Id);
571576 interval.addRange(LR);
577 interval.addKillForValNum(LR.ValId, end);
572578 DOUT << " +" << LR << '\n';
573579 }
574580
634640 }
635641
636642 LiveRange LR(start, end, interval.getNextValue(start, 0));
643 interval.addRange(LR);
644 interval.addKillForValNum(LR.ValId, end);
637645 DOUT << " +" << LR << '\n';
638 interval.addRange(LR);
639646 }
640647
641648 /// computeIntervals - computes the live intervals for virtual