cranelift: Don't build peepmatic-based optimizations in build.rs

Instead, when the `rebuild-peephole-optimizers` feature is enabled, rebuild them
the first time they are used. This allows peepmatic to run when Cranelift's
`Opcode` is defined and available, which paves the way forward for:

* merging `peepmatic_runtime::operator::Operator` and Cranelift's `Opcode` (we
  are wasting a bunch of cycles converting between the two of them), and

* supporting vcode optimizations in `peepmatic`.
This commit is contained in:
Nick Fitzgerald
2020-06-29 15:58:08 -07:00
parent 978070c020
commit ae95ad8733
4 changed files with 59 additions and 27 deletions

View File

@@ -162,16 +162,11 @@ jobs:
--package peepmatic-macro \
--package peepmatic-runtime \
--package peepmatic-test
- name: Rebuild Cranelift's peepmatic-based peephole optimizers
run: |
cd cranelift/
cargo build --features 'enable-peepmatic cranelift-codegen/rebuild-peephole-optimizers'
- name: Rebuild Peepmatic-based peephole optimizers and test them
run: cargo test --features 'enable-peepmatic cranelift-codegen/rebuild-peephole-optimizers'
working-directory: ./cranelift
- name: Check that peephole optimizers are up to date
run: git diff --exit-code
- name: Test `cranelift-codegen` with `peepmatic` enabled
run: |
cd cranelift/
cargo test --features 'enable-peepmatic'
# Perform all tests (debug mode) for `wasmtime`. This runs stable/beta/nightly
# channels of Rust as well as macOS/Linux/Windows.