Changeset 1542 for Deliverables/D2.2/8051/src/common/costLabel.mli
 Timestamp:
 Nov 23, 2011, 5:43:24 PM (9 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

Deliverables/D2.2/8051/src/common/costLabel.mli
r486 r1542 1 1 2 (** This module provides functions to manipulate and create freshcost2 (** This module provides functions to manipulate and create indexed cost 3 3 labels. *) 4 4 5 include StringSig.S 5 (** [Atom] provides functions for cost atoms, the root of indexed costs *) 6 module Atom : sig 7 include StringSig.S 8 end 9 10 (** Simple expressions corresponding to loop tranformations. 11 TODO: abstract or not? *) 12 type sexpr = Sexpr of int*int 13 14 (** The identity simple expression, used in initialization. *) 15 val sexpr_id : sexpr 16 17 (** Indexes are identified with (singleentry) loop depths. *) 18 type index = int 19 20 (** [make_id prefix index] produces an identifier out of a 21 prefix and a loop depth. *) 22 val make_id : string > index > string 23 24 type indexing = sexpr list 25 26 (** The type of constant indexings, to be used by interpreations *) 27 type const_indexing 28 29 (** [const_ind_iter f c] iterates [f] over the values of indexes in c *) 30 val const_ind_iter : (int > unit) > const_indexing > unit 31 32 (** This is equivalent to [List.hd], but raises 33 [Invalid_argument "nonempty indexing stack"] if argument is empty *) 34 val 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 "nonempty indexing stack"] if [inds] is empty. *) 39 val 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 *) 44 val 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 "nonempty indexing stack"] if [inds] is empty. 49 @raise [Invalid_argument "uninitialized loop index"] if the head of 50 [inds] has no value for [index]. *) 51 val 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 *) 56 val 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]. *) 60 val 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 "nonempty indexing stack"] if 64 [inds] is empty. *) 65 val forget_const_ind : const_indexing list > const_indexing list 66 67 (** [empty_indexing] is the empty indexing *) 68 val empty_indexing : indexing 69 70 (** [add_id_indexing ind] adds an identity mapping in front of ind **) 71 val add_id_indexing : indexing > indexing 72 73 module IndexingSet : Set.S with type elt = indexing 74 75 type 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]. *) 82 val 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. *) 88 val 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 *) 93 val 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) *) 97 val fresh : indexing > Atom.Gen.universe > t 98 99 module Set : Set.S with type elt = t 100 module 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]. *) 104 val indexings_of : Atom.t > Set.t > IndexingSet.t 6 105 7 106 (** [constant_map d x] produces a finite map which associates
Note: See TracChangeset
for help on using the changeset viewer.