added some needed prototypes
[libfirm] / ir / ana / field_temperature.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/ana/field_temperature.h
4  * Purpose:     Compute an estimate of field temperature, i.e., field access heuristic.
5  * Author:      Goetz Lindenmaier
6  * Modified by:
7  * Created:     21.7.2004
8  * CVS-ID:      $Id$
9  * Copyright:   (c) 2004 Universität Karlsruhe
10  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
11  */
12
13 #ifndef _FIELD_TEMPERATURE_H_
14 #define _FIELD_TEMPERATURE_H_
15
16 /**
17  * @file field_temperature.h
18  *
19  *  @author Goetz Lindenmaier
20  *
21  *  Watch it! This is highly java dependent.
22  *
23  * - All Sel nodes get an array with possibly accessed entities.
24  *   (resolve polymorphy on base of inherited entities.)
25  *   (the mentioned entity in first approximation.)
26  *
27  * - We compute a value for the entity based on the Sel nodes.
28  */
29
30 #include "irnode.h"
31 #include "entity.h"
32 #include "type.h"
33
34
35 /* The number of array elements we assume if not both bounds are given. */
36 #define DEFAULT_N_ARRAY_ELEMENTS 1
37
38
39 /** The entities that can be accessed by this Sel node. *
40 int     get_Sel_n_accessed_entities(ir_node *sel);
41 entity *get_Sel_accessed_entity    (ir_node *sel, int pos);
42 */
43
44 int get_irn_loop_call_depth(ir_node *n);
45 int get_irn_loop_depth(ir_node *n);
46 int get_irn_recursion_depth(ir_node *n);
47
48 /** Get the weighted interprocedural loop depth of the node.
49     The depth is estimated by a heuristic. The heuristic consideres
50     loop and recursion depth. */
51 int get_weighted_loop_depth(ir_node *n);
52
53 /** Heuristic merging recursion and loop depth. */
54 double get_irn_final_cost(ir_node *n);
55
56 /** Get accumulated(really?) execution frequencies.
57  *  A heuristic weights the recursions. */
58 double get_type_estimated_n_instances(type *clss);
59 double get_type_estimated_mem_consumption_bytes(type *tp);
60 /** Estimates the size of an object.
61  *
62  *  The heuristic mainly affects array sizes.
63  *  Further this ignores padding for alignment, especially of small fields. */
64 int    get_type_estimated_size_bytes(type *tp);
65 /** Estimates the number of fields of a single Object.
66  *  The heuristic mainly affects array sizes.
67  *  @@@ Misses inherited fields! */
68 int    get_type_estimated_n_fields(type *tp);
69 double get_type_estimated_n_casts(type *clss);
70
71 double get_class_estimated_n_upcasts(type *clss);
72 double get_class_estimated_n_downcasts(type *clss);
73 /** Returns the number of accesses to the dispatch table.
74  *
75  *  This includes the initialization of the pointer field, and accesses
76  *  to virtual fields (as instance marker in Java).  Certainly this
77  *  includes virtual method calls. */
78 double get_class_estimated_n_dyncalls(type *clss);
79 /** Returns the number of writes to the dispatch pointer.
80  *  This is the same as the number of allocations. */
81 double get_class_estimated_dispatch_writes(type *clss);
82 /** Returns the number of reads of the dispatch pointer. */
83 double get_class_estimated_dispatch_reads (type *clss);
84
85 double get_entity_estimated_n_loads(entity *ent);
86 double get_entity_estimated_n_stores(entity *ent);
87 double get_entity_estimated_n_calls(entity *ent);
88 /** The number of accesses to dynamically called methods and
89  *  to other static fields that overwrite/are overwritten. */
90 double get_entity_estimated_n_dyncalls(entity *ent);
91
92 /* ------------------------------------------------------------------------- */
93 /* Accumulate information in the type hierarchy.                             */
94 /* ------------------------------------------------------------------------- */
95
96 typedef enum {
97   temperature_none,
98   temperature_consistent,
99   temperature_inconsistent
100 } irp_temperature_state;
101
102 /** An auxiliary/temporary function */
103 int is_jack_rts_class(type *t);
104 int is_jack_rts_entity(entity *e);
105
106 #endif /* _FIELD_TEMPERATURE_H_ */