[project @ 1998-11-26 09:17:22 by sof]
[ghc-hetmet.git] / ghc / runtime / profiling / CHANGES-REQD
1
2 Adding @scc@ to the Haskell compiler -- A note of changes required
3
4
5 Haskell Compiler:
6 ----------------
7
8 SCC FRONT END SYNTAX:   scc "label" expr
9
10         hslexer.lex     scc recognised as SCC           
11         hsparser.y      scc expression parsed           
12         tree.ugn        new tree construct              
13         printtree.c     print scc (k bytecode)          
14         main.c          -S flag for scc (else warning)  
15
16 SCC THROUGH COMPILER:
17         reader          PrefixSyn       new construct (SCC')
18                         ReadPrefix      read k bytecode                 
19                         PrefixToHs      -> AbsSyn                       
20
21         abstractSyn     HsExpr          new construct (SCC)             
22                         BackSubst                                       
23         rename          RenameExpr4     rename body                     
24         typecheck       TcExpr          no unify, use type of body              
25         deSugar         DsExpr          -> CoreSyn                      
26
27     Core Syntax & Transformations:
28         coreSyn         CoreSyn         new construct (CoSCC) not primop
29                         AnnCoreSyn      new construct                   
30                         FreeVars                                        
31                         CoreFuns                                        
32
33         simplCore0      SubstAnal0                                      
34                         SimplCore0                                      
35                         RmTrivLets0                                     
36                         
37         simplCore                               default: not used       n
38         stranal-sem                             default: not used       n
39         interpreter                             york:    ???            n
40
41     Stg Syntax & Transformations:
42         stgSyn          CoreToStg       -> StgSyn               
43                         StgSyn          new construct (StgSCC)
44
45                         StgInfo (new)   pass gathering CC codegen info
46
47                         LetFloat                default: not used       n
48                         StgToStg                default: not used       n
49                         FreeVariables           default: not used       n
50
51     Abstract C & Code Generation:
52         main            Main            -scc flag for update flavour    y
53         codeGen         CgMonad         -scc new Cg info                y
54         absCSyn         AbsCSyn         new construct (CCostCentre)     y
55
56         codeGen         CodeGen         declaring cost centers          y
57         codeGen         ClosureInfo     closure kind                    y
58                                                 type                    y
59         codeGen         CgClosure       closure description             y
60
61         abstractC       PprAbsC         info table kind                 y
62                                                    description          y
63                                                    type                 y
64         
65      Real Code Generation Changes
66         Scc Expression:
67                 +RCC update frame -- stack space required
68                 +set new cost centre
69
70         Closure Entry:
71                 !different sizes for STD and CON update frames
72                 +single entry now requires RCC update frame
73                 +resume the CC in closure entered
74
75         Return in Registers:    
76                 +register return set RetCC (form closure or CCC)
77                 +register update reset closures CC to RetCC
78                 +attribute register update allocation to RetCC
79
80         CC_ALLOC calls with heap allocation
81
82      Optimisations:
83         update closure entry with scc -- no RCC frame                   ToDo
84
85
86 RTS stuff:
87 ---------
88
89 Time            interupt                                y
90
91 Cost centre declaration macros                          y
92
93 Info table macros with "description" etc?               y
94
95 Modify update frames to include cost centres            y
96 Dummy update frame return vector                        y
97 Recognition of dummy ret vect UpdatePAP                 y
98
99 Heap profiling (2s)
100         Cost Centre                                     y
101         Description                                     y
102
103 Profile info reported                                   y
104
105 Conditionalise need for timer interupt                  todo
106
107
108
109 ADDING GRP_NAME to CC and TYPE to CAT:
110 -------------------------------------
111
112 driver          --  -Ggroup flag                        y
113 main/Main.lhs   --  -Ggroup flag                        y
114                 --  pass to codegen                     y
115 codeGen         --  grp_name passed into CCostCentre    y
116 absCSyn         --  add group to CCostCentre            y
117                 --  print group with CC decl            y
118                 --  print type with INFO_TABLE decl     y
119 uniType         --  getUniTyDescription                 y
120
121 runtime         -- Add group to CostCentre              y
122                 -- Add group to CC_DECALRE              y
123                 -- Add type to ClCategory               y
124                 -- Add type to CAT_DECLARE              y
125                 -- Add type to INFO_TABLEs              y
126
127                 -- Report group in profiling report     y
128
129                 -- Heap profiling with group/module/type
130                 -- selection by mod,grp,typ             y
131                 -- profiling by cc,mod,grp,descr,type   y
132                     -- always hash on feature           y
133                 -- report by cc,mod,grp,descr,type      y
134
135                 This is different to York as we can have unprofiled
136                 costs/heap inherited from other modules/groups.
137
138                 TESTING TESTING TESTING TESTING         ToDo
139
140         
141 AUTO SCCS ...
142 -------------
143
144 driver                  --  -prof-auto                  y
145 main/Main.lhs           --  -scc-auto                   y
146                         --  doSCCauto pass (desugared)  Improve?
147 profiling/SCCauto.lhs   --  sccAutoTop                  Improve?
148
149         Need to compare to all explicitly annotated.    ToDo
150
151         I think this needs to be incorperated into      ToDo
152         the desugarer/typechecker? as the dict stuff
153         currently distorts this.
154         OK if we are using lexical scoping !!!
155         eg: See tautclause in clausify1.hs  (cl.*)
156
157
158
159
160 EXTENDING SCC ANNOTATIONS ...                           ToDo
161 -----------------------------
162
163 Front End:      let   scc "label"
164                 where scc "label"
165                 decl  scc "label"
166
167         hsparser.y      extended scc expressions parsed         
168         tree.ugn        new scc language constructs             
169         printtree.c     print new scc bytecode forms
170
171 Compiler:
172         reader          PrefixSyn       new constructs
173                         ReadPrefix      read bytecodes                  
174                         PrefixToHs      -> AbsSyn                       
175
176         abstractSyn     HsExpr          new constructs
177                         BackSubst                                       
178         rename          RenameExpr4     rename body
179         typecheck       TcExpr          no unify, use type of body
180         deSugar                         desugar new scc constructs -> SCC
181
182
183 LEXICAL/EVALUATION SCOPING ...
184
185 driver          --  -prof-eval -prof-lex (def)          y
186 main/Main.lhs   --  -scc-eval -scc-lex                  y
187                 --  doSCClex pass (stg_binds')          ToDo
188 ???             --  lexical scoping transform pass      ToDo
189
190
191
192 OTHER POSSIBLE STUFF:
193  
194 codegen/CodeGen.lhs     -- code to declare mod and group strings
195                         -- use references in CCostCentre
196
197 profiling cost report   -- Reporting group / module costs
198                                 with / without components
199                            Eg sort on group time
200                                 with module time sub-sort
201                                   with label time sub-sort