LLVM
17.0.0git
include
llvm
ExecutionEngine
Orc
DebugObjectManagerPlugin.h
Go to the documentation of this file.
1
//===---- DebugObjectManagerPlugin.h - JITLink debug objects ---*- 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
// ObjectLinkingLayer plugin for emitting debug objects.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_EXECUTIONENGINE_ORC_DEBUGOBJECTMANAGERPLUGIN_H
14
#define LLVM_EXECUTIONENGINE_ORC_DEBUGOBJECTMANAGERPLUGIN_H
15
16
#include "
llvm/ADT/Triple.h
"
17
#include "
llvm/ExecutionEngine/JITLink/JITLink.h
"
18
#include "
llvm/ExecutionEngine/Orc/Core.h
"
19
#include "
llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h
"
20
#include "
llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h
"
21
#include "
llvm/Support/Error.h
"
22
#include "
llvm/Support/Memory.h
"
23
#include "
llvm/Support/MemoryBufferRef.h
"
24
25
#include <functional>
26
#include <map>
27
#include <memory>
28
#include <mutex>
29
30
namespace
llvm
{
31
namespace
orc {
32
33
class
DebugObject;
34
35
/// Creates and manages DebugObjects for JITLink artifacts.
36
///
37
/// DebugObjects are created when linking for a MaterializationResponsibility
38
/// starts. They are pending as long as materialization is in progress.
39
///
40
/// There can only be one pending DebugObject per MaterializationResponsibility.
41
/// If materialization fails, pending DebugObjects are discarded.
42
///
43
/// Once executable code for the MaterializationResponsibility is emitted, the
44
/// corresponding DebugObject is finalized to target memory and the provided
45
/// DebugObjectRegistrar is notified. Ownership of DebugObjects remains with the
46
/// plugin.
47
///
48
class
DebugObjectManagerPlugin
:
public
ObjectLinkingLayer::Plugin
{
49
public
:
50
DebugObjectManagerPlugin
(
ExecutionSession
&ES,
51
std::unique_ptr<DebugObjectRegistrar>
Target
);
52
~DebugObjectManagerPlugin
();
53
54
void
notifyMaterializing
(
MaterializationResponsibility
&MR,
55
jitlink::LinkGraph
&
G
,
jitlink::JITLinkContext
&Ctx,
56
MemoryBufferRef
InputObject)
override
;
57
58
Error
notifyEmitted
(
MaterializationResponsibility
&MR)
override
;
59
Error
notifyFailed
(
MaterializationResponsibility
&MR)
override
;
60
Error
notifyRemovingResources
(
JITDylib
&JD,
ResourceKey
K)
override
;
61
62
void
notifyTransferringResources
(
JITDylib
&JD,
ResourceKey
DstKey,
63
ResourceKey
SrcKey)
override
;
64
65
void
modifyPassConfig
(
MaterializationResponsibility
&MR,
66
jitlink::LinkGraph
&LG,
67
jitlink::PassConfiguration
&PassConfig)
override
;
68
69
private
:
70
ExecutionSession
&ES;
71
72
using
OwnedDebugObject = std::unique_ptr<DebugObject>;
73
std::map<MaterializationResponsibility *, OwnedDebugObject> PendingObjs;
74
std::map<ResourceKey, std::vector<OwnedDebugObject>> RegisteredObjs;
75
76
std::mutex PendingObjsLock;
77
std::mutex RegisteredObjsLock;
78
79
std::unique_ptr<DebugObjectRegistrar>
Target
;
80
};
81
82
}
// namespace orc
83
}
// namespace llvm
84
85
#endif // LLVM_EXECUTIONENGINE_ORC_DEBUGOBJECTMANAGERPLUGIN_H
llvm::orc::ResourceKey
uintptr_t ResourceKey
Definition:
Core.h:50
llvm::orc::MaterializationResponsibility
Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...
Definition:
Core.h:524
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:
AddressRanges.h:18
llvm::orc::JITDylib
Represents a JIT'd dynamic library.
Definition:
Core.h:961
llvm::orc::DebugObjectManagerPlugin::~DebugObjectManagerPlugin
~DebugObjectManagerPlugin()
llvm::Target
Target - Wrapper for Target specific information.
Definition:
TargetRegistry.h:149
JITLink.h
Error.h
MemoryBufferRef.h
llvm::orc::DebugObjectManagerPlugin::notifyFailed
Error notifyFailed(MaterializationResponsibility &MR) override
Definition:
DebugObjectManagerPlugin.cpp:488
llvm::MemoryBufferRef
Definition:
MemoryBufferRef.h:22
EPCDebugObjectRegistrar.h
G
const DataFlowGraph & G
Definition:
RDFGraph.cpp:200
llvm::jitlink::LinkGraph
Definition:
JITLink.h:822
llvm::orc::DebugObjectManagerPlugin::notifyTransferringResources
void notifyTransferringResources(JITDylib &JD, ResourceKey DstKey, ResourceKey SrcKey) override
Definition:
DebugObjectManagerPlugin.cpp:495
llvm::orc::DebugObjectManagerPlugin::notifyEmitted
Error notifyEmitted(MaterializationResponsibility &MR) override
Definition:
DebugObjectManagerPlugin.cpp:449
llvm::orc::DebugObjectManagerPlugin::DebugObjectManagerPlugin
DebugObjectManagerPlugin(ExecutionSession &ES, std::unique_ptr< DebugObjectRegistrar > Target)
Definition:
DebugObjectManagerPlugin.cpp:405
llvm::orc::DebugObjectManagerPlugin
Creates and manages DebugObjects for JITLink artifacts.
Definition:
DebugObjectManagerPlugin.h:48
llvm::jitlink::PassConfiguration
An LinkGraph pass configuration, consisting of a list of pre-prune, post-prune, and post-fixup passes...
Definition:
JITLink.h:1602
Triple.h
llvm::orc::DebugObjectManagerPlugin::notifyRemovingResources
Error notifyRemovingResources(JITDylib &JD, ResourceKey K) override
Definition:
DebugObjectManagerPlugin.cpp:511
Memory.h
llvm::jitlink::JITLinkContext
Holds context for a single jitLink invocation.
Definition:
JITLink.h:1696
llvm::orc::DebugObjectManagerPlugin::notifyMaterializing
void notifyMaterializing(MaterializationResponsibility &MR, jitlink::LinkGraph &G, jitlink::JITLinkContext &Ctx, MemoryBufferRef InputObject) override
Definition:
DebugObjectManagerPlugin.cpp:411
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition:
Error.h:156
llvm::orc::ExecutionSession
An ExecutionSession represents a running JIT program.
Definition:
Core.h:1373
llvm::orc::DebugObjectManagerPlugin::modifyPassConfig
void modifyPassConfig(MaterializationResponsibility &MR, jitlink::LinkGraph &LG, jitlink::PassConfiguration &PassConfig) override
Definition:
DebugObjectManagerPlugin.cpp:428
Core.h
llvm::orc::ObjectLinkingLayer::Plugin
Plugin instances can be added to the ObjectLinkingLayer to receive callbacks when code is loaded or e...
Definition:
ObjectLinkingLayer.h:60
ObjectLinkingLayer.h
Generated on Sat Jan 28 2023 08:47:15 for LLVM by
1.8.17