*** empty log message ***
[libfirm] / TODO
1   * 28.6.04 MMB
2     Div/Mod optimization for constants produces a result that will be optimized
3     again and again :-( Add a flag or a clever encoding so thios does not happen
4
5   + Goetz 10.6.04
6     Error in removing dead code:
7     In an if condition is a loop.  We optimized the if condition to Jmp/Bad,
8     the loop now is unreachable.  It should be removed by gigo or the like.
9     It remains in the representation as all blocks in the loop have a
10     valid predecessor, i.e., walking from End we find a true loop.  We need
11     a pass walking and marking starting at the Start node to remove this loop.
12     Currently scc causes an segmetation fault for this situation.
13
14   + Goetz 10.6.04
15     Error in irscc:  If we have an unreachable loop, or a loop
16     resulting from an exiting endless recursion, irscc finds
17     no tail ==> issues an assertion.
18
19   * Goetz 10.6.04
20     Error in interprocedural view:  Endless recursions are lost.
21
22   * print routines for all enums!
23
24   * Add flag whether mode is associative, float modes are not!!
25
26   * 25.2.04 Goetz
27     Fix memory leak in irprog: free_ir_prog.
28     Fix memory leak in entity: free_entity_attrs
29
30   * 19.12.03 Goetz
31     Add state management for loops (consistent, inconsistent, invalid).
32
33   * 18.12.03 Goetz
34     It sucks that Call and CallBegin are different nodes. Change this!!!!
35     (as for Filter: Phi/Proj).
36
37   * 8.12. Goetz
38     Vorgaengernummern am Looptree auf Kanten ausgeben.
39
40   * 8.12.03 Goetz und Till
41     Alloc Semantik:  Der Alloc Knoten koennte wissen, ob der
42     allozierte Speicher zu Null initialisiert ist.  Dies nehmen
43     wir im Jack Java Compiler an, im CRS C Compiler jedoch nicht.
44     Ist das nicht explizit im Allok Knoten vermerkt, kann eine
45     Optimierung nur in Abhaengigkeit vom Frontend darauf aufbauen.
46     (z.B. heapanal nimmt any an, statt null.)
47
48   * 8.9.03 Boris
49     Wenn man in Arrays.java in der Methode ArrObject.f() die
50     ersten zwei prints auskommentiert und pass_array_test die
51     for-Schleife durch ein i = 0, while(true).. ersetzt, stürzt der
52     Compiler in get_Block_idom ab; der übergebene Zeiger ist ein
53     NULL-Zeiger.
54
55   * 15.9.03 Goetz
56     Wir haben ev. einen Fehler in scc gefunden:  Matthias hat eine
57     Enlosrekursion a() { b(); }, b() { a(); } in Java implementiert.
58     Darauf ist in is_head die Assertion
59         assert(get_irn_uplink(pred) >= get_irn_uplink(root));
60     geflogen.
61
62   * 29.8.03 Goetz
63     Cast: irsimpletype: implement type analyses for one node.  Test the
64     effort of that analyses.  Add optimization to iropt that removes
65     Cast nodes.
66
67   * 22.8.2003 Goetz
68     Firm const nodes should have a type.
69     In jack all nodes are typed now, except the Const nodes. Only const from
70     tarval is typed.
71
72   * 14.8.2003 Goetz
73     Diverse dynamische arrays haben ein erstes, unverwendetes element. Z.B.
74     class members.  Entfernen um Speicher zu sparen.
75     Ev. auch attribute an firm Knoten optimieren, per bitfield.
76
77   + 24.3.2003 Goetz
78     tarval requirements:
79     zu register_mode:
80     Ich haette ganz gerne
81       new_ir_mode(ident* name, int size, int alignment, mode_sort sort);
82     modecode ist der naechste frei int > maxenum.
83     Und der konstruktor sollte auch nach den zwei inits aufgerufen werden koennen.
84     was spricht dagegen?  (die zwei inits stehen in init_firm(), ein benutzer kann
85     schwer dazwischen andere methoden aufrufen.)
86
87   * 24.3.2003 Goetz
88     tarval requirements:
89     - if overflow either return no tarval or return result of overflow
90       computation.  Offer to output a warning. (configurable)
91     - Div:  configure rounding (up/down) in init_firm, remark in each Div node
92       rounding sheme, default by initializations, pass rounding sheme
93       to tarval module
94     - impelement tarval_bitpattern
95     - make routine that outputs parts < 32 bits from any tarval
96       at given position in a C type that is exactly 32 bits.
97       For this test C types for their size or use int32 in integer.h
98       (is this standard C??)
99     - add routine that outputs the position of the largest set bit.
100
101   + 29.10.2002 Goetz
102     Representation of value compounds is not good, especially with
103     calls.
104
105   + 29.10.2002 Goetz
106     We can not represent bitfield members of structs in C.
107     Decision: generate explicit code for it, using shifts etc.
108     No special support.
109
110   * 29.10.2002 Goetz
111     If parameter variables are dereferenced they must be represented
112     by an entity in the stack frame type.  We need a mechanism to
113     find out which fields were parameters so that the parameter
114     passing space on the frame can be used for the parameters.
115
116   + 19.11.2001 Goetz
117     SymConst mit ident taugt nicht:  Wenn man z.B. die Prozedur kennt
118     sollte man die entitaet der Prozedur angeben koennen.  Ermoeglicht
119     einfachere Navigation im Callgraphen.
120     --> Verwende Const mit entity.
121
122   + 13.11.2001 Goetz
123     Aufbau Exceptions tut nicht:
124     1) mache exception handle block
125     2) baue code auf, verzweige von fragile ops zu dem Handler
126     3) mature exception block
127     --> Dann werden natuerlich die Werte am Ende der Bloecke mit den
128        fragile ops verwendet!  Diese sind ev. nicht berechnet.  Trifft
129        insbesondere auf memory zu ...
130     Loesung z.B.:
131     immExcBlock konstruktor.  Neuer "mature" status.  immExcBlocks duerfen
132     keine zyklen bilden.  In immExcBlocks werden PhiKnoten sofort eingesetzt,
133     aber wie immBlock mit flexibler vorgaenger liste.  add_in_edge ergaenzt
134     bei allen Phi Knoten dann sofort die neu bekannten Werte.  Jetzt kann
135     genau der Status zum Zeitpunkt der Exception abgebildet werden.
136
137   + 7.11.2001 Goetz
138     Model Stack frame of a method as class type as for Global type?
139     (Class so that methods defined within methods can be represented?)
140     So far local entities are added to GlobalType.
141
142   + 7.11.2001 Goetz
143     Implement support for endless loops.
144     (Add Jump target block to a list if optimizing Cond nodes.
145     Extend walker to start walking at this list.
146     Extend dead node elimination to update and compact this list.
147     Extend inlining to inline this list.)
148
149   + 7.11.2001 Goetz
150     Implement checking whether layout is fixed when setting corresponding
151     flag.  See firmtut, 3.1.4.
152     Maybe write a checker for the type information.
153
154   + 19.6.2001 Goetz
155     What happens if undefined values are allowed?  See ircons.c,
156     grep for get_irg_start_block.
157
158   + 23.5.2001 Goetz
159     Does the array type contain a field with the array entity?
160     This entity should be constructed automatically with the array type.
161
162   * 23.5.2005 Goetz
163     All compound types need a flag saying whether the order of the members
164     must be conserved.
165
166   + 23.5.2001 Goetz
167     Add element_type to array constructor
168
169   + 15.3.2001 Goetz
170     mode, size in type:  Wann gibt es einen mode, wann die size?
171     Kann man den mode aendern?  Nicht bei prim, enum, pointer da
172     schon irreversibel in Programmcode umgesetzt.  Die anderen
173     haben keinen mode.  Reicht daher intern ein Feld?  Muss man
174     in get_type_mode die typen asserten, und set_mode verbieten,
175     dafuer im enum konstruktor mode mitgeben?
176
177   + 14.3.2001 Boris
178     make dist should create an archive which has the directory libfirm/
179     as top-level
180 =======
181   14.3.2001 Boris
182   - make dist should create an archive which has the directory libfirm/
183     as top-level [DONE:28.3.2001 Boris]
184   - Datei 'Copyright' oder 'Copying' mit entsprechendem Copyrightverweis
185
186 *********** old stuff ***********
187
188  + Problem mit endlosen Schleifen loesen.
189
190  * Automatisches generieren und set_value der Argumente-projs in
191    new_ir_graph
192
193  + Define and implement procedure-global extensions, e.g., the call graph.
194
195  * Implement Confirm node: Added by optimization to annotate dataflow
196    edge with information as (value > 0).  This improves dataflow analysis.
197    These nodes can be derived from Cmp nodes in conjunction with dataflow
198    information.
199
200  + think again about implementation of boolean expressions  (0<1) && (2<3)
201    Cast now possible
202
203  + Add evaluation routines for Rotate, Not, Minus, ShrA to target value,
204    extend optimization to cover these nodes.
205
206  * do we need remainder (Rem) operator?
207    different sign handling than Mod.  How much processors???
208
209  * Turn Quot, Minus into three letter operator.
210
211 Propositions by Boris, 5.3.2001:
212  + Fehler in FIRM?
213    ---------------
214    + in oo_program_example ist das Feld einfach nur eine entity. Aber alles andere
215      hat einen bestimmten Typ (z.B. method, strct, etc.). Muß es dann nicht auch
216      field geben? Oder werden alle Felder eines Objekts in einem strct organisiert
217      -> HowTo Use FIRM - Doku.
218      ==> Wann eine entitaet ein Feld ist, laesst sich am Typ der Entitaet enkennen.
219          Entitaet ist Feld wenn Owner Klassentyp (oder ev. Struct) und Typ nicht
220          Methodentyp.
221          Speicherbedarf der Entitaet, d.h. ihr mode, laesst sich auch dem Typ ansehen.
222          Manche Typen enthalten explizit den mode (z.B. type_primitive, type_pointer.)
223          Bei anderen haengt die Groesse vom Layout ab:  class, struct.
224          Frage (fehlende Konvention): Ist eine Klasse ein Pointer oder immer nur
225          eine Value-Class??  Je nach dem muss man die Entitaeten modellieren:
226          Klasse = Pointer:  entitaet kann Typ=class haben.
227          Klasse = WerteKlasse: entitaet sollte pointer mit points-to Klasse sein.
228    - fehlende Optimierung: wenn ein Wert einer Ladeoperation nicht gebraucht wird,
229      dann gibt es auch keine Kante dafuer, aber die Ladeoperation bleibt
230      (unnoetigerweise) stehen.
231    - mit set_optimize(1) geht die Optimierung von if(const cmpop const) unvollständig
232      bzw. falsch [da bleibt wohl ein zweiter Block-Knoten ohne Vorgänger]
233  + Verbesserungsvorschläge:
234    ------------------------
235    + Knoten im Typgraphen mit Farbe hinterlegen
236    - Attribute im Firmgraphen nicht im Knoten
237    + Kanten je nach Sematik farbig markieren, vielleicht dann auch Knoten
238      (z.B. rot fuer alles, was mit Steuerfluss zu tun hat)
239    + konfigurierbar, ob Konstanten im Startblock, oder im aktuellen
240      ==> geht schlecht.
241    + von Hochsprachtypen loesen? Signed32 statt int?
242      ==> viel Arbeit, nur Namenskonvention.  Ev wenn target value modul
243          ausgetauscht.
244
245  + if_while_example ergibt Segmentation Fault da Bad Vorgaenger von Endblock.
246    Optimierung des end blocks geaendert.
247
248  + define Nodes for Rotate, Not, Minus, ShrA.  Extend irdump, verification.
249
250  + change impelmentation of type to use concept as in irnode.
251    Three common fields: kind, ident, mode !!! fill mode with
252    mode_none if applicable.
253
254  + add asserts in type.c that check that proper type is passed.
255    not in get_type_name, get_type_ident.
256
257  + type / entity not good, too much casts.
258    merge type_or_ent union with type union. ??!!
259    allocate always unions.
260    write access routines for type, e.g. get_type_name.
261    change access routines for individual types to select from union.
262
263  + Wann macht man Dispatch Tabellen.  Lower Phase
264
265  + integrate irgmod into ircons.  The routines in there are only needed
266    during ir construction.  (If there are some not needed, remove them.)
267
268  + Build more structured directoriy structure:
269    ir/ir                irgraph, irnode, irop, irmode, type, entity,
270                         common,
271    ir/manipulate        ircons, irgmod, irvrfy
272    ir/optimize          iropt, irflag
273    ir/datastructure     array, obst, pdeq, pset, set
274    ir/include           gmp, host, xfprintf, xgprintf, xmalloc,
275                         xoprintf, xp_help, xprintf
276    ir/compilermodules   ident, xx_ident, tv, ieee754
277    ir/aux               irdump, strerror,
278    where goes           debug, firm, label, mangle, misc, panic, tune?
279
280  + Changes to nodes:
281    - SymConst also returns pointer.
282    - Start returns pointer to segment for globals.
283    - remove copy, clear, type_or_ent
284    - add free
285    - add constructor for shrs
286    - remove Phi0 ruins
287
288  + How shall global variables be modeled in FIRM, if programs as C are
289    translated?  Modeling them as entity of the class defined for the
290    file/compilation unit is not sufficient, as then they are not
291    visible from out of this file.
292    For the uebprakt and kirmes we model them by selection from the
293    area that contains all globals (data segment).  The pointer to
294    this area is provided by the start node.
295    In Sather these were modeled by pointers to string constants containing
296    the name of the global variable (or static field):
297      new_Const (mode_p, tarval_p_from_str ("VAR_A"))
298
299  + port transform_node in iropt to lib.
300
301  + make new Version
302
303 ***************************************************************************
304
305  + add attributes from doku to constructors.
306
307  + add Phi_in stack as field to ir_graph??!!
308
309  + implement ShrA constructor.
310    What are allowed types?
311
312  + add type struct
313
314  + write dumper for type information.
315    write dumper for type and graph.
316    write dumper for control flow graph.
317
318  + dump irgraph with all the type information.  Write function that
319    dumps type information and one that dumps entities.  To integrate
320    this separate dump_node and the recursion, and add the dump_type
321    and dump_entity function in the recursive iterator or write second
322    dump routine.
323
324  + Fix bug in pset/set, so that several tables can be used. iropt/identify
325    aborts. Thanks, Boris!
326
327  + write example program with irreducible control flow:
328
329    /* Phi node with three predecessors: */
330       a = 1
331       if () goto loop
332       a = 2
333       goto loop
334    loop:
335       if () goto exit
336       b = 1
337       goto loop
338    exit:
339       b = a
340
341    /* irreducible two entry loop */
342       b = 1
343       if () goto entry1 else goto entry2
344    entry 1
345       a = 2
346       if () goto exit else goto entry 2
347    entry 2
348       a = 1
349       if () goto exit else goto entry 1
350    exit
351       b = a + b
352
353  + entity must be able to take arrays as owner.  Anything else?
354    --> assert allowed types.
355
356  + Alloc must be able to take any type as owner.  Also primitive types
357    so that allocation to the stack of dereferenced local variables can
358    be modeled.
359
360  + Implement vrfy_graph(end_node) that iterates over the whole graph
361   calling ir_vrfy so that the graph can be verified after each
362    optimization.
363
364  + DONE: Add access routines to ir_graph, ir_mode (?).