Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions AGENTS.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions crates/kirin-constprop/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use std::collections::{HashMap, HashSet};

use kirin_interpreter::{
CallContext, ContextInsensitive, FunctionTarget, InterpreterError, WideningStrategy,
CallContext, ContextInsensitive, InterpreterError, LinkTarget, WideningStrategy,
};
use kirin_ir::{CompileStage, Product, SpecializedFunction};

Expand Down Expand Up @@ -69,9 +69,9 @@ impl Default for ConstPropContext {
impl CallContext<ConstPropValue> for ConstPropContext {
type Key = (CompileStage, SpecializedFunction, CallCtx);

fn key(&mut self, target: &FunctionTarget, args: &Product<ConstPropValue>) -> Self::Key {
fn key(&mut self, target: &LinkTarget, args: &Product<ConstPropValue>) -> Self::Key {
let stage = target.stage;
let function = target.function;
let function = target.specialization;
let ctx = match all_const(args) {
Some(consts) => {
let admitted = self.admitted.entry((stage, function)).or_default();
Expand Down
1 change: 1 addition & 0 deletions crates/kirin-derive-chumsky/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ mod tests {
edge: false,
},
fields,
callable_body: None,
wraps: None,
extra: (),
extra_attrs: ChumskyStatementAttrs { format: None },
Expand Down
182 changes: 0 additions & 182 deletions crates/kirin-derive-interpreter/src/function_entry.rs

This file was deleted.

18 changes: 1 addition & 17 deletions crates/kirin-derive-interpreter/src/interp_dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub fn generate(input: &DeriveInput) -> Result<TokenStream, syn::Error> {
// be interpretable for that engine's key — no higher-ranked GAT
// projection.
predicates.push(syn::parse_quote! {
#dialect_ty: #interp_crate::Interpretable<__InterpI, <__InterpI as #interp_crate::Interp>::Semantics> + #interp_crate::FunctionEntry
#dialect_ty: #interp_crate::Interpretable<__InterpI, <__InterpI as #interp_crate::Interp>::Semantics>
});
}
let mut where_clause = original_where.cloned().unwrap_or_else(|| syn::WhereClause {
Expand All @@ -84,13 +84,6 @@ pub fn generate(input: &DeriveInput) -> Result<TokenStream, syn::Error> {
)
}
});
let entry_arms = build_arms(&variants, enum_ident, |_| {
quote! {
#interp_crate::InterpDispatch::dispatch_function_entry(
stage_info, definition,
)
}
});

Ok(quote! {
#[automatically_derived]
Expand All @@ -109,15 +102,6 @@ pub fn generate(input: &DeriveInput) -> Result<TokenStream, syn::Error> {
#statement_arms
}
}

fn dispatch_function_entry(
&self,
definition: #ir_crate::Statement,
) -> Result<#interp_crate::CallableBody, <__InterpI as #interp_crate::Interp>::Error> {
match self {
#entry_arms
}
}
}
})
}
Expand Down
52 changes: 0 additions & 52 deletions crates/kirin-derive-interpreter/src/layout.rs

This file was deleted.

15 changes: 1 addition & 14 deletions crates/kirin-derive-interpreter/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
extern crate proc_macro;

mod function_entry;
mod interp_dispatch;
mod interpretable;
mod layout;

use proc_macro::TokenStream;
use syn::parse_macro_input;
Expand All @@ -19,19 +17,8 @@ pub fn derive_interpretable(input: TokenStream) -> TokenStream {
}
}

/// Derive `FunctionEntry` for a `#[wraps]` wrapper enum. Variants marked
/// `#[callable]` delegate; all other variants report `NotCallable`.
#[proc_macro_derive(FunctionEntry, attributes(wraps, callable, kirin, interpret))]
pub fn derive_function_entry(input: TokenStream) -> TokenStream {
let ast = parse_macro_input!(input as syn::DeriveInput);
match function_entry::do_derive_function_entry(&ast) {
Ok(tokens) => tokens.into(),
Err(e) => e.write_errors().into(),
}
}

/// Derive `InterpDispatch<I>` for a stage enum, dispatching statement
/// interpretation and function entry to each stage's language. Uses the same
/// interpretation to each stage's language. Uses the same
/// `#[stage(...)]` attributes as `StageMeta` / `ParseDispatch`.
#[proc_macro_derive(InterpDispatch, attributes(stage))]
pub fn derive_interp_dispatch(input: TokenStream) -> TokenStream {
Expand Down

This file was deleted.

5 changes: 4 additions & 1 deletion crates/kirin-derive-ir/src/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,10 @@ pub(crate) fn generate_dialect(ast: &syn::DeriveInput) -> darling::Result<TokenS
builder = builder
.add(BuilderTemplate::new())
.add(TraitImplTemplate::marker(&trait_path, &ir.attrs.ir_type))
.add(crate::has_signature::has_signature_template(crate_path));
.add(crate::has_signature::has_signature_template(crate_path))
.add(crate::has_callable_body::has_callable_body_template(
crate_path,
));

let mut output = builder.build()?;
output.extend(crate::project::generate_project(&ir, crate_path));
Expand Down
Loading