Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial ISLE integration for x64 #3506

Merged
merged 95 commits into from
Nov 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
00e7ca2
ISLE: add a missing type check for whether terms used in expressions …
fitzgen Nov 5, 2021
30d2067
x64: Remove some unreachable code that's been ported to ISLE
fitzgen Nov 5, 2021
b849482
ISLE: finish porting `imul` lowering to ISLE
fitzgen Nov 5, 2021
7a568b1
ISLE: run `rustfmt` on generated code
fitzgen Nov 5, 2021
bbb4949
ISLE: use `lower_to_amode` inside `sink_load` implementation
fitzgen Nov 10, 2021
b5105c0
MachInst: always rematerialize constants, rather than assign them reg…
fitzgen Nov 10, 2021
33fcd6b
x64: special case `0` to use `xor` in `Inst::gen_constant` for `i128`s
fitzgen Nov 10, 2021
bfbf2f2
ISLE: implement x64 lowering for `band_not` in ISLE
fitzgen Nov 11, 2021
84b7612
Initial public commit of ISLE prototype DSL compiler.
cfallin Jun 30, 2021
e081608
WIP: rip out a bunch of stuff and rework
cfallin Sep 3, 2021
6a56792
WIP
cfallin Sep 3, 2021
f2399c5
WIP -- more thinking about how to work priorities into FSM
cfallin Sep 4, 2021
77ed861
Start of significant rework: compile to a trie, not an FSM, and handl…
cfallin Sep 4, 2021
02ec77a
trie insertion
cfallin Sep 4, 2021
5aa72bc
skeleton for codegen
cfallin Sep 4, 2021
e9a57d8
Generate internal enum types.
cfallin Sep 4, 2021
638c9ed
Support for file input and output, including multiple input files wit…
cfallin Sep 4, 2021
8c727b1
more codegen WIP: start to generate functions
cfallin Sep 4, 2021
e5d76db
WIP.
cfallin Sep 5, 2021
cd55dc9
WIP.
cfallin Sep 5, 2021
be1140e
WIP.
cfallin Sep 5, 2021
d7efd9f
Working extractor and constructor generation from rules!
cfallin Sep 5, 2021
4a2cd78
Working example and README
cfallin Sep 5, 2021
bc91a4e
Add TODO
cfallin Sep 5, 2021
b8e916a
Another example, testing rule priorities a bit
cfallin Sep 5, 2021
7865191
Update long block comment describing priority trie in codegen.rs.
cfallin Sep 5, 2021
ed4c857
Priority-trie: merge edges with different priorities into ranges when…
cfallin Sep 5, 2021
3ccbaf0
Generate match {} statements by merging adjacent MatchVariant trie ed…
cfallin Sep 6, 2021
d725ac1
Codegen: parameterize on a generated Context trait that contains exte…
cfallin Sep 6, 2021
602b830
More work on sketch for isel and some TODO items derived from it.
cfallin Sep 7, 2021
1ceef04
(and ...) combinator in patterns
cfallin Sep 7, 2021
6daa55a
Initial draft of DSL semantics complete.
cfallin Sep 9, 2021
a412cce
Infallible extractors, and some fixes to fallibility in return types …
cfallin Sep 9, 2021
edc95c5
Support for bools. Also fix fallible/infallible mixup for ctors.
cfallin Sep 9, 2021
3f96068
Some test cases for arg-less enums.
cfallin Sep 9, 2021
5a8e35b
Some fixes to the internal-extractor macro substitution
cfallin Sep 10, 2021
af9e01a
Remove old .gitmodules -- no longer using wasmtime as a submodule
cfallin Sep 10, 2021
b46fa6a
Remove old/no longer used `lower.rs`
cfallin Sep 10, 2021
7d38b3b
Revamped error handling: keep going beyond some errors to accumulate …
cfallin Sep 10, 2021
2a574b1
Properly track locations on every AST node. Semantic errors are much …
cfallin Sep 10, 2021
3ed146b
README update.
cfallin Sep 10, 2021
83672a8
bugfix to macro template generation: exclude Pos on ident from equali…
cfallin Sep 10, 2021
e751f12
Refactor to allow use as library, in order to allow build.rs usage.
cfallin Sep 15, 2021
521010c
Split into isle and islec crates
cfallin Sep 15, 2021
d0ace64
TODO update.
cfallin Sep 15, 2021
20bc5ca
Support extern constants of any primitive type.
cfallin Sep 15, 2021
91904aa
TODO items from call with fitzgen
cfallin Sep 15, 2021
66ba1d8
Remove TODO we don't want to do
fitzgen Sep 23, 2021
5f5484d
Use `matches!(..)` to make `TrieNode::is_empty` more concise
fitzgen Sep 27, 2021
012f4b0
Update TODO
fitzgen Sep 27, 2021
3535f82
Remove an unused field in `TermFunctionBuilder`
fitzgen Sep 27, 2021
972dc00
Don't use `&mut dyn Write` in codegen
fitzgen Sep 27, 2021
922a388
Fix `let` variable typing rules
fitzgen Sep 28, 2021
b93304b
Add docs to all public exports and `deny(missing_docs)` going forward
fitzgen Sep 28, 2021
38da2ce
Switch to using `thiserror`
fitzgen Sep 28, 2021
6ffb02d
Use `miette` for reporting errors
fitzgen Sep 28, 2021
cfaa35d
Use `structopt` to derive CLI flags
fitzgen Sep 28, 2021
8252589
Define a fuzz target for the parser
fitzgen Sep 28, 2021
6a52393
Fix overflows when tokenizing integer literals
fitzgen Sep 28, 2021
f2b6244
Fix some panics on parsing error paths
fitzgen Sep 28, 2021
e3aeb85
Fix a panic when parsing var patterns
fitzgen Sep 28, 2021
6604a26
Add a top-level parse function
fitzgen Sep 29, 2021
9be1942
Use `.copied()` instead of `.cloned()`
fitzgen Sep 29, 2021
a099b2b
Extend fuzzing to semantic analysis and codegen
fitzgen Sep 30, 2021
ce207ee
Check that integer literals are a primitive type
fitzgen Sep 30, 2021
d2bd07c
Check that integer literals are primitive types in patterns
fitzgen Sep 30, 2021
0e082e8
Make sure that every `decl` has a definition at the end of type checking
fitzgen Sep 30, 2021
bffaccd
Add a tutorial to the README
fitzgen Oct 1, 2021
381dada
Move trie construction out to its own module
fitzgen Oct 4, 2021
31d1cf3
Fill out implementation overview in README
fitzgen Oct 4, 2021
9af23bf
Report the recursive calls when an extractor is recursive
fitzgen Oct 5, 2021
fddff6e
Fix a panic when checking the call graph for an extractor with type e…
fitzgen Oct 5, 2021
7f8cb75
Allow terms to have both extractors and constructors
fitzgen Oct 7, 2021
fe836a2
Yield source positions from lexer that have file-relative offsets
fitzgen Oct 11, 2021
efe7df7
Keep track of where primitives are defined for better error messages
fitzgen Oct 11, 2021
0e02ec4
Use `BTree{Map,Set}` instead of `Hash{Map,Set}` to ensure determinist…
fitzgen Oct 12, 2021
e015a49
Do not use 1-member tuples in external constructor/extractor trait me…
fitzgen Oct 13, 2021
0c69563
Allow irrefutable let patterns in the generated code
fitzgen Oct 22, 2021
7fab7c5
Emit `if let`s against `Option<x>` instead of `Option<(x,)>`
fitzgen Oct 22, 2021
0411b20
Fix `allow` declaration
fitzgen Oct 22, 2021
6c6b7a2
Add a method to pretty-print a trie
fitzgen Oct 26, 2021
037db8a
Make sure that infallible match operations come after fallible ones
fitzgen Oct 26, 2021
22e18a9
Remove `eprintln!`s that shouldn't have been committed
fitzgen Oct 26, 2021
8f5dffa
Add better error messages for duplicate term declarations
fitzgen Nov 1, 2021
bd8c7fa
Add support for hex integer literals
fitzgen Nov 2, 2021
e235647
Add myself as a second author
fitzgen Nov 4, 2021
4c61c96
Add Cargo.toml metadata
fitzgen Nov 4, 2021
f227699
Make ISLE part of the root Cargo workspace.
cfallin Nov 12, 2021
d377b66
Initial ISLE integration with the x64 backend
fitzgen Oct 13, 2021
b6fd3d0
Remove extra, unused `Cargo.lock`
fitzgen Nov 15, 2021
4a34d2c
Remove old ISLE-generated file
fitzgen Nov 15, 2021
f27b357
ISLE: update repo in Cargo.toml
fitzgen Nov 15, 2021
6164ba3
ISLE: match cranelift version
fitzgen Nov 15, 2021
48ef2c0
Clarify comment about `force_graphical` in `miette`
fitzgen Nov 15, 2021
0b1bf10
Update `miette` graphical-forcing comment to reference upstream issue
fitzgen Nov 15, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,10 @@
*.png binary
*.ico binary
*.wasm binary

