Ignore:
Timestamp:
Oct 6, 2011, 6:31:27 PM (9 years ago)
Author:
tranquil
Message:
  • finished changes on annotator
  • implementing indexes in interpreter
File:
1 edited

Legend:

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

    r1305 r1310  
    1010let cost_id_prefix = "_cost"
    1111let cost_incr_prefix = "_cost_incr"
     12let loop_id_prefix = "_i"
    1213
    1314
     
    313314    | Clight.Internal def ->
    314315        let max_depth = max_loop_index def.Clight.fn_body in
    315         let indexes_defs = loop_indexes_defs l_ind max_depth in
     316        let vars = loop_indexes_defs l_ind max_depth in
     317        let vars = List.rev_append vars def.Clight.fn_vars in
    316318        let body = instrument_body l_ind cost_mapping cost_incr def.Clight.fn_body in
    317         Clight.Internal { def with Clight.fn_body = body }
     319        Clight.Internal { def with Clight.fn_body = body; Clight.fn_vars = vars}
    318320    | Clight.External _ -> def
    319321  in
     
    361363  let cost_id = StringTools.Gen.fresh_prefix names cost_id_prefix in
    362364  let cost_decl = cost_decl cost_id in
     365       
     366        (* Create a fresh loop index prefix *)
     367        let names = StringTools.Set.add cost_id names in
     368  let l_ind = StringTools.Gen.fresh_prefix names loop_id_prefix in
    363369
    364370  (* Define an increment function for the cost variable. *)
     
    369375
    370376  (* Instrument each function *)
    371   let prog_funct =
    372     List.map (instrument_funct cost_mapping cost_incr) p.Clight.prog_funct in
     377  let prog_funct = p.Clight.prog_funct in
     378        let prog_funct =
     379    List.map (instrument_funct l_ind cost_mapping cost_incr) prog_funct in
    373380
    374381  (* Glue all this together. *)
Note: See TracChangeset for help on using the changeset viewer.