Ignore:
Timestamp:
Oct 19, 2011, 5:59:50 PM (8 years ago)
Author:
tranquil
Message:

first draft of peeling optimization:

  • a framework for heuristics has been set up, but peeling is always applied at the moment
  • cost mapping not touched yet
File:
1 edited

Legend:

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

    r1357 r1421  
    99type sexpr =
    1010    | Sexpr of int*int
     11
     12let is_const_sexpr (Sexpr(a, _)) = (a = 0)
    1113
    1214let sexpr_id = Sexpr(1, 0)
     
    7577
    7678(* i|-->e ° I *)
    77 let rec compose_index i s l = match i, l with
     79let rec compose_index_indexing i s l = match i, l with
    7880        | 0, s' :: l' -> compose_sexpr s s' :: l'
    79         | x, s' :: l' -> compose_index (i-1) s l'
     81        | x, s' :: l' -> s' :: compose_index_indexing (i-1) s l'
    8082        | _ -> l
    8183
     
    8991        | [] -> []
    9092        | s :: l ->
    91                 try
    92                   const_sexpr (ev_sexpr (ExtArray.get c i) s) ::
    93                          compose_const_indexing_i (i+1) c l
    94                 with
    95                         | Invalid_argument _ ->
    96                                 invalid_arg "constant indexing not enough to be applied"
     93                let head =
     94                        (* if s is constant leave it be. In particular, avoid raising the error *)
     95                        if is_const_sexpr s then s else
     96                        try
     97                          const_sexpr (ev_sexpr (ExtArray.get c i) s)
     98                        with
     99                                | Invalid_argument _ ->
     100                                        invalid_arg "constant indexing not enough to be applied" in
     101          head :: compose_const_indexing_i (i+1) c l
    97102
    98103module IndexingSet = Set.Make(struct
     
    105110    i : indexing
    106111}
     112
     113let comp_index i s lbl =
     114        {lbl with i = compose_index_indexing i s lbl.i}
    107115
    108116let ev_indexing c lbl =
Note: See TracChangeset for help on using the changeset viewer.