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

Last change on this file since 1319 was 1319, checked in by tranquil, 10 years ago

indexing branch is compiling again:

  • clight interpreter updated
  • clight labeller yet to be completed with single-entry loop detection
File size: 2.0 KB
RevLine 
[486]1
[1291]2(** This module provides functions to manipulate and create indexed cost
[486]3    labels. *)
[1291]4               
5(** [Atom] provides functions for cost atoms, the root of indexed costs *)
6module Atom : sig
7        include StringSig.S
8end
[486]9
[1297]10(** Simple expressions corresponding to loop tranformations.
11    TODO: leave it abstract or not? *)
[1291]12type sexpr
13
14val sexpr_id : sexpr
15
[1297]16(* trying a nameless approach *)
17type index = int
[1291]18
[1305]19val make_id : string -> index -> string
20
[1310]21type indexing = sexpr list
[1291]22
[1319]23type const_indexing = int array
[1310]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 *)
[1319]28val enter_loop : index option -> const_indexing -> unit
[1310]29
30(** [continue_loop n indexing] is used to update indexing when one is continuing a
31    loop indexed by [n]. *)
[1319]32val continue_loop : index option -> const_indexing -> unit
[1310]33
[1319]34(** [empty_indexing] generates an empty indexing *) 
35val empty_indexing : indexing
[1297]36
[1319]37(** [add_id_indexing ind] adds an identity mapping in front of ind **)
38val add_id_indexing : indexing -> indexing
[1291]39
[1297]40module IndexingSet : Set.S with type elt = indexing
[1291]41
42type t = {
43        name : Atom.t;
[1297]44        i : indexing
[1291]45}
46
[1319]47val apply_const_indexing : const_indexing -> t -> t
48
49
[1297]50(** [string_of_cost_label pref t] converts an indexed label to a
51    string suitable for a label name in source
[1291]52                [string_of_cost_label ~pretty:true t] prints a more readable form *)
53val string_of_cost_label : ?pretty : bool -> t -> string
54
55(** [fresh i u] creates a fresh label using [u] as name universe, inside
56    the indexing [i] (which represents the nested loops containing the label) *)
[1297]57val fresh : indexing -> Atom.Gen.universe -> t
[1291]58
59module Set : Set.S with type elt = t
60module Map : Map.S with type key = t
61
62(** [indexings_of a s] produces the set of indexings of an atom [a] occurring
63    in the set of indexed labels [s]. *)
64val indexings_of : Atom.t -> Set.t -> IndexingSet.t
65
[486]66(** [constant_map d x] produces a finite map which associates
67    [x] to every element of the set [d]. *)
68val constant_map : Set.t -> 'a -> 'a Map.t
[1291]69
Note: See TracBrowser for help on using the repository browser.