# ISLE should use lisp syntax highlighting.
*.isle linguist-language=lisp

# Tell GitHub this is generated code, and doesn't need to be shown in diffs by
# default.
cranelift/codegen/src/isa/x64/lower/isle/generated_code.rs linguist-generated
15 changes: 15 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,21 @@ jobs:
working-directory: ./fuzz
- run: cargo fuzz build --dev

rebuild_isle:
name: Rebuild ISLE
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: ./.github/actions/install-rust
- name: Rebuild ISLE DSL files
run: cargo build -p cranelift-codegen --features "rebuild-isle"
- name: Reformat
run: cargo fmt -p cranelift-codegen
fitzgen marked this conversation as resolved.
Show resolved Hide resolved
- name: Check that the ISLE DSL files are up-to-date
run: git diff --exit-code

rebuild_peephole_optimizers:
name: Rebuild Peephole Optimizers
runs-on: ubuntu-latest
Expand Down
169 changes: 158 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ opt-level = 0
resolver = '2'
members = [
"cranelift",
"cranelift/isle/fuzz",
"cranelift/isle/islec",
"cranelift/serde",
"crates/bench-api",
"crates/c-api",
Expand Down
5 changes: 5 additions & 0 deletions cranelift/codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ criterion = "0.3"

[build-dependencies]
cranelift-codegen-meta = { path = "meta", version = "0.78.0" }
isle = { path = "../isle/isle", version = "0.78.0", optional = true }
miette = { version = "3", features = ["fancy"] }

[features]
default = ["std", "unwind"]
Expand Down Expand Up @@ -98,6 +100,9 @@ enable-peepmatic = ["peepmatic-runtime", "peepmatic-traits", "serde"]
# Enable support for the Souper harvester.
souper-harvest = ["souper-ir", "souper-ir/stringify"]

# Recompile ISLE DSL source files into their generated Rust code.
rebuild-isle = ["isle", "cranelift-codegen-meta/rebuild-isle"]

[badges]
maintenance = { status = "experimental" }

Expand Down
Loading