[spv-out] Use FastIndexMap for Frontend::switch_cases.

This commit is contained in:
Jim Blandy
2023-09-20 15:40:28 -07:00
parent 89523aec08
commit 1b1ea37f15

View File

@@ -40,7 +40,7 @@ use function::*;
use crate::{
arena::{Arena, Handle, UniqueArena},
proc::{Alignment, Layouter},
FastHashMap, FastHashSet,
FastHashMap, FastHashSet, FastIndexMap,
};
use num_traits::cast::FromPrimitive;
@@ -596,11 +596,7 @@ pub struct Frontend<I> {
/// use that target block id.
///
/// Used to preserve allocations between instruction parsing.
switch_cases: indexmap::IndexMap<
spirv::Word,
(BodyIndex, Vec<i32>),
std::hash::BuildHasherDefault<rustc_hash::FxHasher>,
>,
switch_cases: FastIndexMap<spirv::Word, (BodyIndex, Vec<i32>)>,
/// Tracks access to gl_PerVertex's builtins, it is used to cull unused builtins since initializing those can
/// affect performance and the mere presence of some of these builtins might cause backends to error since they
@@ -641,7 +637,7 @@ impl<I: Iterator<Item = u32>> Frontend<I> {
dummy_functions: Arena::new(),
function_call_graph: GraphMap::new(),
options: options.clone(),
switch_cases: indexmap::IndexMap::default(),
switch_cases: FastIndexMap::default(),
gl_per_vertex_builtin_access: FastHashSet::default(),
}
}