added ifdef around irloop type
[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 /** Return loop depth of node.
46  *
47  *  Returns the loop depth of n in the control flow.  I.e., we
48  *  go from the node to the block to the loop the block is in,
49  *  and return its depth.  */
50 int get_irn_cfloop_depth(ir_node *n);
51 int get_irn_recursion_depth(ir_node *n);
52
53 /** Get the weighted interprocedural loop depth of the node.
54     The depth is estimated by a heuristic. The heuristic consideres
55     loop and recursion depth. */
56 int get_weighted_loop_depth(ir_node *n);
57
58 /** Heuristic merging recursion and loop depth. */
59 double get_irn_final_cost(ir_node *n);
60
61 /** Get accumulated(really?) execution frequencies.
62  *  A heuristic weights the recursions. */
63 double get_type_estimated_n_instances(type *clss);
64 double get_type_estimated_mem_consumption_bytes(type *tp);
65 /** Estimates the size of an object.
66  *
67  *  The heuristic mainly affects array sizes.
68  *  Further this ignores padding for alignment, especially of small fields. */
69 int    get_type_estimated_size_bytes(type *tp);
70 /** Estimates the number of fields of a single Object.
71  *  The heuristic mainly affects array sizes.
72  *  @@@ Misses inherited fields! */
73 int    get_type_estimated_n_fields(type *tp);
74 double get_type_estimated_n_casts(type *clss);
75
76 double get_class_estimated_n_upcasts(type *clss);
77 double get_class_estimated_n_downcasts(type *clss);
78 /** Returns the number of accesses to the dispatch table.
79  *
80  *  This includes the initialization of the pointer field, and accesses
81  *  to virtual fields (as instance marker in Java).  Certainly this
82  *  includes virtual method calls. */
83 double get_class_estimated_n_dyncalls(type *clss);
84 /** Returns the number of writes to the dispatch pointer.
85  *  This is the same as the number of allocations. */
86 double get_class_estimated_dispatch_writes(type *clss);
87 /** Returns the number of reads of the dispatch pointer. */
88 double get_class_estimated_dispatch_reads (type *clss);
89
90 double get_entity_estimated_n_loads(entity *ent);
91 double get_entity_estimated_n_stores(entity *ent);
92 double get_entity_estimated_n_calls(entity *ent);
93 /** The number of accesses to dynamically called methods and
94  *  to other static fields that overwrite/are overwritten. */
95 double get_entity_estimated_n_dyncalls(entity *ent);
96
97 /* ------------------------------------------------------------------------- */
98 /* Accumulate information in the type hierarchy.                             */
99 /* ------------------------------------------------------------------------- */
100
101 typedef enum {
102   temperature_none,
103   temperature_consistent,
104   temperature_inconsistent
105 } irp_temperature_state;
106
107 /** An auxiliary/temporary function */
108 int is_jack_rts_class(type *t);
109 int is_jack_rts_entity(entity *e);
110
111 #endif /* _FIELD_TEMPERATURE_H_ */