Split EntityMap into entity::PrimaryMap and entity::EntityMap.
The new PrimaryMap replaces the primary EntityMap and the PrimaryEntityData marker trait which was causing some confusion. We now have a clear division between the two types of maps: - PrimaryMap is used to assign entity numbers to the primary data for an entity. - EntityMap is a secondary mapping adding additional info. The split also means that the secondary EntityMap can now behave as if all keys have a default value. This means that we can get rid of the annoying ensure() and get_or_default() methods ther were used everywhere instead of indexing. Just use normal indexing now; non-existent keys will return the default value.
This commit is contained in:
@@ -63,7 +63,7 @@ impl<'a> LivenessVerifier<'a> {
|
||||
fn check_insts(&self) -> Result {
|
||||
for ebb in self.func.layout.ebbs() {
|
||||
for inst in self.func.layout.ebb_insts(ebb) {
|
||||
let encoding = self.func.encodings.get_or_default(inst);
|
||||
let encoding = self.func.encodings[inst];
|
||||
|
||||
// Check the defs.
|
||||
for &val in self.func.dfg.inst_results(inst) {
|
||||
|
||||
@@ -688,7 +688,7 @@ impl<'a> Verifier<'a> {
|
||||
for (&arg, &abi) in args.iter().zip(expected_args) {
|
||||
// Value types have already been checked by `typecheck_variable_args_iterator()`.
|
||||
if let ArgumentLoc::Stack(offset) = abi.location {
|
||||
let arg_loc = self.func.locations.get_or_default(arg);
|
||||
let arg_loc = self.func.locations[arg];
|
||||
if let ValueLoc::Stack(ss) = arg_loc {
|
||||
// Argument value is assigned to a stack slot as expected.
|
||||
self.verify_stack_slot(inst, ss)?;
|
||||
@@ -811,7 +811,7 @@ impl<'a> Verifier<'a> {
|
||||
None => return Ok(()),
|
||||
};
|
||||
|
||||
let encoding = self.func.encodings.get_or_default(inst);
|
||||
let encoding = self.func.encodings[inst];
|
||||
if encoding.is_legal() {
|
||||
let verify_encoding =
|
||||
isa.encode(&self.func.dfg,
|
||||
|
||||
Reference in New Issue
Block a user