summaryrefslogtreecommitdiff
path: root/lib/CodeGen/GCStrategy.cpp
diff options
context:
space:
mode:
authorNicolas Geoffray <nicolas.geoffray@lip6.fr>2011-11-11 18:32:52 +0000
committerNicolas Geoffray <nicolas.geoffray@lip6.fr>2011-11-11 18:32:52 +0000
commit7b8c2f8587763e0a8ce48f9b7b67287930129c8d (patch)
tree610106b80d428273c4ae65a0d78aa2705735bab6 /lib/CodeGen/GCStrategy.cpp
parent48857eb17935c664626fb2eb333ef7c2b56215cd (diff)
downloadllvm-7b8c2f8587763e0a8ce48f9b7b67287930129c8d.tar.gz
llvm-7b8c2f8587763e0a8ce48f9b7b67287930129c8d.tar.bz2
llvm-7b8c2f8587763e0a8ce48f9b7b67287930129c8d.tar.xz
Add a custom safepoint method, in order for language implementers to decide which machine instruction gets to be a safepoint.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144399 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/GCStrategy.cpp')
-rw-r--r--lib/CodeGen/GCStrategy.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/CodeGen/GCStrategy.cpp b/lib/CodeGen/GCStrategy.cpp
index 766c6ee542..9349797e22 100644
--- a/lib/CodeGen/GCStrategy.cpp
+++ b/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);