Skip to content

Commit

Permalink
fix: hugr-llvm extension deltas (#1683)
Browse files Browse the repository at this point in the history
Fixes #1680

---------

Co-authored-by: Seyon Sivarajah <[email protected]>
  • Loading branch information
aborgna-q and ss2165 authored Nov 25, 2024
1 parent 4145024 commit c7bd5fb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
22 changes: 20 additions & 2 deletions hugr-llvm/src/emit/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ use anyhow::{anyhow, Result};
use hugr_core::builder::{
BuildHandle, Container, DFGWrapper, HugrBuilder, ModuleBuilder, SubContainer,
};
use hugr_core::extension::{ExtensionRegistry, EMPTY_REG};
use hugr_core::extension::prelude::PRELUDE_ID;
use hugr_core::extension::{ExtensionRegistry, ExtensionSet, EMPTY_REG};
use hugr_core::ops::handle::FuncID;
use hugr_core::std_extensions::arithmetic::{
conversions, float_ops, float_types, int_ops, int_types,
};
use hugr_core::std_extensions::logic;
use hugr_core::types::TypeRow;
use hugr_core::{Hugr, HugrView};
use inkwell::module::Module;
Expand Down Expand Up @@ -137,7 +142,20 @@ impl SimpleHugrConfig {
) -> Hugr {
let mut mod_b = ModuleBuilder::new();
let func_b = mod_b
.define_function("main", HugrFuncType::new(self.ins, self.outs))
.define_function(
"main",
HugrFuncType::new(self.ins, self.outs).with_extension_delta(
ExtensionSet::from_iter([
PRELUDE_ID,
int_types::EXTENSION_ID,
int_ops::EXTENSION_ID,
float_types::EXTENSION_ID,
float_ops::EXTENSION_ID,
conversions::EXTENSION_ID,
logic::EXTENSION_ID,
]),
),
)
.unwrap();
make(func_b, &self.extensions);

Expand Down
3 changes: 2 additions & 1 deletion hugr-llvm/src/utils/array_op_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ impl<D: Dataflow> ArrayOpBuilder for D {}

#[cfg(test)]
pub mod test {
use hugr_core::extension::prelude::PRELUDE_ID;
use hugr_core::{
builder::{DFGBuilder, HugrBuilder},
extension::{
Expand All @@ -133,7 +134,7 @@ pub mod test {
#[rstest::fixture]
#[default(DFGBuilder<Hugr>)]
pub fn all_array_ops<B: Dataflow>(
#[default(DFGBuilder::new(Signature::new_endo(Type::EMPTY_TYPEROW)).unwrap())]
#[default(DFGBuilder::new(Signature::new_endo(Type::EMPTY_TYPEROW).with_prelude()).unwrap())]
mut builder: B,
) -> B {
let us0 = builder.add_load_value(ConstUsize::new(0));
Expand Down

0 comments on commit c7bd5fb

Please sign in to comment.