Add EntityMap::with_capacity.
Create a secondary entity map with space reserved for a known range of entity references. Add dfg.num_ebbs() and dfg.num_insts() methods to provide capacities.
This commit is contained in:
@@ -42,6 +42,22 @@ impl DataFlowGraph {
|
||||
extended_values: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the total number of instructions created in this function, whether they are currently
|
||||
/// inserted in the layout or not.
|
||||
///
|
||||
/// This is intended for use with `EntityMap::with_capacity`.
|
||||
pub fn num_insts(&self) -> usize {
|
||||
self.insts.len()
|
||||
}
|
||||
|
||||
/// Get the total number of extended basic blocks created in this function, whether they are
|
||||
/// currently inserted in the layout or not.
|
||||
///
|
||||
/// This is intended for use with `EntityMap::with_capacity`.
|
||||
pub fn num_ebbs(&self) -> usize {
|
||||
self.ebbs.len()
|
||||
}
|
||||
}
|
||||
|
||||
/// Handling values.
|
||||
|
||||
Reference in New Issue
Block a user