xo-jit: + llvm module instrumentation methods
This commit is contained in:
parent
e8a2297ac0
commit
3b5193c28d
3 changed files with 34 additions and 0 deletions
|
|
@ -75,6 +75,17 @@ namespace xo {
|
||||||
static llvm::Expected<std::unique_ptr<Jit>> make_aux();
|
static llvm::Expected<std::unique_ptr<Jit>> make_aux();
|
||||||
static xo::ref::rp<Jit> make();
|
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::Value * codegen_constant(ref::brw<xo::ast::ConstantInterface> expr);
|
||||||
llvm::Function * codegen_primitive(ref::brw<xo::ast::PrimitiveInterface> expr);
|
llvm::Function * codegen_primitive(ref::brw<xo::ast::PrimitiveInterface> expr);
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ namespace xo {
|
||||||
using SelfExecutorProcessControl = llvm::orc::SelfExecutorProcessControl;
|
using SelfExecutorProcessControl = llvm::orc::SelfExecutorProcessControl;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/* execution session - represents a currenlty-running jit program */
|
||||||
std::unique_ptr<ExecutionSession> ES;
|
std::unique_ptr<ExecutionSession> ES;
|
||||||
|
|
||||||
DataLayout DL;
|
DataLayout DL;
|
||||||
|
|
@ -118,6 +119,11 @@ namespace xo {
|
||||||
llvm::Expected<ExecutorSymbolDef> lookup(StringRef Name) {
|
llvm::Expected<ExecutorSymbolDef> lookup(StringRef Name) {
|
||||||
return ES->lookup({&MainJD}, Mangle(Name.str()));
|
return ES->lookup({&MainJD}, Mangle(Name.str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* dump */
|
||||||
|
void dump_execution_session() {
|
||||||
|
ES->dump(llvm::errs());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace jit
|
} // end namespace jit
|
||||||
|
|
|
||||||
|
|
@ -127,6 +127,23 @@ namespace xo {
|
||||||
jit_object_layer_.setAutoClaimResponsibilityForObjectSymbols(true);
|
jit_object_layer_.setAutoClaimResponsibilityForObjectSymbols(true);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
const std::string &
|
||||||
|
Jit::target_triple() const {
|
||||||
|
return llvm_module_->getTargetTriple();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string>
|
||||||
|
Jit::get_function_name_v() {
|
||||||
|
std::vector<std::string> retval;
|
||||||
|
for (const auto & fn_name : *llvm_module_)
|
||||||
|
retval.push_back(fn_name.getName().str());
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
} /*get_function_names*/
|
||||||
|
|
||||||
|
void
|
||||||
|
Jit::dump_execution_session() {
|
||||||
|
kal_jit_->dump_execution_session();
|
||||||
}
|
}
|
||||||
|
|
||||||
llvm::Value *
|
llvm::Value *
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue