source: Deliverables/D2.2/8051-indexed-labels-branch/src/common/costLabel.mli @ 1310

Last change on this file since 1310 was 1310, checked in by tranquil, 9 years ago
  • finished changes on annotator
  • implementing indexes in interpreter
File size: 2.2 KB
Line 
1
2(** This module provides functions to manipulate and create indexed cost
3    labels. *)
4               
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: leave it abstract or not? *)
12type sexpr
13
14val sexpr_id : sexpr
15
16(* trying a nameless approach *)
17type index = int
18
19val make_id : string -> index -> string
20
21type indexing = sexpr list
22
23type const_indexing = int ref list
24
25(** [enter_loop n indexing] is used to update indexing when one is entering a
26    loop indexed by [n].
27        The function recycles the same constant indexing *)
28val enter_loop : index option -> const_indexing -> const_indexing
29
30(** [continue_loop n indexing] is used to update indexing when one is continuing a
31    loop indexed by [n]. *)
32val continue_loop : index option -> const_indexing -> const_indexing
33
34(** [id_indexing n] generates an identity indexing nested in [n] loops *) 
35val id_indexing : int -> indexing
36
37(** [compose_index i s l] applies the transformation [i] |--> [s] to [l] *) 
38val compose_index : index -> sexpr -> indexing -> indexing
39
40(** [compose_index l m] applies all the transformations in  [l] to [m] *)
41val compose_indexing : indexing -> indexing -> indexing
42
43val compose_const_indexing : const_indexing -> indexing -> int list
44
45module IndexingSet : Set.S with type elt = indexing
46
47type t = {
48        name : Atom.t;
49        i : indexing
50}
51
52(** [string_of_cost_label pref t] converts an indexed label to a
53    string suitable for a label name in source
54                [string_of_cost_label ~pretty:true t] prints a more readable form *)
55val string_of_cost_label : ?pretty : bool -> t -> string
56
57(** [fresh i u] creates a fresh label using [u] as name universe, inside
58    the indexing [i] (which represents the nested loops containing the label) *)
59val fresh : indexing -> Atom.Gen.universe -> t
60
61module Set : Set.S with type elt = t
62module Map : Map.S with type key = t
63
64(** [indexings_of a s] produces the set of indexings of an atom [a] occurring
65    in the set of indexed labels [s]. *)
66val indexings_of : Atom.t -> Set.t -> IndexingSet.t
67
68(** [constant_map d x] produces a finite map which associates
69    [x] to every element of the set [d]. *)
70val constant_map : Set.t -> 'a -> 'a Map.t
71
Note: See TracBrowser for help on using the repository browser.