Don't renumber entities in the parser.

This makes it easier to debug testcases:
 - the entity numbers in a .cton file match the entity numbers used
   within Cretonne.
 - serializing and deserializing doesn't cause indices to change.

One disadvantage is that if a .cton file uses sparse entity numbers,
deserializing to the in-memory form doesn't compact it. However, the
text format is not intended to be performance-critical, so this isn't
expected to be a big burden.
This commit is contained in:
Dan Gohman
2018-02-15 21:13:25 -08:00
parent c846ec1626
commit a5b00b173e
22 changed files with 677 additions and 650 deletions

View File

@@ -8,7 +8,7 @@ use ir::{Type, StackSlot};
use packed_option::PackedOption;
use std::cmp;
use std::fmt;
use std::ops::Index;
use std::ops::{Index, IndexMut};
use std::str::FromStr;
/// The size of an object on the stack, or the size of a stack frame.
@@ -228,6 +228,12 @@ impl Index<StackSlot> for StackSlots {
}
}
impl IndexMut<StackSlot> for StackSlots {
fn index_mut(&mut self, ss: StackSlot) -> &mut StackSlotData {
&mut self.slots[ss]
}
}
/// Higher-level stack frame manipulation functions.
impl StackSlots {
/// Create a new spill slot for spilling values of type `ty`.