xo-jit: + llvm module instrumentation methods

This commit is contained in:
Roland Conybeare 2024-06-15 15:12:52 -04:00
commit 3b5193c28d
3 changed files with 34 additions and 0 deletions

View file

@ -75,6 +75,17 @@ namespace xo {
static llvm::Expected<std::unique_ptr<Jit>> make_aux();
static xo::ref::rp<Jit> make();
// ----- module access -----
/** target triple = string describing target host for codegen **/
const std::string & target_triple() const;
/** append function names defined in attached module to *p_v **/
std::vector<std::string> get_function_name_v();
/** write state of execution session (all the associated dynamic libraries) **/
void dump_execution_session();
// ----- jit code generation -----
llvm::Value * codegen_constant(ref::brw<xo::ast::ConstantInterface> expr);
llvm::Function * codegen_primitive(ref::brw<xo::ast::PrimitiveInterface> expr);

View file

@ -50,6 +50,7 @@ namespace xo {
using SelfExecutorProcessControl = llvm::orc::SelfExecutorProcessControl;
private:
/* execution session - represents a currenlty-running jit program */
std::unique_ptr<ExecutionSession> ES;
DataLayout DL;
@ -118,6 +119,11 @@ namespace xo {
llvm::Expected<ExecutorSymbolDef> lookup(StringRef Name) {
return ES->lookup({&MainJD}, Mangle(Name.str()));
}
/* dump */
void dump_execution_session() {
ES->dump(llvm::errs());
}
};
} // end namespace jit