From f5d4b7c6fda8ae20110a5f6eeb34f447c9f78af8 Mon Sep 17 00:00:00 2001 From: Sean Billig Date: Sun, 30 Jun 2024 10:06:44 -0700 Subject: [PATCH] Cleanup unused deps and whitespace --- .github/workflows/ci.yml | 29 ++++++++++-- .../filecheck/fixtures/insn_simplify/or.sntn | 44 +++++++++---------- crates/filecheck/fixtures/licm/basic.sntn | 2 +- crates/ir/Cargo.toml | 2 - crates/ir/src/builder/func_builder.rs | 4 -- crates/parser/Cargo.toml | 4 -- 6 files changed, 48 insertions(+), 37 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fbe6011e..76b56cdd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,10 +14,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable with: toolchain: stable + - uses: Swatinem/rust-cache@v2 - run: cargo doc --no-deps fmt: @@ -25,11 +26,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable with: toolchain: nightly components: rustfmt + - uses: Swatinem/rust-cache@v2 - run: cargo fmt --all -- --check clippy: @@ -37,12 +39,29 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable with: toolchain: stable + - uses: Swatinem/rust-cache@v2 - run: cargo clippy --workspace --all-features --all-targets -- -D clippy::all + unused_deps: + name: Unused dependencies + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + toolchain: nightly + - name: Install cargo-udeps + uses: baptiste0928/cargo-install@v3 + with: + crate: cargo-udeps + + - run: cargo +nightly udeps + test: name: Test defaults: @@ -60,11 +79,13 @@ jobs: - nightly steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable with: toolchain: ${{ matrix.rust }} + - uses: Swatinem/rust-cache@v2 + - name: Test run: cargo test --workspace --all-targets --no-fail-fast diff --git a/crates/filecheck/fixtures/insn_simplify/or.sntn b/crates/filecheck/fixtures/insn_simplify/or.sntn index e1c98772..e3e8a1a4 100644 --- a/crates/filecheck/fixtures/insn_simplify/or.sntn +++ b/crates/filecheck/fixtures/insn_simplify/or.sntn @@ -2,7 +2,7 @@ target = "evm-ethereum-london" # v0 | -1 => -1 # check: return -1.i8; -func public %or0(v0.i8) -> i8 { +func public %or0(v0.i8) -> i8 { block0: v1.i8 = or v0 -1.i8; return v1; @@ -10,7 +10,7 @@ func public %or0(v0.i8) -> i8 { # v0 | v0 => v0 # check: return v0; -func public %or1(v0.i8) -> i8 { +func public %or1(v0.i8) -> i8 { block0: v1.i8 = or v0 v0; return v1; @@ -18,7 +18,7 @@ func public %or1(v0.i8) -> i8 { # v0 | 0 => v0 # check: return v0; -func public %or2(v0.i8) -> i8 { +func public %or2(v0.i8) -> i8 { block0: v1.i8 = or v0 0.i8; return v1; @@ -26,7 +26,7 @@ func public %or2(v0.i8) -> i8 { # v0 | !v0 => -1 # check: return -1.i8; -func public %or3(v0.i8) -> i8 { +func public %or3(v0.i8) -> i8 { block0: v1.i8 = not v0; v2.i8 = or v0 v1; @@ -35,7 +35,7 @@ func public %or3(v0.i8) -> i8 { # v0 | (v0 & v1) => v0 # check: return v0; -func public %or4(v0.i8, v1.i8) -> i8 { +func public %or4(v0.i8, v1.i8) -> i8 { block0: v2.i8 = and v0 v1; v3.i8 = or v0 v2; @@ -44,7 +44,7 @@ func public %or4(v0.i8, v1.i8) -> i8 { # v0 | (v1 & v0) => v0 # check: return v0; -func public %or5(v0.i8, v1.i8) -> i8 { +func public %or5(v0.i8, v1.i8) -> i8 { block0: v2.i8 = and v1 v0; v3.i8 = or v0 v2; @@ -53,7 +53,7 @@ func public %or5(v0.i8, v1.i8) -> i8 { # v0 | !(v0 & v1) => -1 # check: return -1.i8; -func public %or6(v0.i8, v1.i8) -> i8 { +func public %or6(v0.i8, v1.i8) -> i8 { block0: v2.i8 = and v0 v1; v3.i8 = not v2; @@ -63,7 +63,7 @@ func public %or6(v0.i8, v1.i8) -> i8 { # v0 | !(v1 & v0) => -1 # check: return -1.i8; -func public %or7(v0.i8, v1.i8) -> i8 { +func public %or7(v0.i8, v1.i8) -> i8 { block0: v2.i8 = and v1 v0; v3.i8 = not v2; @@ -73,7 +73,7 @@ func public %or7(v0.i8, v1.i8) -> i8 { # (v0 ^ v1) | (v0 & !v1) => (v0 ^ v1) # check: return v2; -func public %or8(v0.i8, v1.i8) -> i8 { +func public %or8(v0.i8, v1.i8) -> i8 { block0: v2.i8 = xor v0 v1; v3.i8 = not v1; @@ -84,7 +84,7 @@ func public %or8(v0.i8, v1.i8) -> i8 { # (v0 ^ 1) | (!v1 & v0) => (v0 ^ v1) # check: return v2; -func public %or9(v0.i8, v1.i8) -> i8 { +func public %or9(v0.i8, v1.i8) -> i8 { block0: v2.i8 = xor v0 v1; v3.i8 = not v1; @@ -95,7 +95,7 @@ func public %or9(v0.i8, v1.i8) -> i8 { # (v0 ^ v1) | (!v0 & v1) => (v0 ^ v1) # check: return v2; -func public %or10(v0.i8, v1.i8) -> i8 { +func public %or10(v0.i8, v1.i8) -> i8 { block0: v2.i8 = xor v0 v1; v3.i8 = not v0; @@ -106,7 +106,7 @@ func public %or10(v0.i8, v1.i8) -> i8 { # (v0 ^ v1) | (v1 & !v0) => (v0 ^ v1) # check: return v2; -func public %or11(v0.i8, v1.i8) -> i8 { +func public %or11(v0.i8, v1.i8) -> i8 { block0: v2.i8 = xor v0 v1; v3.i8 = not v0; @@ -117,7 +117,7 @@ func public %or11(v0.i8, v1.i8) -> i8 { # (!v0 ^ v1) | (v0 & v1) => (!v0 ^ v1) # check: return v3; -func public %or12(v0.i8, v1.i8) -> i8 { +func public %or12(v0.i8, v1.i8) -> i8 { block0: v2.i8 = not v0; v3.i8 = xor v2 v1; @@ -128,7 +128,7 @@ func public %or12(v0.i8, v1.i8) -> i8 { # (!v0 ^ v1) | (v1 & v0) => (!v0 ^ v1) # check: return v3; -func public %or13(v0.i8, v1.i8) -> i8 { +func public %or13(v0.i8, v1.i8) -> i8 { block0: v2.i8 = not v0; v3.i8 = xor v2 v1; @@ -139,7 +139,7 @@ func public %or13(v0.i8, v1.i8) -> i8 { # (v0 ^ !v1) | (v0 & v1) => (v0 ^ !v1) # check: return v3; -func public %or14(v0.i8, v1.i8) -> i8 { +func public %or14(v0.i8, v1.i8) -> i8 { block0: v2.i8 = not v1; v3.i8 = xor v0 v2; @@ -150,7 +150,7 @@ func public %or14(v0.i8, v1.i8) -> i8 { # (v0 ^ !v1) | (v1 & v0) => (v0 ^ !v1) # check: return v3; -func public %or15(v0.i8, v1.i8) -> i8 { +func public %or15(v0.i8, v1.i8) -> i8 { block0: v2.i8 = not v1; v3.i8 = xor v0 v2; @@ -161,7 +161,7 @@ func public %or15(v0.i8, v1.i8) -> i8 { # (v0 | v1) | (v0 ^ v1) => (v0 | v1) # check: return v2; -func public %or16(v0.i8, v1.i8) -> i8 { +func public %or16(v0.i8, v1.i8) -> i8 { block0: v2.i8 = or v0 v1; v3.i8 = xor v0 v1; @@ -171,7 +171,7 @@ func public %or16(v0.i8, v1.i8) -> i8 { # (v0 | v1) | (v1 ^ v0) => (v0 | v1) # check: return v2; -func public %or17(v0.i8, v1.i8) -> i8 { +func public %or17(v0.i8, v1.i8) -> i8 { block0: v2.i8 = or v0 v1; v3.i8 = xor v1 v0; @@ -181,7 +181,7 @@ func public %or17(v0.i8, v1.i8) -> i8 { # (!v0 & v1) | !(v0 | v1) => !v0 # check: return v2; -func public %or18(v0.i8, v1.i8) -> i8 { +func public %or18(v0.i8, v1.i8) -> i8 { block0: v2.i8 = not v0; v3.i8 = and v2 v1; @@ -193,7 +193,7 @@ func public %or18(v0.i8, v1.i8) -> i8 { # (!v0 & v1) | !(v1 | v0) => !v0 # check: return v2; -func public %or19(v0.i8, v1.i8) -> i8 { +func public %or19(v0.i8, v1.i8) -> i8 { block0: v2.i8 = not v0; v3.i8 = and v2 v1; @@ -205,7 +205,7 @@ func public %or19(v0.i8, v1.i8) -> i8 { # (v0 & !v1) | !(v0 | v1) => !v1 # check: return v2; -func public %or20(v0.i8, v1.i8) -> i8 { +func public %or20(v0.i8, v1.i8) -> i8 { block0: v2.i8 = not v1; v3.i8 = and v0 v2; @@ -217,7 +217,7 @@ func public %or20(v0.i8, v1.i8) -> i8 { # (v0 & !v1) | !(v1 | v0) => !v1 # check: return v2; -func public %or21(v0.i8, v1.i8) -> i8 { +func public %or21(v0.i8, v1.i8) -> i8 { block0: v2.i8 = not v1; v3.i8 = and v0 v2; diff --git a/crates/filecheck/fixtures/licm/basic.sntn b/crates/filecheck/fixtures/licm/basic.sntn index 83cae52d..17f2d091 100644 --- a/crates/filecheck/fixtures/licm/basic.sntn +++ b/crates/filecheck/fixtures/licm/basic.sntn @@ -15,7 +15,7 @@ target = "evm-ethereum-london" # nextln: # nextln: block3: # nextln: return; -func public %basic(v0.i32, v1.i32) -> void { +func public %basic(v0.i32, v1.i32) -> void { block0: jump block1; diff --git a/crates/ir/Cargo.toml b/crates/ir/Cargo.toml index 2911073c..98f5d373 100644 --- a/crates/ir/Cargo.toml +++ b/crates/ir/Cargo.toml @@ -22,5 +22,3 @@ dyn-clone = "1.0.4" sonatina-triple = { path = "../triple", version = "0.0.3-alpha" } indexmap = "2.0.0" dot2 = { git = "https://github.com/sanpii/dot2.rs.git" } -bimap = "0.6.3" -smol_str = "0.2.2" diff --git a/crates/ir/src/builder/func_builder.rs b/crates/ir/src/builder/func_builder.rs index a40e6626..6c01b897 100644 --- a/crates/ir/src/builder/func_builder.rs +++ b/crates/ir/src/builder/func_builder.rs @@ -359,10 +359,6 @@ where self.module_builder.ctx.isa.type_provider().gas_type() } - // fn cursor(&mut self) -> InsnInserter { - // InsnInserter::new(&mut self.func, self.loc) - // } - fn insert_insn(&mut self, insn_data: InsnData) -> Option { let insn = self.cursor.insert_insn_data(&mut self.func, insn_data); let result = self.cursor.make_result(&mut self.func, insn); diff --git a/crates/parser/Cargo.toml b/crates/parser/Cargo.toml index 9d6555cd..9444e354 100644 --- a/crates/parser/Cargo.toml +++ b/crates/parser/Cargo.toml @@ -14,15 +14,11 @@ keywords = ["compiler", "evm", "wasm", "smart-contract"] [dependencies] ir = { package = "sonatina-ir", path = "../ir", version = "0.0.3-alpha" } sonatina-triple = { path = "../triple", version = "0.0.3-alpha" } -smallvec = "1.7.0" cranelift-entity = "0.104" pest = "2.7.10" pest_derive = "2.7.10" -pest-ast = "0.3.4" -from-pest = "0.3.2" smol_str = "0.2.2" hex = "0.4.3" -num-traits = { version = "0.2.19", default-features = false } either = { version = "1.12.0", default-features = false } annotate-snippets = "0.11.4" rustc-hash = "2.0.0"