Working example and README
This commit is contained in:
21
cranelift/isle/isle_examples/test.isle
Normal file
21
cranelift/isle/isle_examples/test.isle
Normal file
@@ -0,0 +1,21 @@
|
||||
(type u32 (primitive u32))
|
||||
(type A (enum (A1 (x u32)) (A2 (x u32))))
|
||||
(type B (enum (B1 (x u32)) (B2 (x u32))))
|
||||
|
||||
(decl Input (A) u32)
|
||||
(extractor Input get_input) ;; fn get_input<C>(ctx: &mut C, ret: u32) -> Option<(A,)>
|
||||
|
||||
(decl Lower (A) B)
|
||||
|
||||
(rule
|
||||
(Lower (A.A1 sub @ (Input (A.A2 42))))
|
||||
(B.B2 sub))
|
||||
|
||||
(decl Extractor (B) A)
|
||||
(rule
|
||||
(A.A2 x)
|
||||
(Extractor (B.B1 x)))
|
||||
|
||||
(rule
|
||||
(Lower (Extractor b))
|
||||
b)
|
||||
8
cranelift/isle/isle_examples/test_main.rs
Normal file
8
cranelift/isle/isle_examples/test_main.rs
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
pub fn get_input<C>(ctx: &mut C, x: u32) -> Option<(test::A,)> {
|
||||
None
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
||||
mod test;
|
||||
Reference in New Issue
Block a user