Ignore:
Timestamp:
Nov 1, 2011, 6:31:24 PM (9 years ago)
Author:
tranquil
Message:
  • corrected a bug
  • implemented copy propagation
  • enhanced constant propagation with some algebraic equalities
  • temporarily added immediates to RTLabs, to be seen if it is useful
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D2.2/8051-indexed-labels-branch/src/RTLabs/RTLabsInterpret.ml

    r1357 r1477  
    132132let new_ind = CostLabel.new_const_ind
    133133
     134let eval_arg lenv mem sp = function
     135        | RTLabs.Reg r -> get_value lenv r
     136        | RTLabs.Imm (c, t) -> Eval.cst mem sp t c
     137
     138let get_type_arg lenv = function
     139        | RTLabs.Reg r -> get_type lenv r
     140        | RTLabs.Imm (_, typ) -> typ
     141
    134142(* Interpret statements. *)
    135143
     
    173181        let v =
    174182          Eval.op2
    175             (get_type lenv destr) (get_type lenv srcr1) (get_type lenv srcr2)
     183            (get_type lenv destr) (get_type_arg lenv srcr1) (get_type_arg lenv srcr2)
    176184            op2
    177             (get_value lenv srcr1)
    178             (get_value lenv srcr2) in
     185            (eval_arg lenv mem sp srcr1)
     186            (eval_arg lenv mem sp srcr2) in
    179187        assign_state sfrs graph sp lbl lenv mem inds trace destr v
    180188
    181189      | RTLabs.St_load (q, addr, destr, lbl) ->
    182         let addr = address_of_value (get_value lenv addr) in
     190        let addr = address_of_value (eval_arg lenv mem sp addr) in
    183191        let v = Mem.loadq mem q addr in
    184192        assign_state sfrs graph sp lbl lenv mem inds trace destr v
    185193
    186194      | RTLabs.St_store (q, addr, srcr, lbl) ->
    187         let addr = address_of_value (get_value lenv addr) in
    188         let v = get_value lenv srcr in
     195  let addr = address_of_value (eval_arg lenv mem sp addr) in
     196        let v = eval_arg lenv mem sp srcr in
    189197        let mem = Mem.storeq mem q addr v in
    190198        State (sfrs, graph, sp, lbl, lenv, mem, inds, trace)
Note: See TracChangeset for help on using the changeset viewer.