Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
raviqqe committed Oct 19, 2023
1 parent 9d51ff3 commit de24ae2
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions melior/src/dialect/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ use crate::{
},
operation::OperationBuilder,
r#type::IntegerType,
Attribute, Identifier, Location, Operation, Region, Type, Value,
Attribute, AttributeLike, Identifier, Location, Operation, Region, Type, TypeLike, Value,
ValueLike,
},
Context,
};
Expand All @@ -21,8 +22,21 @@ mod load_store_options;
pub mod r#type;

macro_rules! assert_operation {
($context:expr, $name:expr) => {
($context:expr, $name:expr, [$($x:expr),+]) => {
assert!($context.is_registered_operation($name));
assert_context!($context, $($x),+);

};
}

macro_rules! assert_context {
($context:expr) => {};
($context:expr, $x:expr) => {
assert!($context == &$x.context());
};
($context:expr, $x:expr, $($y:expr),+) => {
assert!($context == &$x.context());
assert_context!($context, $($y),+);
};
}

Expand All @@ -38,7 +52,11 @@ pub fn extract_value<'c>(
) -> Operation<'c> {
const NAME: &str = "llvm.extractvalue";

assert_operation!(context, NAME);
assert_operation!(
context,
NAME,
[container.r#type(), position, result_type, location]
);

OperationBuilder::new(NAME, location)
.add_attributes(&[(Identifier::new(context, "position"), position.into())])
Expand Down

0 comments on commit de24ae2

Please sign in to comment.