Rename EntityMap to SecondaryMap (#528)

* Rename `EntityMap` to `SecondaryMap`
This commit is contained in:
Muhammad Mominul Huque
2018-09-27 01:03:44 +06:00
committed by Dan Gohman
parent 7ff71fcfd9
commit d266b1a42d
18 changed files with 91 additions and 91 deletions

View File

@@ -1,6 +1,6 @@
//! A frontend for building Cranelift IR from other languages.
use cranelift_codegen::cursor::{Cursor, FuncCursor};
use cranelift_codegen::entity::{EntityMap, EntitySet};
use cranelift_codegen::entity::{EntitySet, SecondaryMap};
use cranelift_codegen::ir;
use cranelift_codegen::ir::function::DisplayFunction;
use cranelift_codegen::ir::{
@@ -24,8 +24,8 @@ use variable::Variable;
/// use here, `variable::Variable` can be used.
pub struct FunctionBuilderContext {
ssa: SSABuilder,
ebbs: EntityMap<Ebb, EbbData>,
types: EntityMap<Variable, Type>,
ebbs: SecondaryMap<Ebb, EbbData>,
types: SecondaryMap<Variable, Type>,
}
/// Temporary object used to build a single Cranelift IR `Function`.
@@ -79,8 +79,8 @@ impl FunctionBuilderContext {
pub fn new() -> Self {
Self {
ssa: SSABuilder::new(),
ebbs: EntityMap::new(),
types: EntityMap::new(),
ebbs: SecondaryMap::new(),
types: SecondaryMap::new(),
}
}

View File

@@ -6,7 +6,7 @@
//! Lecture Notes in Computer Science, vol 7791. Springer, Berlin, Heidelberg
use cranelift_codegen::cursor::{Cursor, FuncCursor};
use cranelift_codegen::entity::{EntityMap, EntityRef, PrimaryMap};
use cranelift_codegen::entity::{EntityRef, PrimaryMap, SecondaryMap};
use cranelift_codegen::ir::immediates::{Ieee32, Ieee64};
use cranelift_codegen::ir::instructions::BranchInfo;
use cranelift_codegen::ir::types::{F32, F64};
@@ -36,13 +36,13 @@ use Variable;
pub struct SSABuilder {
// Records for every variable and for every relevant block, the last definition of
// the variable in the block.
// TODO: Consider a sparse representation rather than EntityMap-of-EntityMap.
variables: EntityMap<Variable, EntityMap<Block, PackedOption<Value>>>,
// TODO: Consider a sparse representation rather than SecondaryMap-of-SecondaryMap.
variables: SecondaryMap<Variable, SecondaryMap<Block, PackedOption<Value>>>,
// Records the position of the basic blocks and the list of values used but not defined in the
// block.
blocks: PrimaryMap<Block, BlockData>,
// Records the basic blocks at the beginning of the `Ebb`s.
ebb_headers: EntityMap<Ebb, PackedOption<Block>>,
ebb_headers: SecondaryMap<Ebb, PackedOption<Block>>,
// Call and result stacks for use in the `use_var`/`predecessors_lookup` state machine.
calls: Vec<Call>,
@@ -158,9 +158,9 @@ impl SSABuilder {
/// Allocate a new blank SSA builder struct. Use the API function to interact with the struct.
pub fn new() -> Self {
Self {
variables: EntityMap::with_default(EntityMap::new()),
variables: SecondaryMap::with_default(SecondaryMap::new()),
blocks: PrimaryMap::new(),
ebb_headers: EntityMap::new(),
ebb_headers: SecondaryMap::new(),
calls: Vec::new(),
results: Vec::new(),
side_effects: SideEffects::new(),