mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
Remove gc.root's findCustomSafePoints mechanism
Searching all of the existing gc.root implementations I'm aware of (all three of them), there was exactly one use of this mechanism, and that was to implement a performance improvement that should have been applied to the default lowering. Having this function is requiring a dependency on a CodeGen class (MachineFunction), in a class which is otherwise completely independent of CodeGen. I could solve this differently, but given that I see absolutely no value in preserving this mechanism, I going to just get rid of it. Note: Tis is the first time I'm intentionally breaking previously supported gc.root functionality. Given 3.6 has branched, I believe this is a good time to do this. Differential Revision: http://reviews.llvm.org/D7004 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226305 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -28,12 +28,8 @@ using namespace llvm;
|
||||
namespace {
|
||||
|
||||
class ErlangGC : public GCStrategy {
|
||||
MCSymbol *InsertLabel(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI,
|
||||
DebugLoc DL) const;
|
||||
public:
|
||||
ErlangGC();
|
||||
bool findCustomSafePoints(GCFunctionInfo &FI, MachineFunction &MF) override;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -48,35 +44,4 @@ ErlangGC::ErlangGC() {
|
||||
NeededSafePoints = 1 << GC::PostCall;
|
||||
UsesMetadata = true;
|
||||
CustomRoots = false;
|
||||
CustomSafePoints = true;
|
||||
}
|
||||
|
||||
MCSymbol *ErlangGC::InsertLabel(MachineBasicBlock &MBB,
|
||||
MachineBasicBlock::iterator MI,
|
||||
DebugLoc DL) const {
|
||||
const TargetInstrInfo *TII = MBB.getParent()->getSubtarget().getInstrInfo();
|
||||
MCSymbol *Label = MBB.getParent()->getContext().CreateTempSymbol();
|
||||
BuildMI(MBB, MI, DL, TII->get(TargetOpcode::GC_LABEL)).addSym(Label);
|
||||
return Label;
|
||||
}
|
||||
|
||||
bool ErlangGC::findCustomSafePoints(GCFunctionInfo &FI, MachineFunction &MF) {
|
||||
for (MachineFunction::iterator BBI = MF.begin(), BBE = MF.end(); BBI != BBE;
|
||||
++BBI)
|
||||
for (MachineBasicBlock::iterator MI = BBI->begin(), ME = BBI->end();
|
||||
MI != ME; ++MI)
|
||||
|
||||
if (MI->getDesc().isCall()) {
|
||||
|
||||
// Do not treat tail call sites as safe points.
|
||||
if (MI->getDesc().isTerminator())
|
||||
continue;
|
||||
|
||||
/* Code copied from VisitCallPoint(...) */
|
||||
MachineBasicBlock::iterator RAI = MI; ++RAI;
|
||||
MCSymbol* Label = InsertLabel(*MI->getParent(), RAI, MI->getDebugLoc());
|
||||
FI.addSafePoint(GC::PostCall, Label, MI->getDebugLoc());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -329,8 +329,15 @@ void GCMachineCodeAnalysis::FindSafePoints(MachineFunction &MF) {
|
||||
++BBI)
|
||||
for (MachineBasicBlock::iterator MI = BBI->begin(), ME = BBI->end();
|
||||
MI != ME; ++MI)
|
||||
if (MI->isCall())
|
||||
if (MI->isCall()) {
|
||||
// Do not treat tail or sibling call sites as safe points. This is
|
||||
// legal since any arguments passed to the callee which live in the
|
||||
// remnants of the callers frame will be owned and updated by the
|
||||
// callee if required.
|
||||
if (MI->isTerminator())
|
||||
continue;
|
||||
VisitCallPoint(MI);
|
||||
}
|
||||
}
|
||||
|
||||
void GCMachineCodeAnalysis::FindStackOffsets(MachineFunction &MF) {
|
||||
@@ -366,11 +373,7 @@ bool GCMachineCodeAnalysis::runOnMachineFunction(MachineFunction &MF) {
|
||||
FI->setFrameSize(MF.getFrameInfo()->getStackSize());
|
||||
|
||||
// Find all safe points.
|
||||
if (FI->getStrategy().customSafePoints()) {
|
||||
FI->getStrategy().findCustomSafePoints(*FI, MF);
|
||||
} else {
|
||||
FindSafePoints(MF);
|
||||
}
|
||||
FindSafePoints(MF);
|
||||
|
||||
// Find the stack offsets for all roots.
|
||||
FindStackOffsets(MF);
|
||||
|
||||
@@ -18,5 +18,5 @@ using namespace llvm;
|
||||
|
||||
GCStrategy::GCStrategy()
|
||||
: UseStatepoints(false), NeededSafePoints(0), CustomReadBarriers(false),
|
||||
CustomWriteBarriers(false), CustomRoots(false), CustomSafePoints(false),
|
||||
CustomWriteBarriers(false), CustomRoots(false),
|
||||
InitRoots(true), UsesMetadata(false) {}
|
||||
|
||||
@@ -33,7 +33,6 @@ public:
|
||||
NeededSafePoints = 0;
|
||||
UsesMetadata = false;
|
||||
CustomRoots = false;
|
||||
CustomSafePoints = false;
|
||||
}
|
||||
Optional<bool> isGCManagedPointer(const Value *V) const override {
|
||||
// Method is only valid on pointer typed values.
|
||||
|
||||
Reference in New Issue
Block a user