Cache HashSet in try_to_allocate_bundle_to_reg (#90)
Keep `conflict_set` allocated in `Env` instead of allocating a new one on every call. This improves register allocation performance by about 2%.
This commit is contained in:
@@ -20,6 +20,7 @@ use crate::{
|
||||
define_index, Allocation, Block, Edit, Function, Inst, MachineEnv, Operand, PReg, ProgPoint,
|
||||
RegClass, VReg,
|
||||
};
|
||||
use fxhash::FxHashSet;
|
||||
use smallvec::SmallVec;
|
||||
use std::cmp::Ordering;
|
||||
use std::collections::{BTreeMap, HashMap, HashSet};
|
||||
@@ -430,6 +431,10 @@ pub struct Env<'a, F: Function> {
|
||||
// ProgPoint to insert into the final allocated program listing.
|
||||
pub debug_annotations: std::collections::HashMap<ProgPoint, Vec<String>>,
|
||||
pub annotations_enabled: bool,
|
||||
|
||||
// Cached allocation for `try_to_allocate_bundle_to_reg` to avoid allocating
|
||||
// a new HashSet on every call.
|
||||
pub conflict_set: FxHashSet<LiveBundleIndex>,
|
||||
}
|
||||
|
||||
impl<'a, F: Function> Env<'a, F> {
|
||||
|
||||
Reference in New Issue
Block a user