Skip to content

Commit

Permalink
ascent driven IR gen WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
StuartHarris committed Nov 25, 2024
1 parent 84c5805 commit c1e63b1
Show file tree
Hide file tree
Showing 6 changed files with 362 additions and 369 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion crux_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ guppy = "0.17.4"
ignore = "0.4.23"
lazy-regex = "3.3.0"
libc = "0.2.161"
petgraph = "0.6.5"
ramhorns = "1.0.1"
rustdoc-json = "0.9.2"
rustdoc-types = "0.32.2"
Expand Down
16 changes: 11 additions & 5 deletions crux_cli/src/codegen/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{
rc::Rc,
};

#[derive(Debug)]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ContainerFormat {
/// An empty struct, e.g. `struct A`.
UnitStruct,
Expand All @@ -21,7 +21,7 @@ pub enum ContainerFormat {
Enum(BTreeMap<u32, Named<VariantFormat>>),
}

#[derive(Debug)]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum Format {
/// A format whose value is initially unknown. Used internally for tracing. Not (de)serializable.
Variable(Variable<Format>),
Expand Down Expand Up @@ -69,18 +69,18 @@ pub enum Format {

/// A named value.
/// Used for named parameters or variants.
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Named<T> {
pub name: String,
pub value: T,
}

/// A mutable holder for an initially unknown value.
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Variable<T>(Rc<RefCell<Option<T>>>);

/// Description of a variant in an enum.
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum VariantFormat {
/// A variant whose format is initially unknown. Used internally for tracing. Not (de)serializable.
Variable(Variable<VariantFormat>),
Expand Down Expand Up @@ -145,3 +145,9 @@ where
}
}
}

impl<T: std::hash::Hash> std::hash::Hash for Variable<T> {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.0.borrow().hash(state);
}
}
320 changes: 0 additions & 320 deletions crux_cli/src/codegen/generator.rs

This file was deleted.

Loading

0 comments on commit c1e63b1

Please sign in to comment.