Skip to content

Commit 067943d

Browse files
committed
Fix
1 parent ab34e22 commit 067943d

File tree

13 files changed

+57
-37
lines changed

13 files changed

+57
-37
lines changed

macro/src/dialect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ fn generate_dialect_module(
9999
Ok(quote! {
100100
#[doc = #doc]
101101
pub mod #name {
102-
use ::melior::ir::OperationLike;
102+
use ::melior::ir::{OperationLike, OperationLikeMut};
103103

104104
#(#operations)*
105105
}

melior/src/dialect/index.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ mod tests {
7777
attribute::{StringAttribute, TypeAttribute},
7878
block::BlockLike,
7979
r#type::{FunctionType, IntegerType},
80-
Block, Location, Module, Region, RegionLike, Type,
80+
Block, Location, Module, OperationLike, Region, RegionLike, Type,
8181
},
8282
test::load_all_dialects,
8383
Context,

melior/src/dialect/llvm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ mod tests {
381381
attribute::{IntegerAttribute, StringAttribute, TypeAttribute},
382382
block::BlockLike,
383383
r#type::{FunctionType, IntegerType},
384-
Block, Module, Region, RegionLike,
384+
Block, Module, OperationLike, Region, RegionLike,
385385
},
386386
pass::{self, PassManager},
387387
test::create_test_context,

melior/src/dialect/memref.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ mod tests {
326326
attribute::{DenseElementsAttribute, StringAttribute, TypeAttribute},
327327
block::BlockLike,
328328
r#type::{FunctionType, IntegerType, RankedTensorType},
329-
Block, Module, Region, RegionLike, Type,
329+
Block, Module, OperationLike, Region, RegionLike, Type,
330330
},
331331
test::create_test_context,
332332
};

melior/src/dialect/scf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ mod tests {
116116
attribute::{FloatAttribute, IntegerAttribute, StringAttribute, TypeAttribute},
117117
block::BlockLike,
118118
r#type::{FunctionType, IntegerType, Type},
119-
Attribute, Block, Module, RegionLike,
119+
Attribute, Block, Module, OperationLike, RegionLike,
120120
},
121121
test::load_all_dialects,
122122
Context,

melior/src/ir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub use self::{
1818
identifier::Identifier,
1919
location::Location,
2020
module::Module,
21-
operation::{Operation, OperationLike, OperationRef},
21+
operation::{Operation, OperationLike, OperationLikeMut, OperationRef},
2222
r#type::{ShapedTypeLike, Type, TypeLike},
2323
region::{Region, RegionLike, RegionRef},
2424
value::{Value, ValueLike},

melior/src/ir/block.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ mod tests {
206206
use super::*;
207207
use crate::{
208208
ir::{
209-
operation::OperationBuilder, r#type::IntegerType, Module, Region, RegionLike, ValueLike,
209+
operation::OperationBuilder, r#type::IntegerType, Module, OperationLike, Region,
210+
RegionLike, ValueLike,
210211
},
211212
test::create_test_context,
212213
Error,

melior/src/ir/block/block_like.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
use super::{BlockArgument, BlockRef, TypeLike};
22
use crate::{
3-
ir::{operation::OperationRefMut, Location, Operation, OperationRef, RegionRef, Type, Value},
3+
ir::{
4+
operation::OperationRefMut, Location, Operation, OperationLike, OperationRef, RegionRef,
5+
Type, Value,
6+
},
47
Error,
58
};
69
use core::fmt::Display;

melior/src/ir/module.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ impl Drop for Module<'_> {
9898
mod tests {
9999
use super::*;
100100
use crate::{
101-
ir::{attribute::StringAttribute, operation::OperationBuilder, Block, Region, RegionLike},
101+
ir::{
102+
attribute::StringAttribute, operation::OperationBuilder, Block, OperationLike,
103+
OperationLikeMut, Region, RegionLike,
104+
},
102105
test::create_test_context,
103106
};
104107

melior/src/ir/operation.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use core::{
1717
use mlir_sys::{
1818
mlirOperationClone, mlirOperationDestroy, mlirOperationEqual, mlirOperationPrint, MlirOperation,
1919
};
20-
pub use operation_like::OperationLike;
20+
pub use operation_like::{OperationLike, OperationLikeMut};
2121
use std::{
2222
ffi::c_void,
2323
fmt::{Debug, Display, Formatter},
@@ -73,6 +73,14 @@ impl<'c: 'a, 'a> OperationLike<'c, 'a> for &'a Operation<'c> {
7373
}
7474
}
7575

76+
impl<'c: 'a, 'a> OperationLike<'c, 'a> for &'a mut Operation<'c> {
77+
fn to_raw(self) -> MlirOperation {
78+
self.raw
79+
}
80+
}
81+
82+
impl<'c: 'a, 'a> OperationLikeMut<'c, 'a> for &'a mut Operation<'c> {}
83+
7684
impl Clone for Operation<'_> {
7785
fn clone(&self) -> Self {
7886
unsafe { Self::from_raw(mlirOperationClone(self.raw)) }
@@ -198,6 +206,8 @@ impl<'c: 'a, 'a> OperationLike<'c, 'a> for OperationRefMut<'c, 'a> {
198206
}
199207
}
200208

209+
impl<'c: 'a, 'a> OperationLikeMut<'c, 'a> for OperationRefMut<'c, 'a> {}
210+
201211
impl OperationRefMut<'_, '_> {
202212
/// Creates an operation reference from a raw object.
203213
///
@@ -265,8 +275,8 @@ mod tests {
265275
use crate::{
266276
context::Context,
267277
ir::{
268-
attribute::StringAttribute, Block, BlockLike, Location, OperationLike, Region,
269-
RegionLike, Type,
278+
attribute::StringAttribute, Block, BlockLike, Location, OperationLike,
279+
OperationLikeMut, Region, RegionLike, Type,
270280
},
271281
test::create_test_context,
272282
Error,

0 commit comments

Comments
 (0)