Commit d1fbcb21 by Antonio Maiorano

LLVM: store input name in JITRoutine

This will be used in a future change to generate useful file names for JIT routine asm listings. Bug: b/174358505 Change-Id: I46b6f2a6993a15f57cd54aad5a83765e4e559e42 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/50789 Kokoro-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarAntonio Maiorano <amaiorano@google.com>
parent 9ff8066d
......@@ -621,6 +621,7 @@ auto &Unwrap(T &&v)
// settings and no Reactor routine directly links against another.
class JITRoutine : public rr::Routine
{
std::string name;
llvm::orc::ExecutionSession session;
llvm::orc::RTDyldObjectLinkingLayer objectLayer;
llvm::orc::IRCompileLayer compileLayer;
......@@ -632,10 +633,12 @@ class JITRoutine : public rr::Routine
public:
JITRoutine(
std::unique_ptr<llvm::Module> module,
const char *name,
llvm::Function **funcs,
size_t count,
const rr::Config &config)
: objectLayer(session, []() {
: name(name)
, objectLayer(session, []() {
static MemoryMapper memoryMapper;
return std::make_unique<llvm::SectionMemoryManager>(&memoryMapper);
})
......@@ -771,10 +774,10 @@ void JITBuilder::optimize(const rr::Config &cfg)
passManager.run(*module);
}
std::shared_ptr<rr::Routine> JITBuilder::acquireRoutine(llvm::Function **funcs, size_t count, const rr::Config &cfg)
std::shared_ptr<rr::Routine> JITBuilder::acquireRoutine(const char *name, llvm::Function **funcs, size_t count, const rr::Config &cfg)
{
ASSERT(module);
return std::make_shared<JITRoutine>(std::move(module), funcs, count, cfg);
return std::make_shared<JITRoutine>(std::move(module), name, funcs, count, cfg);
}
} // namespace rr
......@@ -595,7 +595,7 @@ std::shared_ptr<Routine> Nucleus::acquireRoutine(const char *name, const Config:
jit->module->print(file, 0);
}
routine = jit->acquireRoutine(&jit->function, 1, cfg);
routine = jit->acquireRoutine(name, &jit->function, 1, cfg);
};
#ifdef JIT_IN_SEPARATE_THREAD
......@@ -4227,7 +4227,7 @@ std::shared_ptr<Routine> Nucleus::acquireCoroutine(const char *name, const Confi
funcs[Nucleus::CoroutineEntryAwait] = jit->coroutine.await;
funcs[Nucleus::CoroutineEntryDestroy] = jit->coroutine.destroy;
auto routine = jit->acquireRoutine(funcs, Nucleus::CoroutineEntryCount, cfg);
auto routine = jit->acquireRoutine(name, funcs, Nucleus::CoroutineEntryCount, cfg);
delete jit;
jit = nullptr;
......
......@@ -92,7 +92,7 @@ public:
void optimize(const rr::Config &cfg);
std::shared_ptr<rr::Routine> acquireRoutine(llvm::Function **funcs, size_t count, const rr::Config &cfg);
std::shared_ptr<rr::Routine> acquireRoutine(const char *name, llvm::Function **funcs, size_t count, const rr::Config &cfg);
const Config config;
llvm::LLVMContext context;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment