Mneme
Mneme a tool allowing recording the execution of a GPU (CUDA/HIP) kernel and replaying that kernel as an independent executable.
Loading...
Searching...
No Matches
MnemeJITProteus.hpp
Go to the documentation of this file.
1#include <proteus/impl/CoreLLVM.h>
2#include <proteus/impl/CoreLLVMDevice.h>
3
4#include <llvm/Support/InitLLVM.h>
5#ifdef MNEME_ENABLE_HIP
6#include <proteus/impl/CoreLLVMHIP.h>
7#elif defined(MNEME_ENABLE_CUDA)
8#else
9#error "Please define MNEME_ENABLE_HIP or MNEME_ENABLE_CUDA"
10#endif
11
12namespace mneme {
13
14void pruneMnemeGlobals(llvm::Module &M) {
15 using namespace llvm;
16 SmallVector<GlobalVariable *> GlobalsToErase;
17 for (auto &GV : M.globals()) {
18 auto Name = GV.getName();
19 if (Name.starts_with("_mneme_bitcode")) {
20 GlobalsToErase.push_back(&GV);
21 removeFromUsedLists(M, [&GV](Constant *C) {
22 if (auto *Global = dyn_cast<GlobalVariable>(C))
23 return Global == &GV;
24 return false;
25 });
26 }
27 }
28 for (auto GV : GlobalsToErase) {
29 M.eraseGlobalVariable(GV);
30 }
31}
32} // namespace mneme
Definition attribute.cpp:39
Definition MnemeAnnotation.cpp:3
void pruneMnemeGlobals(llvm::Module &M)
Definition MnemeJITProteus.hpp:14