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);
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);
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);
53 /** Heuristic merging recursion and loop depth. */
54 double get_irn_final_cost(ir_node *n);
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.
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);
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.
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);
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);
92 /* ------------------------------------------------------------------------- */
93 /* Accumulate information in the type hierarchy. */
94 /* ------------------------------------------------------------------------- */
98 temperature_consistent,
99 temperature_inconsistent
100 } irp_temperature_state;
102 /** An auxiliary/temporary function */
103 int is_jack_rts_class(type *t);
104 int is_jack_rts_entity(entity *e);
106 #endif /* _FIELD_TEMPERATURE_H_ */