aboutsummaryrefslogtreecommitdiffstats
path: root/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
commitf8d5534ce95fbffa60c30da5748ac2db2c757077 (patch)
treed0a7b2a265916b1e0e36ef6423b56749d3429c9a /lib/ExecutionEngine/JIT/JIT.h
parent10e82e3ff5f86e6c5a3a4ffc94b0104a28ea2cbc (diff)
downloadexternal_llvm-f8d5534ce95fbffa60c30da5748ac2db2c757077.zip
external_llvm-f8d5534ce95fbffa60c30da5748ac2db2c757077.tar.gz
external_llvm-f8d5534ce95fbffa60c30da5748ac2db2c757077.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74157 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/JIT/JIT.h')
-rw-r--r--lib/ExecutionEngine/JIT/JIT.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/ExecutionEngine/JIT/JIT.h b/lib/ExecutionEngine/JIT/JIT.h
index 3ccb2dd..66417a7 100644
--- a/lib/ExecutionEngine/JIT/JIT.h
+++ b/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();