Use bforest::Map for representing live ranges.

Get rid of the per-value Vec in the LiveRange data type and use a
bforest::Map instead to represent the live-in intervals for non-local
live ranges.

This has some advantages:

- The memory footprint of a local live range is reduced from 40 to 20
  bytes, and
- Clearing the Liveness data structure is now a constant time operation
  which doesn't call free().
- The potentially quadratic behavior when computing large live ranges is
  controlled by the logarithmic B-tree operations.
This commit is contained in:
Jakob Stoklund Olesen
2017-12-04 13:43:10 -08:00
parent 27d5543adc
commit feaea238bc
9 changed files with 279 additions and 215 deletions

View File

@@ -282,7 +282,7 @@ impl<'a> LocationVerifier<'a> {
SingleDest(ebb, _) => {
for d in divert.all() {
let lr = &liveness[d.value];
if lr.is_livein(ebb, &self.func.layout) {
if lr.is_livein(ebb, liveness.context(&self.func.layout)) {
return err!(
inst,
"{} is diverted to {} and live in to {}",
@@ -297,7 +297,7 @@ impl<'a> LocationVerifier<'a> {
for d in divert.all() {
let lr = &liveness[d.value];
for (_, ebb) in self.func.jump_tables[jt].entries() {
if lr.is_livein(ebb, &self.func.layout) {
if lr.is_livein(ebb, liveness.context(&self.func.layout)) {
return err!(
inst,
"{} is diverted to {} and live in to {}",