fn handle_operation(
        &self,
        operation: &il::Operation,
        stack_pointer_offset: IntermediateOffset,
    ) -> Result<IntermediateOffset> {
        Ok(match *operation {
            // If we're assigning, operate off current stack pointer value
            il::Operation::Assign { ref dst, ref src } => {
                if *dst == self.stack_pointer {
                    match stack_pointer_offset {
                        IntermediateOffset::Top => IntermediateOffset::Top,
                        IntermediateOffset::Value(ref constant) => {
                            let expr =
                                src.replace_scalar(&self.stack_pointer, &constant.clone().into())?;
                            if expr.all_constants() {
                                IntermediateOffset::Value(eval(&expr)?)
                            } else {
                                IntermediateOffset::Top
                            }
                        }
                        IntermediateOffset::Bottom => IntermediateOffset::Bottom,
                    }
                } else {
                    stack_pointer_offset
                }
            }
            // If we are loading stack pointer, set it to top
            il::Operation::Load { ref dst, .. } => {
                if *dst == self.stack_pointer {
                    IntermediateOffset::Top
                } else {
                    stack_pointer_offset
                }
            }
            _ => stack_pointer_offset,
        })
    }
// Handle an operation for stack pointer offset analysis
Handle an operation for stack pointer offset analysis
Handle an operation for stack pointer offset analysis
fn handle_operation(
        &self,
        operation: &il::Operation,
        stack_pointer_offset: IntermediateOffset,
    ) -> Result<IntermediateOffset> {
        Ok(match *operation {
            // If we're assigning, operate off current stack pointer value
            il::Operation::Assign { ref dst, ref src } => {
                if *dst == self.stack_pointer {
                    match stack_pointer_offset {
                        IntermediateOffset::Top => IntermediateOffset::Top,
                        IntermediateOffset::Value(ref constant) => {
                            let expr =
                                src.replace_scalar(&self.stack_pointer, &constant.clone().into())?;
                            if expr.all_constants() {
                                IntermediateOffset::Value(eval(&expr)?)
                            } else {
                                IntermediateOffset::Top
                            }
                        }
                        IntermediateOffset::Bottom => IntermediateOffset::Bottom,
                    }
                } else {
                    stack_pointer_offset
                }
            }
            // If we are loading stack pointer, set it to top
            il::Operation::Load { ref dst, .. } => {
                if *dst == self.stack_pointer {
                    IntermediateOffset::Top
                } else {
                    stack_pointer_offset
                }
            }
            _ => stack_pointer_offset,
        })
    }
fn handle_operation ( & self , operation : & il :: Operation , stack_pointer_offset : IntermediateOffset , ) -> Result < IntermediateOffset > { Ok ( match * operation { // If we're assigning, operate off current stack pointer value il :: Operation :: Assign { ref dst , ref src } => { if * dst == self . stack_pointer { match stack_pointer_offset { IntermediateOffset :: Top => IntermediateOffset :: Top , IntermediateOffset :: Value ( ref constant ) => { let expr = src . replace_scalar ( & self . stack_pointer , & constant . clone ( ) . into ( ) ) ? ; if expr . all_constants ( ) { IntermediateOffset :: Value ( eval ( & expr ) ? ) } else { IntermediateOffset :: Top } } IntermediateOffset :: Bottom => IntermediateOffset :: Bottom , } } else { stack_pointer_offset } } // If we are loading stack pointer, set it to top il :: Operation :: Load { ref dst , .. } => { if * dst == self . stack_pointer { IntermediateOffset :: Top } else { stack_pointer_offset } } _ => stack_pointer_offset , } ) }
Handle an operation for stack pointer offset analysis
Handle an operation for stack pointer offset analysis
&self
operation
&il::Operation
stack_pointer_offset
IntermediateOffset
&self
operation
&il::Operation
stack_pointer_offset
IntermediateOffset