LLVM: include/llvm/ExecutionEngine/Orc/LinkGraphLinkingLayer.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13#ifndef LLVM_EXECUTIONENGINE_ORC_LINKGRAPHLINKINGLAYER_H

14#define LLVM_EXECUTIONENGINE_ORC_LINKGRAPHLINKINGLAYER_H

15

24#include

25#include

26#include

27#include

28#include

29#include

30#include

31

32namespace llvm {

33

35class EHFrameRegistrar;

36}

37

38namespace orc {

39

40

41

42

43

47

48public:

49

50

51

53 public:

58

59

60

65

73 };

74

75

76

78

79

82

83

84

85

86

88 std::unique_ptrjitlink::JITLinkMemoryManager MemMgr);

89

90

92

93

95 std::lock_guardstd::mutex Lock(LayerMutex);

96 Plugins.push_back(std::move(P));

97 return *this;

98 }

99

100

101

102

103

105 std::lock_guardstd::mutex Lock(LayerMutex);

106 auto I = llvm::find_if(Plugins, [&](const std::shared_ptr &Elem) {

107 return Elem.get() == &P;

108 });

109 assert(I != Plugins.end() && "Plugin not present");

110 Plugins.erase(I);

111 }

112

113

114 void emit(std::unique_ptr R,

115 std::unique_ptrjitlink::LinkGraph G) override;

116

117

118

119

120

121

122

123

124

127 this->OverrideObjectFlags = OverrideObjectFlags;

128 return *this;

129 }

130

131

132

133

134

135

136

137

138

139

140

141

144 this->AutoClaimObjectSymbols = AutoClaimObjectSymbols;

145 return *this;

146 }

147

148protected:

149

150

151

152 void emit(std::unique_ptr R,

153 std::unique_ptrjitlink::LinkGraph G,

154 std::unique_ptr ObjBuf);

155

157

158private:

160

162 FinalizedAlloc FA);

163

167

168 mutable std::mutex LayerMutex;

170 std::unique_ptrjitlink::JITLinkMemoryManager MemMgrOwnership;

171 bool OverrideObjectFlags = false;

172 bool AutoClaimObjectSymbols = false;

174 std::vector<std::shared_ptr> Plugins;

175};

176

177}

178}

179

180#endif

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

Lightweight error class with error context and mandatory checking.

static ErrorSuccess success()

Create a success value.

Holds context for a single jitLink invocation.

Represents a finalized allocation.

Manages allocations of JIT memory.

An ExecutionSession represents a running JIT program.

Represents a JIT'd dynamic library.

LinkGraphLayer(ExecutionSession &ES)

Plugin instances can be added to the ObjectLinkingLayer to receive callbacks when code is loaded or e...

Definition LinkGraphLinkingLayer.h:52

virtual Error notifyEmitted(MaterializationResponsibility &MR)

Definition LinkGraphLinkingLayer.h:66

virtual Error notifyRemovingResources(JITDylib &JD, ResourceKey K)=0

virtual Error notifyFailed(MaterializationResponsibility &MR)=0

virtual void notifyMaterializing(MaterializationResponsibility &MR, jitlink::LinkGraph &G, jitlink::JITLinkContext &Ctx, MemoryBufferRef InputObject)

Definition LinkGraphLinkingLayer.h:61

virtual void modifyPassConfig(MaterializationResponsibility &MR, jitlink::LinkGraph &G, jitlink::PassConfiguration &Config)

Definition LinkGraphLinkingLayer.h:55

virtual void notifyTransferringResources(JITDylib &JD, ResourceKey DstKey, ResourceKey SrcKey)=0

LinkGraphLinkingLayer links LinkGraphs into the Executor using JITLink.

Definition LinkGraphLinkingLayer.h:45

LinkGraphLinkingLayer(ExecutionSession &ES, std::unique_ptr< jitlink::JITLinkMemoryManager > MemMgr)

Construct an LinkGraphLinkingLayer.

LinkGraphLinkingLayer & setAutoClaimResponsibilityForObjectSymbols(bool AutoClaimObjectSymbols)

If set, this LinkGraphLinkingLayer instance will claim responsibility for any symbols provided by a g...

Definition LinkGraphLinkingLayer.h:143

void removePlugin(Plugin &P)

Remove a plugin.

Definition LinkGraphLinkingLayer.h:104

void emit(std::unique_ptr< MaterializationResponsibility > R, std::unique_ptr< jitlink::LinkGraph > G) override

Emit a LinkGraph.

LinkGraphLinkingLayer & setOverrideObjectFlagsWithResponsibilityFlags(bool OverrideObjectFlags)

Instructs this LinkgraphLinkingLayer instance to override the symbol flags found in the LinkGraph wit...

Definition LinkGraphLinkingLayer.h:126

std::function< void(std::unique_ptr< MemoryBuffer >)> ReturnObjectBuffer

Definition LinkGraphLinkingLayer.h:156

void emit(std::unique_ptr< MaterializationResponsibility > R, std::unique_ptr< jitlink::LinkGraph > G, std::unique_ptr< MemoryBuffer > ObjBuf)

Emit a LinkGraph with the given backing buffer.

LinkGraphLinkingLayer(ExecutionSession &ES)

Construct a LinkGraphLinkingLayer using the ExecutorProcessControl instance's memory manager.

LinkGraphLinkingLayer & addPlugin(std::shared_ptr< Plugin > P)

Add a plugin.

Definition LinkGraphLinkingLayer.h:94

Tracks responsibility for materialization, and mediates interactions between MaterializationUnits and...

Listens for ResourceTracker operations.

This is an optimization pass for GlobalISel generic memory operations.

auto find_if(R &&Range, UnaryPredicate P)

Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.

An LinkGraph pass configuration, consisting of a list of pre-prune, post-prune, and post-fixup passes...