summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@google.com>2009-10-27 00:03:05 +0000
committerJeffrey Yasskin <jyasskin@google.com>2009-10-27 00:03:05 +0000
commit7a9034c4db248fe8b8cb82762881b51b221988d3 (patch)
tree730343fa9578d5b2ea0637b4cf330070aab8c0f7 /include
parentf2becca90b832cc02345fba063b9b439b2be33ad (diff)
downloadllvm-7a9034c4db248fe8b8cb82762881b51b221988d3.tar.gz
llvm-7a9034c4db248fe8b8cb82762881b51b221988d3.tar.bz2
llvm-7a9034c4db248fe8b8cb82762881b51b221988d3.tar.xz
Automatically do the equivalent of freeMachineCodeForFunction(F) when F is
being destroyed. This allows users to run global optimizations like globaldce even after some functions have been jitted. This patch also removes the Function* parameter to JITEventListener::NotifyFreeingMachineCode() since it can cause that to be called when the Function is partially destroyed. This change will be even more helpful later when I think we'll want to allow machine code to actually outlive its Function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85182 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/ExecutionEngine/ExecutionEngine.h5
-rw-r--r--include/llvm/ExecutionEngine/JITEventListener.h7
2 files changed, 7 insertions, 5 deletions
diff --git a/include/llvm/ExecutionEngine/ExecutionEngine.h b/include/llvm/ExecutionEngine/ExecutionEngine.h
index 92f552de0e..b5b664d5eb 100644
--- a/include/llvm/ExecutionEngine/ExecutionEngine.h
+++ b/include/llvm/ExecutionEngine/ExecutionEngine.h
@@ -263,9 +263,8 @@ public:
/// getPointerToFunction - The different EE's represent function bodies in
/// different ways. They should each implement this to say what a function
/// pointer should look like. When F is destroyed, the ExecutionEngine will
- /// remove its global mapping but will not yet free its machine code. Call
- /// freeMachineCodeForFunction(F) explicitly to do that. Note that global
- /// optimizations can destroy Functions without notifying the ExecutionEngine.
+ /// remove its global mapping and free any machine code. Be sure no threads
+ /// are running inside F when that happens.
///
virtual void *getPointerToFunction(Function *F) = 0;
diff --git a/include/llvm/ExecutionEngine/JITEventListener.h b/include/llvm/ExecutionEngine/JITEventListener.h
index 3623bf03e4..dcc66b2a08 100644
--- a/include/llvm/ExecutionEngine/JITEventListener.h
+++ b/include/llvm/ExecutionEngine/JITEventListener.h
@@ -63,8 +63,11 @@ public:
/// NotifyFreeingMachineCode - This is called inside of
/// freeMachineCodeForFunction(), after the global mapping is removed, but
/// before the machine code is returned to the allocator. OldPtr is the
- /// address of the machine code.
- virtual void NotifyFreeingMachineCode(const Function &F, void *OldPtr) {}
+ /// address of the machine code and will be the same as the Code parameter to
+ /// a previous NotifyFunctionEmitted call. The Function passed to
+ /// NotifyFunctionEmitted may have been destroyed by the time of the matching
+ /// NotifyFreeingMachineCode call.
+ virtual void NotifyFreeingMachineCode(void *OldPtr) {}
};
// This returns NULL if support isn't available.