pub struct CCPState {
pub known: HashMap<LcnfVarId, KnownConstant>,
pub folded: usize,
pub dead_branches: usize,
}Expand description
State for Conditional Constant Propagation integrated with GVN.
CCP tracks which variables have statically-known values and uses this information to fold conditions and eliminate dead branches.
Fields§
§known: HashMap<LcnfVarId, KnownConstant>Map from variable to its known constant value.
folded: usizeNumber of constants folded.
dead_branches: usizeNumber of dead branches eliminated.
Implementations§
Source§impl CCPState
impl CCPState
pub fn new() -> Self
pub fn set_known(&mut self, var: LcnfVarId, val: KnownConstant)
pub fn get_known(&self, var: &LcnfVarId) -> &KnownConstant
Sourcepub fn run(&mut self, decl: &mut LcnfFunDecl)
pub fn run(&mut self, decl: &mut LcnfFunDecl)
Run CCP on a function declaration, folding constants and removing dead branches.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CCPState
impl RefUnwindSafe for CCPState
impl Send for CCPState
impl Sync for CCPState
impl Unpin for CCPState
impl UnsafeUnpin for CCPState
impl UnwindSafe for CCPState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more