Ignore:
Timestamp:
Mar 2, 2011, 11:06:58 PM (9 years ago)
Author:
ayache
Message:

Bug fixs and signed division hack in D2.2.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D2.2/8051/src/clight/clightAnnotator.ml

    r619 r624  
    166166      let e' = instrument_expr cost_mapping cost_incr e in
    167167      Clight.Efield (e', x)
    168   | Clight.Ecost (lbl, e) ->
     168  | Clight.Ecost (lbl, e) when CostLabel.Map.mem lbl cost_mapping ->
    169169      let e' = instrument_expr cost_mapping cost_incr e in
    170170      let incr = CostLabel.Map.find lbl cost_mapping in
    171       Clight.Ecall (cost_incr, const_int incr, e')
     171      if incr = 0 then let Clight.Expr (e'', _) = e' in e''
     172      else Clight.Ecall (cost_incr, const_int incr, e')
     173  | Clight.Ecost (_, e) ->
     174    let Clight.Expr (e', _) = instrument_expr cost_mapping cost_incr e in
     175    e'
    172176  | Clight.Ecall (x, e1, e2) -> assert false (* Should not happen. *)
    173177
     
    221225      let s' = instrument_body cost_mapping cost_incr s in
    222226      Clight.Slabel (lbl, s')
    223   | Clight.Scost (lbl, s) ->
     227  | Clight.Scost (lbl, s) when CostLabel.Map.mem lbl cost_mapping ->
    224228      let s' = instrument_body cost_mapping cost_incr s in
    225229      let incr = CostLabel.Map.find lbl cost_mapping in
     
    230234        let args = [Clight.Expr (Clight.Econst_int incr, int_typ)] in
    231235        Clight.Ssequence (Clight.Scall (None, f, args), s')
     236  | Clight.Scost (_, s) ->
     237      instrument_body cost_mapping cost_incr s
    232238and instrument_ls cost_mapping cost_incr = function
    233239  | Clight.LSdefault s ->
Note: See TracChangeset for help on using the changeset viewer.