Ignore:
Timestamp:
Nov 28, 2011, 3:13:14 PM (9 years ago)
Author:
tranquil
Message:
  • corrected previous bug
  • finished propagating immediates
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D2.2/8051/src/RTLabs/RTLabsInterpret.ml

    r1542 r1572  
    8888
    8989let get_value = get_local_env fst
    90 let get_args lenv args = List.map (get_value lenv) args
    9190
    9291let get_type = get_local_env snd
     
    108107let concrete_stacksize = Eval.concrete_stacksize
    109108
     109
     110let eval_arg lenv mem sp = function
     111  | RTLabs.Reg r -> get_value lenv r
     112  | RTLabs.Imm (c, t) -> Eval.cst mem sp t c
     113
     114let get_type_arg lenv = function
     115  | RTLabs.Reg r -> get_type lenv r
     116  | RTLabs.Imm (_, typ) -> typ
     117
     118let get_args lenv mem sp  args = List.map (eval_arg lenv mem sp) args
    110119
    111120(* Assign a value to some destinations registers. *)
     
    130139
    131140let new_ind = CostLabel.new_const_ind
    132 
    133 let eval_arg lenv mem sp = function
    134   | RTLabs.Reg r -> get_value lenv r
    135   | RTLabs.Imm (c, t) -> Eval.cst mem sp t c
    136 
    137 let get_type_arg lenv = function
    138   | RTLabs.Reg r -> get_type lenv r
    139   | RTLabs.Imm (_, typ) -> typ
    140141
    141142(* Interpret statements. *)
     
    205206      | RTLabs.St_call_id (f, args, destr, sg, lbl) ->
    206207        let f_def = find_function mem f in
    207         let args = get_args lenv args in
     208        let args = get_args lenv mem sp args in
    208209        (* Save the stack frame. *)
    209210        let sf =
     
    215216        let addr = get_value lenv r in
    216217        let f_def = Mem.find_fun_def mem (address_of_value addr) in
    217         let args = get_args lenv args in
     218        let args = get_args lenv mem sp args in
    218219        (* Save the stack frame. *)
    219220        let sf =
     
    224225      | RTLabs.St_tailcall_id (f, args, sg) ->
    225226        let f_def = find_function mem f in
    226         let args = get_args lenv args in
     227        let args = get_args lenv mem sp args in
    227228        (* No need to save the stack frame. But free the stack. *)
    228229        let mem = Mem.free mem sp in
     
    232233        let addr = get_value lenv r in
    233234        let f_def = Mem.find_fun_def mem (address_of_value addr) in
    234         let args = get_args lenv args in
     235        let args = get_args lenv mem sp args in
    235236        (* No need to save the stack frame. But free the stack. *)
    236237        let mem = Mem.free mem sp in
     
    279280
    280281      | RTLabs.St_return (Some r) ->
    281         let v = get_value lenv r in
     282        let v = eval_arg lenv mem sp r in
    282283        let mem = Mem.free mem sp in
    283284        ReturnState (sfrs, v, mem, inds, trace)
Note: See TracChangeset for help on using the changeset viewer.