mirror of
https://github.com/Noratrieb/brainfuck.git
synced 2026-01-14 13:35:00 +01:00
try to fix pass_cancel_left_right_add_sub
This commit is contained in:
parent
290201ab98
commit
d7fea43acf
7 changed files with 368 additions and 8 deletions
121
rust2/Cargo.lock
generated
121
rust2/Cargo.lock
generated
|
|
@ -2,6 +2,15 @@
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 3
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ansi_term"
|
||||||
|
version = "0.12.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
|
||||||
|
dependencies = [
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "atty"
|
name = "atty"
|
||||||
version = "0.2.14"
|
version = "0.2.14"
|
||||||
|
|
@ -34,6 +43,8 @@ dependencies = [
|
||||||
"criterion",
|
"criterion",
|
||||||
"insta",
|
"insta",
|
||||||
"owo-colors",
|
"owo-colors",
|
||||||
|
"tracing",
|
||||||
|
"tracing-subscriber",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
@ -355,6 +366,15 @@ dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "matchers"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558"
|
||||||
|
dependencies = [
|
||||||
|
"regex-automata",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.4.1"
|
version = "2.4.1"
|
||||||
|
|
@ -416,6 +436,12 @@ version = "3.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5e72e30578e0d0993c8ae20823dd9cff2bc5517d2f586a8aef462a581e8a03eb"
|
checksum = "5e72e30578e0d0993c8ae20823dd9cff2bc5517d2f586a8aef462a581e8a03eb"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pin-project-lite"
|
||||||
|
version = "0.2.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "plotters"
|
name = "plotters"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
|
|
@ -525,6 +551,9 @@ name = "regex-automata"
|
||||||
version = "0.1.10"
|
version = "0.1.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
|
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
|
||||||
|
dependencies = [
|
||||||
|
"regex-syntax",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-syntax"
|
name = "regex-syntax"
|
||||||
|
|
@ -621,12 +650,27 @@ dependencies = [
|
||||||
"yaml-rust",
|
"yaml-rust",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sharded-slab"
|
||||||
|
version = "0.1.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31"
|
||||||
|
dependencies = [
|
||||||
|
"lazy_static",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "similar"
|
name = "similar"
|
||||||
version = "2.1.0"
|
version = "2.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2e24979f63a11545f5f2c60141afe249d4f19f84581ea2138065e400941d83d3"
|
checksum = "2e24979f63a11545f5f2c60141afe249d4f19f84581ea2138065e400941d83d3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "smallvec"
|
||||||
|
version = "1.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strsim"
|
name = "strsim"
|
||||||
version = "0.10.0"
|
version = "0.10.0"
|
||||||
|
|
@ -678,6 +722,15 @@ version = "0.15.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
|
checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "thread_local"
|
||||||
|
version = "1.1.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180"
|
||||||
|
dependencies = [
|
||||||
|
"once_cell",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tinytemplate"
|
name = "tinytemplate"
|
||||||
version = "1.2.1"
|
version = "1.2.1"
|
||||||
|
|
@ -688,6 +741,68 @@ dependencies = [
|
||||||
"serde_json",
|
"serde_json",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tracing"
|
||||||
|
version = "0.1.34"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"pin-project-lite",
|
||||||
|
"tracing-attributes",
|
||||||
|
"tracing-core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tracing-attributes"
|
||||||
|
version = "0.1.20"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2e65ce065b4b5c53e73bb28912318cb8c9e9ad3921f1d669eb0e68b4c8143a2b"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tracing-core"
|
||||||
|
version = "0.1.26"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f"
|
||||||
|
dependencies = [
|
||||||
|
"lazy_static",
|
||||||
|
"valuable",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tracing-log"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a6923477a48e41c1951f1999ef8bb5a3023eb723ceadafe78ffb65dc366761e3"
|
||||||
|
dependencies = [
|
||||||
|
"lazy_static",
|
||||||
|
"log",
|
||||||
|
"tracing-core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tracing-subscriber"
|
||||||
|
version = "0.3.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4bc28f93baff38037f64e6f43d34cfa1605f27a49c34e8a04c5e78b0babf2596"
|
||||||
|
dependencies = [
|
||||||
|
"ansi_term",
|
||||||
|
"lazy_static",
|
||||||
|
"matchers",
|
||||||
|
"regex",
|
||||||
|
"sharded-slab",
|
||||||
|
"smallvec",
|
||||||
|
"thread_local",
|
||||||
|
"tracing",
|
||||||
|
"tracing-core",
|
||||||
|
"tracing-log",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-width"
|
name = "unicode-width"
|
||||||
version = "0.1.9"
|
version = "0.1.9"
|
||||||
|
|
@ -700,6 +815,12 @@ version = "0.2.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "valuable"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "version_check"
|
name = "version_check"
|
||||||
version = "0.9.4"
|
version = "0.9.4"
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ edition = "2021"
|
||||||
bumpalo = { version = "3.9.1", features = ["allocator_api"] }
|
bumpalo = { version = "3.9.1", features = ["allocator_api"] }
|
||||||
clap = { version = "3.1.9", features = ["derive"] }
|
clap = { version = "3.1.9", features = ["derive"] }
|
||||||
owo-colors = "3.3.0"
|
owo-colors = "3.3.0"
|
||||||
|
tracing = "0.1.34"
|
||||||
|
tracing-subscriber = { version = "0.3.11", features = ["env-filter"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
criterion = "0.3.5"
|
criterion = "0.3.5"
|
||||||
|
|
|
||||||
212
rust2/benches/mandelbrot.bf
Normal file
212
rust2/benches/mandelbrot.bf
Normal file
|
|
@ -0,0 +1,212 @@
|
||||||
|
A mandelbrot set fractal viewer in brainf*** written by Erik Bosman
|
||||||
|
+++++++++++++[->++>>>+++++>++>+<<<<<<]>>>>>++++++>--->>>>>>>>>>+++++++++
|
||||||
|
+++++++-[[>>>>>>>>>]+[<<<<<<<<<]>>>>>>>>>-]+<<<<<<<<<>>>>>>>>>[>>>>>>>>[
|
||||||
|
-]<<<<<<<<>>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>[-]+<<<<<<<<>+++++<>[<>-
|
||||||
|
<>[<>-<>>>>>>>>>>+<<<<<<<<<<>]<>>>>>>>>>>]<>>>>>>>>+<<<<<<<<>>>>>>>>>>>>
|
||||||
|
>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[-]+<<<>>>[<<<>>>
|
||||||
|
>>>>>>[>>>>>>>[-]<<<<<<<>>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>>>>[-]+<<<<<<<
|
||||||
|
>++++<>[<>-<>[<>-<>>>>>>>>>>+<<<<<<<<<<>]<>>>>>>>>>>]<>>>>>>>+<<<<<<<>++
|
||||||
|
+++++<>[<>-<>[<>-<>>>>>>>>>>+<<<<<<<<<<>]<>>>>>>>>>>]<>>>>>>>+<<<<<<<<<<
|
||||||
|
<<<<<<[<<<<<<<<<]>>>[<<<>>>[-]<<<>>>>>>>>>[>>>>>>>[-<<<<<<<>+<>>>>>>>]<<
|
||||||
|
<<<<<>[-<>>>>>>>+<<<<<<<>>>>>+<<<<<>>+<<>]<>>>>>>>>>]<<<<<<<<<[<<<<<<<<<
|
||||||
|
]>>>>>>>>>[>>>>>>>>[-<<<<<<<<>+<>>>>>>>>]<<<<<<<<>[-<>>>>>>>>+<<<<<<<<>>
|
||||||
|
>>>>+<<<<<<>>>+<<<>]<>>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>>>>[<<<<<<<>>>>>>
|
||||||
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<<<<
|
||||||
|
]>>>>[-]+<<<<>>>>>>>>>[>>>>>>>>>]>+<]]+>>>>>>>>[-<<<<<<<<->>>>>>>>]+<<<<
|
||||||
|
<<<<[->>>>>>>>-<<<<<<<<>>>>>>[-<<<<<<+>>>>>>]<<<<<<[->>>>>>+<<<<<<<<<<<<
|
||||||
|
<<<[<<<<<<<<<]>>>[-]+<<<>>>>>>>>>[>>>>>>>>>]>[-]+<]]+>[-<[>>>>>>>>>]<<<<
|
||||||
|
<<<<<>]<>>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>[-]<<<<>+++++<>[<>-<>[<>-<>>>>
|
||||||
|
>>>>>>+<<<<<<<<<<>]<>>>>>>>>>>]<>>>>>>-<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||||
|
>>>>>>-<<<<<<[<<<<<<<<<]]>>>]<<<
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use bumpalo::Bump;
|
use bumpalo::Bump;
|
||||||
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
use criterion::{black_box, criterion_main, Criterion};
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
|
|
||||||
struct MockReadWrite;
|
struct MockReadWrite;
|
||||||
|
|
@ -34,14 +34,21 @@ fn optimized(c: &mut Criterion) {
|
||||||
let bench = include_str!("bench.bf");
|
let bench = include_str!("bench.bf");
|
||||||
let twinkle = include_str!("twinkle.bf");
|
let twinkle = include_str!("twinkle.bf");
|
||||||
let bottles = include_str!("bottles.bf");
|
let bottles = include_str!("bottles.bf");
|
||||||
|
let mandelbrot = include_str!("mandelbrot.bf");
|
||||||
let hanoi = include_str!("hanoi.bf");
|
let hanoi = include_str!("hanoi.bf");
|
||||||
|
|
||||||
c.bench_function("fizzbuzz", |b| b.iter(|| run_bf(black_box(fizzbuzz))));
|
c.bench_function("fizzbuzz", |b| b.iter(|| run_bf(black_box(fizzbuzz))));
|
||||||
c.bench_function("bench", |b| b.iter(|| run_bf(black_box(bench))));
|
c.bench_function("bench", |b| b.iter(|| run_bf(black_box(bench))));
|
||||||
c.bench_function("twinkle", |b| b.iter(|| run_bf(black_box(twinkle))));
|
c.bench_function("twinkle", |b| b.iter(|| run_bf(black_box(twinkle))));
|
||||||
c.bench_function("bottles", |b| b.iter(|| run_bf(black_box(bottles))));
|
c.bench_function("bottles", |b| b.iter(|| run_bf(black_box(bottles))));
|
||||||
|
c.bench_function("mandelbrot", |b| b.iter(|| run_bf(black_box(mandelbrot))));
|
||||||
c.bench_function("hanoi", |b| b.iter(|| run_bf(black_box(hanoi))));
|
c.bench_function("hanoi", |b| b.iter(|| run_bf(black_box(hanoi))));
|
||||||
}
|
}
|
||||||
|
|
||||||
criterion_group!(benches, optimized);
|
pub fn benches() {
|
||||||
|
// we need such a low sample size because the benches take ages otherwise
|
||||||
|
let mut c = Criterion::default().configure_from_args().sample_size(30);
|
||||||
|
optimized(&mut c);
|
||||||
|
}
|
||||||
|
|
||||||
criterion_main!(benches);
|
criterion_main!(benches);
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,10 @@ fn main() {
|
||||||
|
|
||||||
let args = Args::parse();
|
let args = Args::parse();
|
||||||
|
|
||||||
|
tracing_subscriber::fmt()
|
||||||
|
.with_env_filter(tracing_subscriber::filter::EnvFilter::from_default_env())
|
||||||
|
.init();
|
||||||
|
|
||||||
let src = fs::read_to_string(&args.file).unwrap_or_else(|err| {
|
let src = fs::read_to_string(&args.file).unwrap_or_else(|err| {
|
||||||
eprintln!("error: Failed to read file: {err}");
|
eprintln!("error: Failed to read file: {err}");
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ use crate::BumpVec;
|
||||||
use bumpalo::Bump;
|
use bumpalo::Bump;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::fmt::{Debug, Formatter};
|
use std::fmt::{Debug, Formatter};
|
||||||
|
use tracing::trace;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Ir<'ir> {
|
pub struct Ir<'ir> {
|
||||||
|
|
@ -54,7 +55,7 @@ pub fn optimize<'ir>(alloc: &'ir Bump, instrs: &[(Instr<'_>, Span)]) -> Ir<'ir>
|
||||||
let mut ir = pass_group(alloc, ir);
|
let mut ir = pass_group(alloc, ir);
|
||||||
pass_find_set_null(&mut ir);
|
pass_find_set_null(&mut ir);
|
||||||
pass_set_n(&mut ir);
|
pass_set_n(&mut ir);
|
||||||
//pass_cancel_left_right_add_sub(&mut ir); this is broken lol todo
|
pass_cancel_left_right_add_sub(&mut ir);
|
||||||
ir
|
ir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -83,6 +84,7 @@ fn ast_to_ir<'ir>(alloc: &'ir Bump, ast: &[(Instr<'_>, Span)]) -> Ir<'ir> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// pass that replaces things like `Sub(1) Sub(1)` with `Sub(2)`
|
/// pass that replaces things like `Sub(1) Sub(1)` with `Sub(2)`
|
||||||
|
#[tracing::instrument]
|
||||||
fn pass_group<'ir>(alloc: &'ir Bump, ir: Ir<'ir>) -> Ir<'ir> {
|
fn pass_group<'ir>(alloc: &'ir Bump, ir: Ir<'ir>) -> Ir<'ir> {
|
||||||
let new_stmts = Vec::new_in(alloc);
|
let new_stmts = Vec::new_in(alloc);
|
||||||
let stmts = ir
|
let stmts = ir
|
||||||
|
|
@ -138,18 +140,20 @@ fn pass_group<'ir>(alloc: &'ir Bump, ir: Ir<'ir>) -> Ir<'ir> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// pass that replaces `Loop([Sub(_)])` to `SetNull`
|
/// pass that replaces `Loop([Sub(_)])` to `SetNull`
|
||||||
|
#[tracing::instrument]
|
||||||
fn pass_find_set_null(ir: &mut Ir<'_>) {
|
fn pass_find_set_null(ir: &mut Ir<'_>) {
|
||||||
for stmt in &mut ir.stmts {
|
for stmt in &mut ir.stmts {
|
||||||
if let Stmt {
|
if let Stmt {
|
||||||
kind: StmtKind::Loop(body),
|
kind: StmtKind::Loop(body),
|
||||||
..
|
span,
|
||||||
} = stmt
|
} = stmt
|
||||||
{
|
{
|
||||||
if let [Stmt {
|
if let [Stmt {
|
||||||
kind: StmtKind::Sub(_),
|
kind: StmtKind::Sub(_),
|
||||||
span,
|
..
|
||||||
}] = body.stmts.as_slice()
|
}] = body.stmts.as_slice()
|
||||||
{
|
{
|
||||||
|
trace!(?span, "Replacing Statement with SetNull");
|
||||||
*stmt = Stmt::new(StmtKind::SetN(0), *span);
|
*stmt = Stmt::new(StmtKind::SetN(0), *span);
|
||||||
} else {
|
} else {
|
||||||
pass_find_set_null(body);
|
pass_find_set_null(body);
|
||||||
|
|
@ -159,6 +163,7 @@ fn pass_find_set_null(ir: &mut Ir<'_>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// pass that replaces `SetN(n) Add(m)` with `SetN(n + m)`
|
/// pass that replaces `SetN(n) Add(m)` with `SetN(n + m)`
|
||||||
|
#[tracing::instrument]
|
||||||
fn pass_set_n(ir: &mut Ir<'_>) {
|
fn pass_set_n(ir: &mut Ir<'_>) {
|
||||||
two_window_pass(ir, pass_set_n, |a, b| {
|
two_window_pass(ir, pass_set_n, |a, b| {
|
||||||
if let StmtKind::SetN(before) = a.kind() {
|
if let StmtKind::SetN(before) = a.kind() {
|
||||||
|
|
@ -176,12 +181,15 @@ fn pass_set_n(ir: &mut Ir<'_>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// pass that replaces `Left(5) Right(3)` with `Left(2)`
|
/// pass that replaces `Left(5) Right(3)` with `Left(2)`
|
||||||
|
#[tracing::instrument]
|
||||||
fn pass_cancel_left_right_add_sub(ir: &mut Ir<'_>) {
|
fn pass_cancel_left_right_add_sub(ir: &mut Ir<'_>) {
|
||||||
two_window_pass(ir, pass_cancel_left_right_add_sub, |a, b| {
|
two_window_pass(ir, pass_cancel_left_right_add_sub, |a, b| {
|
||||||
match (a.kind(), b.kind()) {
|
match (a.kind(), b.kind()) {
|
||||||
(StmtKind::Right(r), StmtKind::Left(l)) | (StmtKind::Left(l), StmtKind::Right(r)) => {
|
(StmtKind::Right(r), StmtKind::Left(l)) | (StmtKind::Left(l), StmtKind::Right(r)) => {
|
||||||
let new = match r.cmp(l) {
|
let new = match r.cmp(l) {
|
||||||
Ordering::Equal => return WindowPassAction::RemoveBoth,
|
Ordering::Equal => {
|
||||||
|
return WindowPassAction::RemoveBoth;
|
||||||
|
}
|
||||||
Ordering::Less => StmtKind::Left(l - r),
|
Ordering::Less => StmtKind::Left(l - r),
|
||||||
Ordering::Greater => StmtKind::Right(r - l),
|
Ordering::Greater => StmtKind::Right(r - l),
|
||||||
};
|
};
|
||||||
|
|
@ -202,6 +210,10 @@ fn pass_cancel_left_right_add_sub(ir: &mut Ir<'_>) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// pass that replaces `Right(9) Add(5) Left(9)` with `AddOffset(9)`
|
||||||
|
#[tracing::instrument]
|
||||||
|
fn pass_add_sub_offset(ir: &mut Ir<'_>) {}
|
||||||
|
|
||||||
enum WindowPassAction<'ir> {
|
enum WindowPassAction<'ir> {
|
||||||
None,
|
None,
|
||||||
Merge(StmtKind<'ir>),
|
Merge(StmtKind<'ir>),
|
||||||
|
|
@ -238,10 +250,12 @@ where
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
WindowPassAction::RemoveBoth => {
|
WindowPassAction::RemoveBoth => {
|
||||||
|
trace!(?a, ?b, "Removing both statements");
|
||||||
|
stmts.remove(i);
|
||||||
stmts.remove(i);
|
stmts.remove(i);
|
||||||
stmts.remove(i + 1);
|
|
||||||
}
|
}
|
||||||
WindowPassAction::Merge(new) => {
|
WindowPassAction::Merge(new) => {
|
||||||
|
trace!(?a, ?b, ?new, "Merging statements");
|
||||||
stmts.remove(i + 1);
|
stmts.remove(i + 1);
|
||||||
stmts[i] = Stmt::new(new, merged_span);
|
stmts[i] = Stmt::new(new, merged_span);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
<<<>>>>
|
<<>>-<<>>>>>>>>>>>+<<<<<<<<<<<>>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue