Proteus
Programmable JIT compilation and optimization for C/C++ using LLVM
Loading...
Searching...
No Matches
CompiledLibrary.h
Go to the documentation of this file.
1#ifndef PROTEUS_COMPILED_LIBRARY_H
2#define PROTEUS_COMPILED_LIBRARY_H
3
4#include <memory>
5#include <string>
6#include <unordered_map>
7
8namespace llvm {
9class MemoryBuffer;
10namespace orc {
11class JITDylib;
12} // namespace orc
13} // namespace llvm
14
15namespace proteus {
16
17using namespace llvm;
18
19struct GlobalVarInfo;
20
22 // Compiled library holds a relocatable object or a dynamic library, indicated
23 // by IsDynLib.
24 std::unique_ptr<MemoryBuffer> ObjectModule;
25 std::string DynLibPath;
27 bool IsLoaded = false;
28 // JitDyLib holds a pointer to the ORC JIT dynamic library context for the
29 // host JIT engine.
30 llvm::orc::JITDylib *JitDyLib = nullptr;
31 // The caller owns this information, which relinks a loaded device object.
32 const std::unordered_map<std::string, GlobalVarInfo> *VarNameToGlobalInfo =
33 nullptr;
34 bool RelinkGlobalsByCopy = false;
35 // Proteus sets this once it patches the object with global addresses.
36 bool GlobalsRelinked = false;
37
38 CompiledLibrary(std::unique_ptr<MemoryBuffer> ObjectModule);
39
40 CompiledLibrary(const std::string &Path);
41
43
44 bool isSharedObject() const { return IsDynLib; }
45
46 bool isStaticObject() const { return !IsDynLib; }
47};
48
49} // namespace proteus
50
51#endif
Definition CompiledLibrary.h:8
Definition MemoryCache.h:27
Definition CompiledLibrary.h:21
std::unique_ptr< MemoryBuffer > ObjectModule
Definition CompiledLibrary.h:24
bool isStaticObject() const
Definition CompiledLibrary.h:46
bool isSharedObject() const
Definition CompiledLibrary.h:44
bool IsDynLib
Definition CompiledLibrary.h:26
llvm::orc::JITDylib * JitDyLib
Definition CompiledLibrary.h:30
bool RelinkGlobalsByCopy
Definition CompiledLibrary.h:34
const std::unordered_map< std::string, GlobalVarInfo > * VarNameToGlobalInfo
Definition CompiledLibrary.h:32
std::string DynLibPath
Definition CompiledLibrary.h:25
bool IsLoaded
Definition CompiledLibrary.h:27
bool GlobalsRelinked
Definition CompiledLibrary.h:36
Definition GlobalVarInfo.h:5