X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FCodeGen%2FErlangGC.cpp;h=024946d1436245c02b3168bca766b2eaae67060b;hb=1186e7ae9eb000ad8e341fb9235db7bc209e4ac8;hp=8a1e2d9c99a850a17b156d07d642610ea247a5ea;hpb=477de3a7859104d7c41a36628169e13e524e980a;p=oota-llvm.git diff --git a/lib/CodeGen/ErlangGC.cpp b/lib/CodeGen/ErlangGC.cpp index 8a1e2d9c99a..024946d1436 100644 --- a/lib/CodeGen/ErlangGC.cpp +++ b/lib/CodeGen/ErlangGC.cpp @@ -21,61 +21,26 @@ #include "llvm/MC/MCSymbol.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetMachine.h" +#include "llvm/Target/TargetSubtargetInfo.h" 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); - }; - +class ErlangGC : public GCStrategy { +public: + ErlangGC(); +}; } -static GCRegistry::Add -X("erlang", "erlang-compatible garbage collector"); +static GCRegistry::Add X("erlang", + "erlang-compatible garbage collector"); -void llvm::linkErlangGC() { } +void llvm::linkErlangGC() {} ErlangGC::ErlangGC() { InitRoots = false; 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()->getTarget().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; }