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