xo-jit: tidy: drop never-compiled obsolete code

This commit is contained in:
Roland Conybeare 2024-06-16 11:27:03 -04:00
commit c16686fd4c
3 changed files with 6 additions and 81 deletions

View file

@ -18,22 +18,6 @@
#include "xo/expression/Variable.hpp"
#include "KaleidoscopeJit.hpp"
#ifdef NOT_USING
/* stuff from KaleidoscopeJIT.hpp */
#include "llvm/ADT/StringRef.h"
#include "llvm/ExecutionEngine/JITSymbol.h"
#include "llvm/ExecutionEngine/Orc/CompileUtils.h"
#include "llvm/ExecutionEngine/Orc/Core.h"
#include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
#include "llvm/ExecutionEngine/Orc/ExecutorProcessControl.h"
#include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
#include "llvm/ExecutionEngine/Orc/JITTargetMachineBuilder.h"
#include "llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h"
#include "llvm/ExecutionEngine/Orc/Shared/ExecutorSymbolDef.h"
#include "llvm/ExecutionEngine/SectionMemoryManager.h"
#include "llvm/IR/DataLayout.h"
#include <memory>
#endif
/* stuff from kaleidoscope.cpp */
#include "llvm/ADT/APFloat.h"
@ -112,13 +96,7 @@ namespace xo {
virtual std::string display_string() const;
private:
Jit(
std::unique_ptr<KaleidoscopeJIT> kal_jit
#ifdef NOT_USING
llvm::orc::JITTargetMachineBuilder jtmb,
llvm::DataLayout dl
#endif
);
Jit(std::unique_ptr<KaleidoscopeJIT> kal_jit);
/* iniitialize native builder (i.e. for platform we're running on) */
static void init_once();
@ -131,12 +109,6 @@ namespace xo {
std::unique_ptr<KaleidoscopeJIT> kal_jit_;
#ifdef NOT_USING
llvm::orc::IRCompileLayer jit_compile_layer_;
/** reference here. looks like storage owned by .jit_es **/
llvm::orc::JITDylib & jit_our_dynamic_lib_;
#endif
// ----- this part adapted from kaleidoscope.cpp -----
/** everything bleow represents a pipeline

View file

@ -111,7 +111,7 @@ namespace xo {
std::move(*data_layout));
}
const DataLayout & getDataLayout() const { return data_layout_; }
const DataLayout & data_layout() const { return data_layout_; }
JITDylib &getMainJITDylib() { return MainJD; }

View file

@ -43,31 +43,6 @@ namespace xo {
{
Jit::init_once();
#ifdef NOT_USING
/* 'executor process control' */
auto epc = llvm::orc::SelfExecutorProcessControl::Create();
if (!epc) {
return epc.takeError();
//throw std::runtime_error("Jit::make: failed to establish executor process control");
}
/* 'execution session' */
auto es = std::make_unique<llvm::orc::ExecutionSession>(std::move(*epc));
/* 'jit target machine builder' */
llvm::orc::JITTargetMachineBuilder jtmb(es
->getExecutorProcessControl()
.getTargetTriple());
auto dl = jtmb.getDefaultDataLayoutForTarget();
if (!dl) {
return dl.takeError();
//throw std::runtime_error("Jit::make: failed to establish data layout object"
// " for target machine");
}
#endif
static llvm::ExitOnError llvm_exit_on_err;
std::unique_ptr<KaleidoscopeJIT> kal_jit = llvm_exit_on_err(KaleidoscopeJIT::Create());
@ -85,32 +60,9 @@ namespace xo {
return jit.release();
} /*make*/
Jit::Jit(
std::unique_ptr<KaleidoscopeJIT> kal_jit
#ifdef NOT_USING
llvm::orc::JITTargetMachineBuilder jtmb,
llvm::DataLayout dl
#endif
)
Jit::Jit(std::unique_ptr<KaleidoscopeJIT> kal_jit)
: kal_jit_{std::move(kal_jit)}
#ifdef NOT_USING
jit_compile_layer_(*this->jit_es_,
jit_object_layer_,
std::make_unique<llvm::orc::ConcurrentIRCompiler>(std::move(jtmb))),
/* note: string passed to createBareJITDyLib must be unique
* (within running process address space?)
*/
jit_our_dynamic_lib_(this->jit_es_->createBareJITDylib("<xojitlib>")), /*was MainJD*/
#endif
{
#ifdef NOT_USING
jit_our_dynamic_lib_.addGenerator
(cantFail(llvm::orc::DynamicLibrarySearchGenerator::GetForCurrentProcess
(jit_data_layout_.getGlobalPrefix())));
}
#endif
this->recreate_llvm_ir_pipeline();
}
@ -120,9 +72,9 @@ namespace xo {
//llvm_cx_ = std::make_unique<llvm::LLVMContext>();
llvm_cx_ = LlvmContext::make();
llvm_ir_builder_ = std::make_unique<llvm::IRBuilder<>>(llvm_cx_->llvm_cx_ref());
llvm_module_ = std::make_unique<llvm::Module>("xojit", llvm_cx_->llvm_cx_ref());
llvm_module_->setDataLayout(kal_jit_->getDataLayout());
llvm_module_ = std::make_unique<llvm::Module>("xojit", llvm_cx_->llvm_cx_ref());
llvm_module_->setDataLayout(kal_jit_->data_layout());
if (!llvm_cx_.get()) {
throw std::runtime_error("Jit::ctor: expected non-empty llvm context");
@ -139,6 +91,7 @@ namespace xo {
const std::string &
Jit::target_triple() const {
// although this getter is defined, seems to be empty in practice
return llvm_module_->getTargetTriple();
}