summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/JIT/JIT.h
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@google.com>2009-06-25 02:04:04 +0000
committerJeffrey Yasskin <jyasskin@google.com>2009-06-25 02:04:04 +0000
commit0b08f3d7cc0bff9351442ac07f2bcb708b5a14f9 (patch)
tree997edf89b64e9648c58b38553b0813cfc695f034 /llvm/lib/ExecutionEngine/JIT/JIT.h
parent6ea7ad0351bd64260a86c5b34b1b353661527d9c (diff)
downloadbcm5719-llvm-0b08f3d7cc0bff9351442ac07f2bcb708b5a14f9.tar.gz
bcm5719-llvm-0b08f3d7cc0bff9351442ac07f2bcb708b5a14f9.zip
Add a JITEventListener interface that gets called back when a new function is
emitted or the machine code for a function is freed. Chris mentioned that we may also want a notification when a stub is emitted, but that'll be a future change. I intend to use this to tell oprofile where functions are emitted and what lines correspond to what addresses. llvm-svn: 74157
Diffstat (limited to 'llvm/lib/ExecutionEngine/JIT/JIT.h')
-rw-r--r--llvm/lib/ExecutionEngine/JIT/JIT.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/JIT.h b/llvm/lib/ExecutionEngine/JIT/JIT.h
index 3ccb2dd8126..66417a71b2c 100644
--- a/llvm/lib/ExecutionEngine/JIT/JIT.h
+++ b/llvm/lib/ExecutionEngine/JIT/JIT.h
@@ -20,10 +20,11 @@
namespace llvm {
class Function;
-class TargetMachine;
-class TargetJITInfo;
+class JITEvent_EmittedFunctionDetails;
class MachineCodeEmitter;
class MachineCodeInfo;
+class TargetJITInfo;
+class TargetMachine;
class JITState {
private:
@@ -52,6 +53,7 @@ class JIT : public ExecutionEngine {
TargetMachine &TM; // The current target we are compiling to
TargetJITInfo &TJI; // The JITInfo for the target we are compiling to
JITCodeEmitter *JCE; // JCE object
+ std::vector<JITEventListener*> EventListeners;
JITState *jitstate;
@@ -157,9 +159,18 @@ public:
// Run the JIT on F and return information about the generated code
void runJITOnFunction(Function *F, MachineCodeInfo *MCI = 0);
+ virtual void RegisterJITEventListener(JITEventListener *L);
+ virtual void UnregisterJITEventListener(JITEventListener *L);
+ /// These functions correspond to the methods on JITEventListener. They
+ /// iterate over the registered listeners and call the corresponding method on
+ /// each.
+ void NotifyFunctionEmitted(
+ const Function &F, void *Code, size_t Size,
+ const JITEvent_EmittedFunctionDetails &Details);
+ void NotifyFreeingMachineCode(const Function &F, void *OldPtr);
+
private:
static JITCodeEmitter *createEmitter(JIT &J, JITMemoryManager *JMM);
- void registerMachineCodeInfo(MachineCodeInfo *MCI);
void runJITOnFunctionUnlocked(Function *F, const MutexGuard &locked);
void updateFunctionStub(Function *F);
void updateDlsymStubTable();
OpenPOWER on IntegriCloud