llvm.org GIT mirror llvm / 0bd10f2
Remove GC roots that reference dead objects. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166763 91177308-0d34-0410-b5e6-96231b3b80d8 Nicolas Geoffray 7 years ago
2 changed file(s) with 15 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
121121 Roots.push_back(GCRoot(Num, Metadata));
122122 }
123123
124 /// removeStackRoot - Removes a root.
125 roots_iterator removeStackRoot(roots_iterator position) {
126 return Roots.erase(position);
127 }
128
124129 /// addSafePoint - Notes the existence of a safe point. Num is the ID of the
125130 /// label just prior to the safe point (if the code generator is using
126131 /// MachineModuleInfo).
387387 const TargetFrameLowering *TFI = TM->getFrameLowering();
388388 assert(TFI && "TargetRegisterInfo not available!");
389389
390 for (GCFunctionInfo::roots_iterator RI = FI->roots_begin(),
391 RE = FI->roots_end(); RI != RE; ++RI)
392 RI->StackOffset = TFI->getFrameIndexOffset(MF, RI->Num);
390 for (GCFunctionInfo::roots_iterator RI = FI->roots_begin();
391 RI != FI->roots_end();) {
392 // If the root references a dead object, no need to keep it.
393 if (MF.getFrameInfo()->isDeadObjectIndex(RI->Num)) {
394 RI = FI->removeStackRoot(RI);
395 } else {
396 RI->StackOffset = TFI->getFrameIndexOffset(MF, RI->Num);
397 ++RI;
398 }
399 }
393400 }
394401
395402 bool GCMachineCodeAnalysis::runOnMachineFunction(MachineFunction &MF) {