mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-04 05:31:51 +00:00
Remove GC roots that reference dead objects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166763 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8b1b4136a0
commit
0bd10f2af3
@ -122,6 +122,11 @@ namespace llvm {
|
|||||||
Roots.push_back(GCRoot(Num, Metadata));
|
Roots.push_back(GCRoot(Num, Metadata));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// removeStackRoot - Removes a root.
|
||||||
|
roots_iterator removeStackRoot(roots_iterator position) {
|
||||||
|
return Roots.erase(position);
|
||||||
|
}
|
||||||
|
|
||||||
/// addSafePoint - Notes the existence of a safe point. Num is the ID of the
|
/// addSafePoint - Notes the existence of a safe point. Num is the ID of the
|
||||||
/// label just prior to the safe point (if the code generator is using
|
/// label just prior to the safe point (if the code generator is using
|
||||||
/// MachineModuleInfo).
|
/// MachineModuleInfo).
|
||||||
|
@ -388,9 +388,16 @@ void GCMachineCodeAnalysis::FindStackOffsets(MachineFunction &MF) {
|
|||||||
const TargetFrameLowering *TFI = TM->getFrameLowering();
|
const TargetFrameLowering *TFI = TM->getFrameLowering();
|
||||||
assert(TFI && "TargetRegisterInfo not available!");
|
assert(TFI && "TargetRegisterInfo not available!");
|
||||||
|
|
||||||
for (GCFunctionInfo::roots_iterator RI = FI->roots_begin(),
|
for (GCFunctionInfo::roots_iterator RI = FI->roots_begin();
|
||||||
RE = FI->roots_end(); RI != RE; ++RI)
|
RI != FI->roots_end();) {
|
||||||
RI->StackOffset = TFI->getFrameIndexOffset(MF, RI->Num);
|
// If the root references a dead object, no need to keep it.
|
||||||
|
if (MF.getFrameInfo()->isDeadObjectIndex(RI->Num)) {
|
||||||
|
RI = FI->removeStackRoot(RI);
|
||||||
|
} else {
|
||||||
|
RI->StackOffset = TFI->getFrameIndexOffset(MF, RI->Num);
|
||||||
|
++RI;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GCMachineCodeAnalysis::runOnMachineFunction(MachineFunction &MF) {
|
bool GCMachineCodeAnalysis::runOnMachineFunction(MachineFunction &MF) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user