diff options
author | Nicolas Geoffray <nicolas.geoffray@lip6.fr> | 2011-11-11 18:32:52 +0000 |
---|---|---|
committer | Nicolas Geoffray <nicolas.geoffray@lip6.fr> | 2011-11-11 18:32:52 +0000 |
commit | 26c328d7349076cb2a885076383c7d5f9adf44d6 (patch) | |
tree | 503cae5792d27ffda3f66b39588808b80d97865e /llvm/lib/CodeGen/GCStrategy.cpp | |
parent | a90cb7648928098aff158f127cd8cff0458c08b3 (diff) | |
download | bcm5719-llvm-26c328d7349076cb2a885076383c7d5f9adf44d6.tar.gz bcm5719-llvm-26c328d7349076cb2a885076383c7d5f9adf44d6.zip |
Add a custom safepoint method, in order for language implementers to decide which machine instruction gets to be a safepoint.
llvm-svn: 144399
Diffstat (limited to 'llvm/lib/CodeGen/GCStrategy.cpp')
-rw-r--r-- | llvm/lib/CodeGen/GCStrategy.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/GCStrategy.cpp b/llvm/lib/CodeGen/GCStrategy.cpp index 766c6ee542a..9349797e228 100644 --- a/llvm/lib/CodeGen/GCStrategy.cpp +++ b/llvm/lib/CodeGen/GCStrategy.cpp @@ -97,6 +97,7 @@ GCStrategy::GCStrategy() : CustomReadBarriers(false), CustomWriteBarriers(false), CustomRoots(false), + CustomSafePoints(false), InitRoots(true), UsesMetadata(false) {} @@ -116,6 +117,14 @@ bool GCStrategy::performCustomLowering(Function &F) { return 0; } + +bool GCStrategy::findCustomSafePoints(GCFunctionInfo& FI, MachineFunction &F) { + dbgs() << "gc " << getName() << " must override findCustomSafePoints.\n"; + llvm_unreachable(0); + return 0; +} + + GCFunctionInfo *GCStrategy::insertFunctionInfo(const Function &F) { GCFunctionInfo *FI = new GCFunctionInfo(F, *this); Functions.push_back(FI); @@ -405,9 +414,13 @@ bool MachineCodeAnalysis::runOnMachineFunction(MachineFunction &MF) { // Find the size of the stack frame. FI->setFrameSize(MF.getFrameInfo()->getStackSize()); - + // Find all safe points. - FindSafePoints(MF); + if (FI->getStrategy().customSafePoints()) { + FI->getStrategy().findCustomSafePoints(*FI, MF); + } else { + FindSafePoints(MF); + } // Find the stack offsets for all roots. FindStackOffsets(MF); |