LLVM  14.0.0git
JITEventListener.h
Go to the documentation of this file.
1 //===- JITEventListener.h - Exposes events from JIT compilation -*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines the JITEventListener interface, which lets users get
10 // callbacks when significant events happen during the JIT compilation process.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_EXECUTIONENGINE_JITEVENTLISTENER_H
15 #define LLVM_EXECUTIONENGINE_JITEVENTLISTENER_H
16 
17 #include "llvm-c/ExecutionEngine.h"
18 #include "llvm/Config/llvm-config.h"
20 #include "llvm/IR/DebugLoc.h"
22 #include <cstdint>
23 
24 namespace llvm {
25 
26 class IntelJITEventsWrapper;
27 class OProfileWrapper;
28 
29 namespace object {
30 
31 class ObjectFile;
32 
33 } // end namespace object
34 
35 /// JITEventListener - Abstract interface for use by the JIT to notify clients
36 /// about significant events during compilation. For example, to notify
37 /// profilers and debuggers that need to know where functions have been emitted.
38 ///
39 /// The default implementation of each method does nothing.
41 public:
43 
44  JITEventListener() = default;
45  virtual ~JITEventListener() = default;
46 
47  /// notifyObjectLoaded - Called after an object has had its sections allocated
48  /// and addresses assigned to all symbols. Note: Section memory will not have
49  /// been relocated yet. notifyFunctionLoaded will not be called for
50  /// individual functions in the object.
51  ///
52  /// ELF-specific information
53  /// The ObjectImage contains the generated object image
54  /// with section headers updated to reflect the address at which sections
55  /// were loaded and with relocations performed in-place on debug sections.
56  virtual void notifyObjectLoaded(ObjectKey K, const object::ObjectFile &Obj,
58 
59  /// notifyFreeingObject - Called just before the memory associated with
60  /// a previously emitted object is released.
61  virtual void notifyFreeingObject(ObjectKey K) {}
62 
63  // Get a pointe to the GDB debugger registration listener.
65 
66 #if LLVM_USE_INTEL_JITEVENTS
67  // Construct an IntelJITEventListener
69 
70  // Construct an IntelJITEventListener with a test Intel JIT API implementation
72  IntelJITEventsWrapper* AlternativeImpl);
73 #else
74  static JITEventListener *createIntelJITEventListener() { return nullptr; }
75 
77  IntelJITEventsWrapper* AlternativeImpl) {
78  return nullptr;
79  }
80 #endif // USE_INTEL_JITEVENTS
81 
82 #if LLVM_USE_OPROFILE
83  // Construct an OProfileJITEventListener
85 
86  // Construct an OProfileJITEventListener with a test opagent implementation
88  OProfileWrapper* AlternativeImpl);
89 #else
90  static JITEventListener *createOProfileJITEventListener() { return nullptr; }
91 
93  OProfileWrapper* AlternativeImpl) {
94  return nullptr;
95  }
96 #endif // USE_OPROFILE
97 
98 #if LLVM_USE_PERF
100 #else
102  {
103  return nullptr;
104  }
105 #endif // USE_PERF
106 
107 private:
108  virtual void anchor();
109 };
110 
112 
113 } // end namespace llvm
114 
115 #endif // LLVM_EXECUTIONENGINE_JITEVENTLISTENER_H
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:22
llvm::JITEventListener::notifyObjectLoaded
virtual void notifyObjectLoaded(ObjectKey K, const object::ObjectFile &Obj, const RuntimeDyld::LoadedObjectInfo &L)
notifyObjectLoaded - Called after an object has had its sections allocated and addresses assigned to ...
Definition: JITEventListener.h:56
CBindingWrapping.h
RuntimeDyld.h
llvm::JITEventListener::createOProfileJITEventListener
static JITEventListener * createOProfileJITEventListener(OProfileWrapper *AlternativeImpl)
Definition: JITEventListener.h:92
DEFINE_SIMPLE_CONVERSION_FUNCTIONS
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
Definition: CBindingWrapping.h:19
llvm::JITEventListener::createIntelJITEventListener
static JITEventListener * createIntelJITEventListener(IntelJITEventsWrapper *AlternativeImpl)
Definition: JITEventListener.h:76
DebugLoc.h
object
bar al al movzbl eax ret Missed when stored in a memory object
Definition: README.txt:1411
uint64_t
llvm::codeview::CodeViewContainer::ObjectFile
@ ObjectFile
llvm::JITEventListener
JITEventListener - Abstract interface for use by the JIT to notify clients about significant events d...
Definition: JITEventListener.h:40
llvm::object::ObjectFile
This class is the base class for all object file types.
Definition: ObjectFile.h:227
llvm::OProfileWrapper
Definition: OProfileWrapper.h:28
llvm::JITEventListener::createOProfileJITEventListener
static JITEventListener * createOProfileJITEventListener()
Definition: JITEventListener.h:90
llvm::RuntimeDyld::LoadedObjectInfo
Information about the loaded object.
Definition: RuntimeDyld.h:69
llvm::JITEventListener::createIntelJITEventListener
static JITEventListener * createIntelJITEventListener()
Definition: JITEventListener.h:74
llvm::JITEventListener::createPerfJITEventListener
static JITEventListener * createPerfJITEventListener()
Definition: JITEventListener.h:101
ExecutionEngine.h
llvm::JITEventListener::~JITEventListener
virtual ~JITEventListener()=default
llvm::JITEventListener::notifyFreeingObject
virtual void notifyFreeingObject(ObjectKey K)
notifyFreeingObject - Called just before the memory associated with a previously emitted object is re...
Definition: JITEventListener.h:61
llvm::JITEventListener::JITEventListener
JITEventListener()=default
llvm::JITEventListener::createGDBRegistrationListener
static JITEventListener * createGDBRegistrationListener()
Definition: GDBRegistrationListener.cpp:236
LLVMJITEventListenerRef
struct LLVMOpaqueJITEventListener * LLVMJITEventListenerRef
Definition: Types.h:163
llvm::IntelJITEventsWrapper
Definition: IntelJITEventsWrapper.h:31