Attach a DebugLoc to a GC point in order to get precise information in the JIT of a GC point.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114736 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Nicolas Geoffray
2010-09-24 17:27:50 +00:00
parent facb34b41c
commit 946e3c9f9d
2 changed files with 14 additions and 9 deletions

View File

@@ -36,6 +36,7 @@
#include "llvm/Pass.h" #include "llvm/Pass.h"
#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringMap.h"
#include "llvm/Support/DebugLoc.h"
namespace llvm { namespace llvm {
class AsmPrinter; class AsmPrinter;
@@ -59,8 +60,10 @@ namespace llvm {
struct GCPoint { struct GCPoint {
GC::PointKind Kind; //< The kind of the safe point. GC::PointKind Kind; //< The kind of the safe point.
MCSymbol *Label; //< A label. MCSymbol *Label; //< A label.
DebugLoc Loc;
GCPoint(GC::PointKind K, MCSymbol *L) : Kind(K), Label(L) {} GCPoint(GC::PointKind K, MCSymbol *L, DebugLoc DL)
: Kind(K), Label(L), Loc(DL) {}
}; };
/// GCRoot - Metadata for a pointer to an object managed by the garbage /// GCRoot - Metadata for a pointer to an object managed by the garbage
@@ -121,8 +124,8 @@ namespace llvm {
/// 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).
void addSafePoint(GC::PointKind Kind, MCSymbol *Label) { void addSafePoint(GC::PointKind Kind, MCSymbol *Label, DebugLoc DL) {
SafePoints.push_back(GCPoint(Kind, Label)); SafePoints.push_back(GCPoint(Kind, Label, DL));
} }
/// getFrameSize/setFrameSize - Records the function's frame size. /// getFrameSize/setFrameSize - Records the function's frame size.

View File

@@ -345,13 +345,15 @@ void MachineCodeAnalysis::VisitCallPoint(MachineBasicBlock::iterator CI) {
MachineBasicBlock::iterator RAI = CI; MachineBasicBlock::iterator RAI = CI;
++RAI; ++RAI;
if (FI->getStrategy().needsSafePoint(GC::PreCall)) if (FI->getStrategy().needsSafePoint(GC::PreCall)) {
FI->addSafePoint(GC::PreCall, InsertLabel(*CI->getParent(), CI, MCSymbol* Label = InsertLabel(*CI->getParent(), CI, CI->getDebugLoc());
CI->getDebugLoc())); FI->addSafePoint(GC::PreCall, Label, CI->getDebugLoc());
}
if (FI->getStrategy().needsSafePoint(GC::PostCall)) if (FI->getStrategy().needsSafePoint(GC::PostCall)) {
FI->addSafePoint(GC::PostCall, InsertLabel(*CI->getParent(), RAI, MCSymbol* Label = InsertLabel(*CI->getParent(), RAI, CI->getDebugLoc());
CI->getDebugLoc())); FI->addSafePoint(GC::PostCall, Label, CI->getDebugLoc());
}
} }
void MachineCodeAnalysis::FindSafePoints(MachineFunction &MF) { void MachineCodeAnalysis::FindSafePoints(MachineFunction &MF) {