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
9 * Copyright: (c) 2004 Universität Karlsruhe
10 * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE.
13 #ifndef _FIELD_TEMPERATURE_H_
14 #define _FIELD_TEMPERATURE_H_
17 * @file field_temperature.h
19 * @author Goetz Lindenmaier
21 * Watch it! This is highly java dependent.
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.)
27 * - We compute a value for the entity based on the Sel nodes.
35 /* The number of array elements we assume if not both bounds are given. */
36 #define DEFAULT_N_ARRAY_ELEMENTS 1
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);
45 /** Get the weighted interprocedural loop depth of the node.
46 The depth is estimated by a heuristic. The heuristic consideres
47 loop and recursion depth. */
48 int get_weighted_loop_depth(ir_node *n);
50 /** Heuristic merging recursion and loop depth. */
51 double get_irn_final_cost(ir_node *n);
53 /** Get accumulated(really?) execution frequencies.
54 * A heuristic weights the recursions. */
55 double get_type_estimated_n_instances(type *clss);
56 double get_type_estimated_mem_consumption_bytes(type *tp);
57 /** Estimates the size of an object.
59 * The heuristic mainly affects array sizes.
60 * Further this ignores padding for alignment, especially of small fields. */
61 int get_type_estimated_size_bytes(type *tp);
62 /** Estimates the number of fields of a single Object.
63 * The heuristic mainly affects array sizes.
64 * @@@ Misses inherited fields! */
65 int get_type_estimated_n_fields(type *tp);
66 double get_type_estimated_n_casts(type *clss);
68 double get_class_estimated_n_upcasts(type *clss);
69 double get_class_estimated_n_downcasts(type *clss);
70 /** Returns the number of accesses to the dispatch table.
72 * This includes the initialization of the pointer field, and accesses
73 * to virtual fields (as instance marker in Java). Certainly this
74 * includes virtual method calls. */
75 double get_class_estimated_n_dyncalls(type *clss);
76 /** Returns the number of writes to the dispatch pointer.
77 * This is the same as the number of allocations. */
78 double get_class_estimated_dispatch_writes(type *clss);
79 /** Returns the number of reads of the dispatch pointer. */
80 double get_class_estimated_dispatch_reads (type *clss);
82 double get_entity_estimated_n_loads(entity *ent);
83 double get_entity_estimated_n_stores(entity *ent);
84 double get_entity_estimated_n_calls(entity *ent);
85 /** The number of accesses to dynamically called methods and
86 * to other static fields that overwrite/are overwritten. */
87 double get_entity_estimated_n_dyncalls(entity *ent);
89 /* ------------------------------------------------------------------------- */
90 /* Accumulate information in the type hierarchy. */
91 /* ------------------------------------------------------------------------- */
95 temperature_consistent,
96 temperature_inconsistent
97 } irp_temperature_state;
99 /** An auxiliary/temporary function */
100 int is_jack_rts_class(type *t);
101 int is_jack_rts_entity(entity *e);
103 #endif /* _FIELD_TEMPERATURE_H_ */