LLVM 19.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
18#include "llvm/Config/llvm-config.h"
20#include "llvm/IR/DebugLoc.h"
22#include <cstdint>
23
24namespace llvm {
25
26class IntelJITEventsWrapper;
27class OProfileWrapper;
28
29namespace object {
30
31class 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.
41public:
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.
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 pointer 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
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
107private:
108 virtual void anchor();
109};
110
112
113} // end namespace llvm
114
115#endif // LLVM_EXECUTIONENGINE_JITEVENTLISTENER_H
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
JITEventListener - Abstract interface for use by the JIT to notify clients about significant events d...
static JITEventListener * createGDBRegistrationListener()
virtual void notifyFreeingObject(ObjectKey K)
notifyFreeingObject - Called just before the memory associated with a previously emitted object is re...
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 ...
static JITEventListener * createIntelJITEventListener()
static JITEventListener * createIntelJITEventListener(IntelJITEventsWrapper *AlternativeImpl)
static JITEventListener * createPerfJITEventListener()
static JITEventListener * createOProfileJITEventListener()
static JITEventListener * createOProfileJITEventListener(OProfileWrapper *AlternativeImpl)
virtual ~JITEventListener()=default
Information about the loaded object.
Definition: RuntimeDyld.h:69
This class is the base class for all object file types.
Definition: ObjectFile.h:229
struct LLVMOpaqueJITEventListener * LLVMJITEventListenerRef
Definition: Types.h:165
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18