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 implementation of regalloc2. #1

Merged
merged 155 commits into from
Sep 1, 2021
Merged
Show file tree
Hide file tree
Changes from 152 commits
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
8e923b0
Initial public commit of regalloc2.
cfallin Apr 13, 2021
33ac6cb
Heuristic improvement: reg-scan offset by inst location.
cfallin Apr 14, 2021
a08b012
Add support for reftypes/stackmaps and Stack constraints, and misc AP…
cfallin Apr 18, 2021
940c1b7
Changes from review comments.
cfallin Apr 18, 2021
34ab744
Add GitHub CI config.
cfallin Apr 18, 2021
414f3f8
Factored out test program and fuzzing features; core crate now only d…
cfallin Apr 18, 2021
49c54b6
Misc usability and functionality enhancements:
cfallin May 1, 2021
9e7021c
Derive Ord/hash on OperandOrAllocation.
cfallin May 4, 2021
15ed2d6
Allow multiple defs per vreg (i.e., accept non-SSA code).
cfallin May 6, 2021
48fbc23
BitVec::get() takes immutable self
cfallin May 6, 2021
ab828b6
MachineEnv fields are public
cfallin May 6, 2021
80cdd0c
Properly handle multiple same-fixed-reg constraints to the same vreg …
cfallin May 6, 2021
1a7a0c5
Some performance tweaks -- try to reduce register probe count with so…
cfallin May 6, 2021
747c56c
Some micro-optimizations in BitVec.
cfallin May 6, 2021
e2beb47
Handle moves specially with move-insertion logic rather than ordinary…
cfallin May 7, 2021
07a5a88
BitVec perf: use adaptive hybrid chunked small-array + FxHashMap.
cfallin May 7, 2021
02b6516
Some memory-size/bitpacking optimizations
cfallin May 7, 2021
a148dcc
Parameterize adaptive-map size in BitVec.
cfallin May 7, 2021
2ff02b5
Some perf opts in liveness computation and set impl:
cfallin May 7, 2021
2ba5185
Fuzzbugfix: actually do need eager liveness computation; must uphold …
cfallin May 7, 2021
42582e0
Some stats for loop effects on liveins: 487k loop set-unions (441 loo…
cfallin May 7, 2021
3713d61
Replace approximate liveness with true iterative liveness; turns out …
cfallin May 7, 2021
0f3454b
Inlining on btree commitment map comparators for a 10% win
cfallin May 7, 2021
3ddcf05
Optimizations: (i) range-summary array; (ii) early exit from btree pr…
cfallin May 8, 2021
4f63467
Pinned-VReg mechanism.
cfallin May 8, 2021
df59b5e
Inline all the things (ProgPoint edition)
cfallin May 8, 2021
a453501
sort_unstable (quicksort) everywhere
cfallin May 8, 2021
bfe1c63
Some preallocation and removal of one u32 from LiveRange struct
cfallin May 8, 2021
040c3c8
Some structure packing: Use now fits in three u32s.
cfallin May 8, 2021
d2cc4f1
More efficient queue_bundles (saves 18% on clang.wasm)
cfallin May 8, 2021
a6e3128
Support `mod` (modify) operands, for better efficiency with regalloc.…
cfallin May 8, 2021
4185eab
More efficient live-range creation re: uses
cfallin May 8, 2021
e41b010
Struct-of-array transform: pull LiveRangeHot out of LiveRange with ju…
cfallin May 8, 2021
ed339ab
Some minor opts: inlining, and smallvec reuse
cfallin May 8, 2021
179ef0e
Bugfix: Mod with dead def spans both Before and After positions
cfallin May 8, 2021
3d0d760
Bugfix: process parallel moves separately for Int and Float classes
cfallin May 8, 2021
00c64f6
Handle moves by joining LRs at inst boundary, not middle of move inst
cfallin May 9, 2021
f1fc9a8
Fix related to move handling
cfallin May 9, 2021
b9e8988
Error checking: properly signal a crit-edge requirement failure (used…
cfallin May 9, 2021
095a883
Fix crit-edge detection logic in CFGInfo analysis
cfallin May 9, 2021
509c5dc
Remove sanity-check logic in range summary construction -- zero-length
cfallin May 9, 2021
9fdc69e
fuzzbug fix in range-summary iter
cfallin May 9, 2021
c380b0d
assert fix: RegClass doesn't need to match for spillslots (can be reu…
cfallin May 9, 2021
8d7530d
Edge moves always before jumps, never after; semantics are too subtle…
cfallin May 9, 2021
34421fc
fix to prog-move handling: happens in middle of inst; and insert uses…
cfallin May 9, 2021
5c5ea4c
bugfix
cfallin May 9, 2021
4f26b1c
Properly handle prog-moves with fixed srcs or dests
cfallin May 9, 2021
b7fd53e
Fix checker: after moving edge-moves to prior to last branch of block…
cfallin May 10, 2021
0dbf4a7
Collect full conflict-bundle list, by not ending PhysReg probe on fir…
cfallin May 10, 2021
f7551c6
Integrate prog-moves with LR-moves; this should in theory reduce move…
cfallin May 11, 2021
e1a37cf
some more stats
cfallin May 11, 2021
b069ae0
Use hot-code map to augment spill weights of each use
cfallin May 12, 2021
6066d02
More annotations
cfallin May 12, 2021
37fa3ec
Improve prog-move handling: no use/def records, just directly connect…
cfallin May 12, 2021
1f9258b
Detect undefined liveins.
cfallin May 12, 2021
5b55948
Check branch-args for conflicts with edge-move placement.
cfallin May 14, 2021
f0fbf3a
Rework data structures: bundles have a SmallVec of ranges, and ranges…
cfallin May 18, 2021
328c900
fuzzbug fixes
cfallin May 18, 2021
8e0d0f1
fuzzbug fix
cfallin May 18, 2021
4389f16
debugging log message for liveins
cfallin May 18, 2021
c3513b9
Bugfix: don't do a split-at-intermediate-defs split if the first such…
cfallin May 18, 2021
04c8e46
Only do annotations in debug builds
cfallin May 19, 2021
e1f67e8
Pinned VRegs for use with regalloc.rs shim to support RealRegs.
cfallin May 19, 2021
f1c6dfe
Optionally show annotations in final allocation/program dump based on…
cfallin May 19, 2021
f56676f
Fixed all fuzzer targets (some API changes)
cfallin May 20, 2021
ce935c1
Add all empty LRs to a single "spill bundle", to avoid many small bun…
cfallin May 20, 2021
f0b24cf
Remove all-empty-ranges-to-spill-bundle: prioritizing same-alloc for …
cfallin May 20, 2021
2a5f571
WIP: Handle moves between realregs (pregs) and vregs somewhat special…
cfallin May 21, 2021
ec7fdeb
Properly handle RReg-RReg moves in new scheme
cfallin May 21, 2021
466ea2c
Simpler / possibly better splitting: split based on conflict position…
cfallin May 21, 2021
4b46c63
Fuzzbug fixes for simpler splitting
cfallin May 22, 2021
4696691
Another fuzzbug fix: proper checker-hint ordering when V-R and V-V mo…
cfallin May 22, 2021
a6c89b1
Avoid O(n^2) in liverange construction: we always build LRs in (rever…
cfallin May 22, 2021
107c091
Simple speedup in bundle merge: set bundle while everything is in cac…
cfallin May 22, 2021
59967ff
TODO-list update: braindump of next ideas to work on.
cfallin May 24, 2021
46feacc
Fuzzbug fix: don't merge bundles that have conflicting requirements. …
cfallin May 24, 2021
78c0091
Fuzzbug fix re: new requirements computation and multi-fixed-reg fixup.
cfallin May 24, 2021
10d9265
avoid some redundant work by computing initial reqs only once
cfallin May 24, 2021
5120681
Fuzzbug fix for requirement recomputation on minimal bundles with mul…
cfallin May 25, 2021
5895ae8
Remove precomputed requirements from ranges and bundles; cost of stru…
cfallin May 25, 2021
5b47462
Loop depth instead of hot/cold, with fast O(n) loop-depth computation…
cfallin May 25, 2021
3382f9a
Split based on first conflict of lowest-weight conflict, not first co…
cfallin May 25, 2021
8887077
small fix: preserve starts-at-def flag when setting liverange weight
cfallin May 25, 2021
7cdcb20
Split heuristic: split before entering deeper loop nest
cfallin May 25, 2021
ca5f24f
Hint the same PReg for both halves of a split
cfallin May 25, 2021
b3dc2b2
Alloc spillsets for whole vreg, not just spilled LRs. This is a prere…
cfallin May 26, 2021
4e0dd1f
little tweak to avoid a div/mod on every iter of a PReg alloc loop
cfallin May 26, 2021
dcf6f47
inline some things
cfallin May 26, 2021
e521811
Avoid re-spilling to spillslot when still clean: intra-block edition …
cfallin May 27, 2021
13bde99
bugfix with clean-spill opt: avoid if liverange starts at start of bl…
cfallin May 27, 2021
7171624
Don't generate r1->scratch,scratch-r1 sequence for cyclic moves of r1…
cfallin May 27, 2021
43d7095
Properly split when we hit a fixed conflict
cfallin May 28, 2021
789651f
Rework inner allocation-loop code: choose more wisely between splitti…
cfallin May 29, 2021
f49167e
emit annotations at Info level, for easier selective perf-debugging
cfallin May 29, 2021
44ca189
Fuzzbug fix: properly check for conflicting reqs before merging bundl…
cfallin Jun 1, 2021
e49727d
Fuzzbug fix: fix some weirdness with BTree iteration inner loop
cfallin Jun 1, 2021
2614eac
fuzzbug fix: restore clean error exit required by regalloc.rs fuzzer …
cfallin Jun 1, 2021
a2a770e
Fuzzbug fix
cfallin Jun 2, 2021
2fe276c
BTreeMap probe fix (fuzzbug): BTree does not interact nicely with Liv…
cfallin Jun 2, 2021
dc2b0d1
Add a perf idea to TODO list
cfallin Jun 2, 2021
6a0739b
Implement spill-bundle: move all empty ranges, and empty leading/trai…
cfallin Jun 3, 2021
00e4240
merge bundles much faster by just concatenating range-lists and unsta…
cfallin Jun 4, 2021
5560499
Adaptive commitment-map scanning: re-probe from root if we skip too m…
cfallin Jun 4, 2021
30f42a8
Fix fuzzbug: properly detect too-many-live-regs condition on fuzzing …
cfallin Jun 4, 2021
0eaa0fd
Fix to checker: analyze all blocks, even if out-state of entry block …
cfallin Jun 5, 2021
2be7bdb
Split-at-first-conflict: first conflict is first of (start of our ran…
cfallin Jun 7, 2021
c6bcd3c
WIP: redundant-move elimination.
cfallin Jun 8, 2021
940bc40
Redundant move eliminator.
cfallin Jun 8, 2021
0f270e5
WIP.
cfallin Jun 8, 2021
e33790d
do not remove redundant move if we don't have local (within-basic-blo…
cfallin Jun 8, 2021
f898b8d
Some fuzzbug fixes
cfallin Jun 10, 2021
2851ac8
Working redundant-move elimination
cfallin Jun 10, 2021
4ba7b2f
Improve redundant-move elimination: don't skip the case where we don'…
cfallin Jun 10, 2021
fcbf384
Use hashset to avoid linear scan in conflict-bundle-set deduplication
cfallin Jun 10, 2021
09b2dd4
TODO list update
cfallin Jun 11, 2021
1bd1248
Avoid stack-to-stack moves by allocating an extra spillslot and re-us…
cfallin Jun 11, 2021
ea81422
Update TODO list
cfallin Jun 11, 2021
a686d5a
Always recompute prio when recomputing bundle properties; otherwise i…
cfallin Jun 11, 2021
6ec6207
Add design document.
cfallin Jun 18, 2021
6944bc4
Fix typo (thanks @bjorn3).
cfallin Jun 18, 2021
b36a563
Cleanup: split allocator implemntation into 11 files of more reasonab…
cfallin Jun 18, 2021
36975b8
Add doc-comment note on Edit that stack-to-stack moves are never gene…
cfallin Jun 19, 2021
caf7274
Remove unused pred_pos
cfallin Jun 19, 2021
50eb6fc
Keep internal modules private, but re-export under fuzzing feature flag
cfallin Jun 19, 2021
736f636
Add fixed-non-allocatable operand support.
cfallin Jun 19, 2021
22eed0a
Make bitvec public; it is used by regalloc.rs shim too.
cfallin Jun 19, 2021
a58d36f
TODO update: make note on idea for large-input support
cfallin Jun 19, 2021
21fb233
reduce nesting level in DESIGN.md to make pandoc-to-pdf happy
cfallin Jun 19, 2021
245c212
Revert "Add fixed-non-allocatable operand support."
cfallin Jun 21, 2021
f27abc9
Remove infinite-loop check: it is not a high enough bound in some pat…
cfallin Jun 22, 2021
66d6821
Fix perf issue with many safepoints.
cfallin Jun 22, 2021
4c193a9
Fix heuristic-cost function overflow with high loop depth (found by @…
cfallin Jul 28, 2021
c9e8a87
Update TODO with new items from private feedback from @julian-seward1.
cfallin Aug 12, 2021
84285c2
Rename OperandPolicy to OperandConstraint as per feedback from @julia…
cfallin Aug 12, 2021
a591535
Use "vector" or "sequence" in lieu of "list" in DESIGN.md, except whe…
cfallin Aug 12, 2021
0c79584
Add some more detail about spill bundles to design doc.
cfallin Aug 12, 2021
38323e0
Some more design-doc and TODO updates from @julian-seward1's feedback.
cfallin Aug 12, 2021
3e1e0f3
Convert all log::debug to log::trace.
cfallin Aug 12, 2021
1f30958
Improve domtree as per @Amanieu's feedback.
cfallin Aug 12, 2021
b76b774
Fix comment in postorder.rs.
cfallin Aug 12, 2021
2f85643
Review feedback.
cfallin Aug 12, 2021
7652b4b
Review feedback.
cfallin Aug 12, 2021
82b7e6b
Review feedback: bitvec: struct-like enum variants, and factor out on…
cfallin Aug 12, 2021
eaf8647
BitVec: remove zero words to avoid expanding when unnecessary.
cfallin Aug 12, 2021
c071e44
Derive PartialOrd/Ord/Hash for Operand.
cfallin Aug 12, 2021
ffc06b2
Debug output for Operands: omit default/most common positions.
cfallin Aug 12, 2021
f1a989f
Add malloc/free optimization to TODO
cfallin Aug 12, 2021
8ed83e3
Fix `BitVec::get_or_insert` to scan only once.
cfallin Aug 12, 2021
69ad31f
Replace remaining instances of use of `debug` feature with `debug_ass…
cfallin Aug 13, 2021
e10bffb
Fix bug in refactored BitVec (found by @Amanieu).
cfallin Aug 14, 2021
6d313f2
Address review comments: more doc comments and some minor refactorings.
cfallin Aug 31, 2021
3a18564
Addressed more review comments.
cfallin Aug 31, 2021
b19fa48
Rename operand positions to Early and Late, and make weights f16/f32 …
cfallin Sep 1, 2021
6389071
Address review comments.
cfallin Sep 1, 2021
6f0893d
Address review comments.
cfallin Sep 1, 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
Empty file removed .empty
Empty file.
64 changes: 64 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Derived from regalloc.rs' GitHub CI config file.

name: Rust

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
# Lint code with rustfmt, report an error if it needs to be run.
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install rustfmt
run: rustup component add rustfmt
- name: Run rustfmt and check there's no difference
run: cargo fmt --all -- --check

# Make sure the code compiles and that all the tests pass.
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build
run: cargo build
- name: Run tests
run: cargo test --all --verbose

# Lint dependency graph for security advisories, duplicate versions, and
# incompatible licences.
cargo_deny:
name: Cargo deny
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- run: |
set -e
curl -L https://github.com/EmbarkStudios/cargo-deny/releases/download/0.8.5/cargo-deny-0.8.5-x86_64-unknown-linux-musl.tar.gz | tar xzf -
mv cargo-deny-*-x86_64-unknown-linux-musl/cargo-deny cargo-deny
echo `pwd` >> $GITHUB_PATH
- run: cargo deny check

# Builds the fuzz targets.
fuzz:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install nightly
run: rustup toolchain install nightly
- name: Install cargo-fuzz
run: cargo +nightly install cargo-fuzz
- name: Build ssagen fuzzing target
run: cargo +nightly fuzz build ssagen
- name: Build moves fuzzing target
run: cargo +nightly fuzz build moves
- name: Build ion fuzzing target
run: cargo +nightly fuzz build ion
- name: Build and smoke-test ion_checker fuzzing target
run: cargo +nightly fuzz run ion_checker ./fuzz/smoketest/ion_checker.bin
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Cargo.lock
target/
.*.swp
*~
24 changes: 24 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "regalloc2"
version = "0.0.1"
authors = ["Chris Fallin <chris@cfallin.org>", "Mozilla SpiderMonkey Developers"]
edition = "2018"
license = "Apache-2.0 WITH LLVM-exception AND MPL-2.0"
description = "Backtracking register allocator inspired from IonMonkey"
repository = "https://github.com/bytecodealliance/regalloc2"

[dependencies]
log = { version = "0.4.8", default-features = false }
smallvec = "1.6.1"
fxhash = "0.2.1"

# The below are only needed for fuzzing.
# Keep this in sync with libfuzzer_sys's crate version:
arbitrary = { version = "^0.4.6", optional = true }

[profile.release]
debug = true

[features]
default = []
fuzzing = ["arbitrary"]
220 changes: 220 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.

"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:

(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and

(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and

(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and

(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.

You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


--- LLVM Exceptions to the Apache 2.0 License ----

As an exception, if, as a result of your compiling your source code, portions
of this Software are embedded into an Object form of such source code, you
may redistribute such embedded portions in such Object form without complying
with the conditions of Sections 4(a), 4(b) and 4(d) of the License.

In addition, if you combine or link compiled forms of this Software with
software that is licensed under the GPLv2 ("Combined Software") and if a
court of competent jurisdiction determines that the patent provision (Section
3), the indemnity provision (Section 9) or other Section of the License
conflicts with the conditions of the GPLv2, you may retroactively and
prospectively choose to deem waived or otherwise exclude such Section(s) of
the License, but only in their entirety and only with respect to the Combined
Software.

33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## regalloc2: another register allocator

This is a register allocator that started life as, and is about 50%
still, a port of IonMonkey's backtracking register allocator to
Rust. In many regards, it has been generalized, optimized, and
improved since the initial port, and now supports both SSA and non-SSA
use-cases.

In addition, it contains substantial amounts of testing infrastructure
(fuzzing harnesses and checkers) that does not exist in the original
IonMonkey allocator.

See the [design overview](doc/DESIGN.md) for (much!) more detail on
how the allocator works.

## License

Unless otherwise specified, code in this crate is licensed under the Apache 2.0
License with LLVM Exception. This license text can be found in the file
`LICENSE`.

Files in the `src/ion/` directory are directly ported from original C++ code in
IonMonkey, a part of the Firefox codebase. Parts of `src/lib.rs` are also
definitions that are directly translated from this original code. As a result,
these files are derivative works and are covered by the Mozilla Public License
(MPL) 2.0, as described in license headers in those files. Please see the
notices in relevant files for links to the original IonMonkey source files from
which they have been translated/derived. The MPL text can be found in
`src/ion/LICENSE`.

Parts of the code are derived from regalloc.rs: in particular,
`src/checker.rs` and `src/domtree.rs`. This crate has the same license
as regalloc.rs, so the license on these files does not differ.
Loading