aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@google.com>2010-01-22 23:04:39 +0000
committerJeffrey Yasskin <jyasskin@google.com>2010-01-22 23:04:39 +0000
commitbf1f76b4932e167e214a3369fd28694432aed98d (patch)
treeb4494ac95e433888fcadf7dae49fa6cc5b3e4777
parentbb9078a6b26f38594cde6fd0dcd17eca25ef0319 (diff)
Make OProfile support compile again after r93630 removed
DebugLocTuple. Also use an AssertingVH to ensure that MDNodes aren't destroyed while the FilenameCache is using them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94245 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp b/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp
index d01c4b2db5..2baf97911d 100644
--- a/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp
+++ b/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp
@@ -18,10 +18,12 @@
#define DEBUG_TYPE "oprofile-jit-event-listener"
#include "llvm/Function.h"
+#include "llvm/Metadata.h"
#include "llvm/Analysis/DebugInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/ExecutionEngine/JITEventListener.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Support/ValueHandle.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Errno.h"
#include "llvm/Config/config.h"
@@ -70,15 +72,15 @@ OProfileJITEventListener::~OProfileJITEventListener() {
class FilenameCache {
// Holds the filename of each Scope, so that we can pass a null-terminated
- // string into oprofile.
- DenseMap<MDNode*, std::string> Filenames;
+ // string into oprofile. Use an AssertingVH rather than a ValueMap because we
+ // shouldn't be modifying any MDNodes while this map is alive.
+ DenseMap<AssertingVH<MDNode>, std::string> Filenames;
public:
- const char *getFilename(MDNode *Scope) {
- std::string &Filename = Filenames[Scope];
+ const char *getFilename(DIScope Scope) {
+ std::string &Filename = Filenames[Scope.getNode()];
if (Filename.empty()) {
- DIScope S(Scope);
- Filename = S.getFilename();
+ Filename = Scope.getFilename();
}
return Filename.c_str();
}
@@ -89,9 +91,9 @@ static debug_line_info LineStartToOProfileFormat(
uintptr_t Address, DebugLoc Loc) {
debug_line_info Result;
Result.vma = Address;
- const DebugLocTuple &tuple = MF.getDebugLocTuple(Loc);
- Result.lineno = tuple.Line;
- Result.filename = Filenames.getFilename(tuple.Scope);
+ DILocation DILoc = MF.getDILocation(Loc);
+ Result.lineno = DILoc.getLineNumber();
+ Result.filename = Filenames.getFilename(DILoc.getScope());
DEBUG(dbgs() << "Mapping " << reinterpret_cast<void*>(Result.vma) << " to "
<< Result.filename << ":" << Result.lineno << "\n");
return Result;