Ignore:
Timestamp:
Nov 23, 2011, 5:43:24 PM (9 years ago)
Author:
tranquil
Message:

merge of indexed labels branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D2.2/8051/src/common/costLabel.mli

    r486 r1542  
    11
    2 (** This module provides functions to manipulate and create fresh cost
     2(** This module provides functions to manipulate and create indexed cost
    33    labels. *)
    44
    5 include StringSig.S
     5(** [Atom] provides functions for cost atoms, the root of indexed costs *)
     6module Atom : sig
     7  include StringSig.S
     8end
     9
     10(** Simple expressions corresponding to loop tranformations.
     11    TODO: abstract or not? *)
     12type sexpr = Sexpr of int*int
     13
     14(** The identity simple expression, used in initialization. *)
     15val sexpr_id : sexpr
     16
     17(** Indexes are identified with (single-entry) loop depths. *)
     18type index = int
     19
     20(** [make_id prefix index] produces an identifier out of a
     21    prefix and a loop depth. *)
     22val make_id : string -> index -> string
     23
     24type indexing = sexpr list
     25
     26(** The type of constant indexings, to be used by interpreations *)
     27type const_indexing
     28
     29(** [const_ind_iter f c] iterates [f] over the values of indexes in c *)
     30val const_ind_iter : (int -> unit) -> const_indexing -> unit
     31
     32(** This is equivalent to [List.hd], but raises
     33    [Invalid_argument "non-empty indexing stack"] if argument is empty *)
     34val curr_const_ind : const_indexing list -> const_indexing
     35
     36(** [enter_loop inds n] is used to update the indexing stack [ind] when one
     37    is entering a loop indexed by [n]. Raises [Invalid_argument
     38    "non-empty indexing stack"] if [inds] is empty. *)
     39val enter_loop : const_indexing list -> index -> unit
     40
     41(** [enter_loop_opt inds (Some n)] behaves like [enter_loop inds n], and does
     42    nothing in case of [None].
     43    @see enter_loop *)
     44val enter_loop_opt : const_indexing list -> index option -> unit
     45
     46(** [continue_loop inds n] is used to update the indexing stack [inds] when
     47    one is continuing a loop indexed by [n].
     48    @raise [Invalid_argument "non-empty indexing stack"] if [inds] is empty.
     49    @raise [Invalid_argument "uninitialized loop index"] if the head of
     50    [inds] has no value for [index]. *)
     51val continue_loop : const_indexing list -> index -> unit
     52
     53(** [continue_loop_opt inds (Some n)] behaves like [continue_loop inds n], and
     54    does nothing in case of [None].
     55    @see continue_loop *)
     56val continue_loop_opt : const_indexing list -> index option -> unit
     57
     58(** [new_const_ind inds] pushes a new empty constant indexing on top of the
     59    stack [inds]. *)
     60val new_const_ind : const_indexing list -> const_indexing list
     61
     62(** [forget_const_ind inds] pops and discards the top constant indexing from the
     63    stack [inds].  Raises [Invalid_argument "non-empty indexing stack"] if
     64    [inds] is empty. *)
     65val forget_const_ind : const_indexing list -> const_indexing list
     66
     67(** [empty_indexing] is the empty indexing *)
     68val empty_indexing : indexing
     69
     70(** [add_id_indexing ind] adds an identity mapping in front of ind **)
     71val add_id_indexing : indexing -> indexing
     72
     73module IndexingSet : Set.S with type elt = indexing
     74
     75type t = {
     76  name : Atom.t;
     77  i : indexing
     78}
     79
     80(** [comp_index i s lbl] gives back the label [lbl] where index [i] is remapped
     81    to the simple expression [s]. *)
     82val comp_index : index -> sexpr -> t -> t
     83
     84(** [ev_indexing ind lbl] returns [lbl] where its indexing has been
     85    evaluated in the constant indexing [ind].
     86    @raise  Invalid_argument "constant indexing not enough to be applied" if
     87    [ind] does not contain enough mappings to evaluate [lbl]'s indexing. *)
     88val ev_indexing : const_indexing -> t -> t
     89
     90(** [string_of_cost_label pref t] converts an indexed label to a
     91    string suitable for a label name in C source.
     92    [string_of_cost_label ~pretty:true t] prints a more readable form *)
     93val string_of_cost_label : ?pretty : bool -> t -> string
     94
     95(** [fresh i u] creates a fresh label using [u] as name universe, inside
     96    the indexing [i] (which represents the nested loops containing the label) *)
     97val fresh : indexing -> Atom.Gen.universe -> t
     98
     99module Set : Set.S with type elt = t
     100module Map : Map.S with type key = t
     101
     102(** [indexings_of a s] produces the set of indexings of an atom [a] occurring
     103    in the set of indexed labels [s]. *)
     104val indexings_of : Atom.t -> Set.t -> IndexingSet.t
    6105
    7106(** [constant_map d x] produces a finite map which associates
Note: See TracChangeset for help on using the changeset viewer.