feat: ready for JIT
This commit is contained in:
@@ -1,111 +0,0 @@
|
||||
#![allow(unused_variables)]
|
||||
|
||||
use crate::ir::*;
|
||||
|
||||
use super::JITContext;
|
||||
|
||||
pub trait CodeGen {
|
||||
fn codegen(self, ctx: &JITContext);
|
||||
}
|
||||
|
||||
impl CodeGen for Attrs {
|
||||
fn codegen(self, ctx: &JITContext) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl CodeGen for List {
|
||||
fn codegen(self, ctx: &JITContext) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl CodeGen for HasAttr {
|
||||
fn codegen(self, ctx: &JITContext) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl CodeGen for BinOp {
|
||||
fn codegen(self, ctx: &JITContext) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl CodeGen for UnOp {
|
||||
fn codegen(self, ctx: &JITContext) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl CodeGen for Select {
|
||||
fn codegen(self, ctx: &JITContext) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl CodeGen for If {
|
||||
fn codegen(self, ctx: &JITContext) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl CodeGen for LoadFunc {
|
||||
fn codegen(self, ctx: &JITContext) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl CodeGen for Call {
|
||||
fn codegen(self, ctx: &JITContext) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl CodeGen for Let {
|
||||
fn codegen(self, ctx: &JITContext) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl CodeGen for With {
|
||||
fn codegen(self, ctx: &JITContext) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl CodeGen for Assert {
|
||||
fn codegen(self, ctx: &JITContext) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl CodeGen for ConcatStrings {
|
||||
fn codegen(self, ctx: &JITContext) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl CodeGen for Const {
|
||||
fn codegen(self, ctx: &JITContext) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl CodeGen for Var {
|
||||
fn codegen(self, ctx: &JITContext) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl CodeGen for Thunk {
|
||||
fn codegen(self, ctx: &JITContext) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
impl CodeGen for Path {
|
||||
fn codegen(self, ctx: &JITContext) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
use inkwell::OptimizationLevel;
|
||||
use inkwell::builder::Builder;
|
||||
use inkwell::context::Context;
|
||||
use inkwell::execution_engine::ExecutionEngine;
|
||||
use inkwell::module::Module;
|
||||
|
||||
mod codegen;
|
||||
|
||||
pub use codegen::CodeGen;
|
||||
|
||||
pub struct JITContext<'ctx> {
|
||||
context: &'ctx Context,
|
||||
module: Module<'ctx>,
|
||||
builder: Builder<'ctx>,
|
||||
execution_engine: ExecutionEngine<'ctx>,
|
||||
}
|
||||
|
||||
impl<'ctx> JITContext<'ctx> {
|
||||
pub fn new(context: &Context) -> JITContext {
|
||||
let module = context.create_module("nixjit");
|
||||
JITContext {
|
||||
execution_engine: module
|
||||
.create_jit_execution_engine(OptimizationLevel::None)
|
||||
.unwrap(),
|
||||
builder: context.create_builder(),
|
||||
context,
|
||||
module,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user