1(*
2    Copyright (c) 2012,13,17,20 David C.J. Matthews
3
4    This library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public
6    License version 2.1 as published by the Free Software Foundation.
7    
8    This library is distributed in the hope that it will be useful,
9    but WITHOUT ANY WARRANTY; without even the implied warranty of
10    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11    Lesser General Public License for more details.
12    
13    You should have received a copy of the GNU Lesser General Public
14    License along with this library; if not, write to the Free Software
15    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
16*)
17
18signature CodetreeFunctionsSig =
19sig
20    type codetree
21    and codeBinding
22    and loadForm
23    and envSpecial
24
25    type machineWord = Address.machineWord
26
27    val mkLoadLocal: int -> codetree
28    and mkLoadArgument: int -> codetree
29    and mkLoadClosure: int -> codetree
30 
31    val mkEnv: codeBinding list * codetree -> codetree
32    and mkInd: int * codetree -> codetree
33    and mkVarField: int * codetree -> codetree
34    and mkIndContainer: int * codetree -> codetree
35    and mkTuple: codetree list -> codetree
36    and mkDatatype: codetree list -> codetree
37
38    val CodeFalse: codetree and CodeTrue: codetree and CodeZero: codetree
39
40    val mkSetContainer:     codetree * codetree * BoolVector.vector -> codetree
41    val mkTupleFromContainer: int * int -> codetree
42
43    val decSequenceWithFinalExp: codeBinding list -> codetree
44    
45    val sideEffectFree: codetree -> bool
46    and reorderable: codetree -> bool
47    and sideEffectFreeRTSCall: int -> bool
48
49    val makeConstVal: codetree -> codetree
50    
51    val evalue:    codetree -> machineWord option
52    
53    val findEntryInBlock: codetree * int * bool -> codetree
54    
55    val earlyRtsCall: int -> bool
56
57    val partitionMutualBindings: codeBinding -> codeBinding list
58
59    type createClosure
60    val makeClosure: unit -> createClosure
61    and addToClosure: createClosure -> loadForm -> loadForm
62    and extractClosure: createClosure -> loadForm list
63
64    val findInline: Universal.universal list -> envSpecial
65    val setInline: envSpecial -> Universal.universal list -> Universal.universal list
66
67    datatype inlineTest =
68        TooBig
69    |   NonRecursive
70    |   TailRecursive of bool vector
71    |   NonTailRecursive of bool vector
72
73    val evaluateInlining: codetree * int * int -> inlineTest
74
75    structure Sharing:
76    sig
77        type codetree = codetree
78        and codeBinding = codeBinding
79        and loadForm = loadForm
80        and createClosure = createClosure
81        and envSpecial = envSpecial
82    end
83
84end;
85