properly mark symbols in the public API to be exported. This allows us to use -fvisib...
[libfirm] / include / libfirm / field_temperature.h
1 /*
2  * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
6  * This file may be distributed and/or modified under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation and appearing in the file LICENSE.GPL included in the
9  * packaging of this file.
10  *
11  * Licensees holding valid libFirm Professional Edition licenses may use
12  * this file in accordance with the libFirm Commercial License.
13  * Agreement provided with the Software.
14  *
15  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief    Compute an estimate of field temperature, i.e., field access heuristic.
23  * @author   Goetz Lindenmaier
24  * @date     21.7.2004
25  * @version  $Id$
26  * @note
27  *  Watch it! This is highly java dependent.
28  *
29  * - All Sel nodes get an array with possibly accessed entities.
30  *   (resolve polymorphy on base of inherited entities.)
31  *   (the mentioned entity in first approximation.)
32  *
33  * - We compute a value for the entity based on the Sel nodes.
34  */
35 #ifndef FIRM_ANA_FIELD_TEMPERATURE_H
36 #define FIRM_ANA_FIELD_TEMPERATURE_H
37
38 #include "firm_types.h"
39
40 #include "begin.h"
41
42 /* The number of array elements we assume if not both bounds are given. */
43 #define DEFAULT_N_ARRAY_ELEMENTS 1
44
45 FIRM_DLL int get_irn_loop_call_depth(ir_node *n);
46 /** Return loop depth of node.
47  *
48  *  Returns the loop depth of n in the control flow.  I.e., we
49  *  go from the node to the block to the loop the block is in,
50  *  and return its depth.  */
51 FIRM_DLL int get_irn_cfloop_depth(ir_node *n);
52 FIRM_DLL int get_irn_recursion_depth(ir_node *n);
53
54 /** Get the weighted interprocedural loop depth of the node.
55     The depth is estimated by a heuristic. The heuristic considers
56     loop and recursion depth. */
57 FIRM_DLL int get_weighted_loop_depth(ir_node *n);
58
59 /** Heuristic merging recursion and loop depth. */
60 FIRM_DLL double get_irn_final_cost(ir_node *n);
61
62 /** Get accumulated(really?) execution frequencies.
63  *  A heuristic weights the recursions. */
64 FIRM_DLL double get_type_estimated_n_instances(ir_type *clss);
65 FIRM_DLL double get_type_estimated_mem_consumption_bytes(ir_type *tp);
66
67 /** Estimates the size of an object.
68  *
69  *  The heuristic mainly affects array sizes.
70  *  Further this ignores padding for alignment, especially of small fields. */
71 FIRM_DLL int get_type_estimated_size_bytes(ir_type *tp);
72 /** Estimates the number of fields of a single Object.
73  *  The heuristic mainly affects array sizes.
74  *  @@@ Misses inherited fields! */
75 FIRM_DLL int get_type_estimated_n_fields(ir_type *tp);
76 FIRM_DLL double get_type_estimated_n_casts(ir_type *clss);
77
78 FIRM_DLL double get_class_estimated_n_upcasts(ir_type *clss);
79 FIRM_DLL double get_class_estimated_n_downcasts(ir_type *clss);
80
81 /** Returns the number of accesses to the dispatch table.
82  *
83  *  This includes the initialization of the pointer field, and accesses
84  *  to virtual fields (as instance marker in Java).  Certainly this
85  *  includes virtual method calls. */
86 FIRM_DLL double get_class_estimated_n_dyncalls(ir_type *clss);
87 /** Returns the number of writes to the dispatch pointer.
88  *  This is the same as the number of allocations. */
89 FIRM_DLL double get_class_estimated_dispatch_writes(ir_type *clss);
90 /** Returns the number of reads of the dispatch pointer. */
91 FIRM_DLL double get_class_estimated_dispatch_reads (ir_type *clss);
92
93 FIRM_DLL double get_entity_estimated_n_loads(ir_entity *ent);
94 FIRM_DLL double get_entity_estimated_n_stores(ir_entity *ent);
95 FIRM_DLL double get_entity_estimated_n_calls(ir_entity *ent);
96 /** The number of accesses to dynamically called methods and
97  *  to other static fields that overwrite/are overwritten. */
98 FIRM_DLL double get_entity_estimated_n_dyncalls(ir_entity *ent);
99
100 /* ------------------------------------------------------------------------- */
101 /* Accumulate information in the type hierarchy.                             */
102 /* ------------------------------------------------------------------------- */
103
104 typedef enum {
105   temperature_none,
106   temperature_consistent,
107   temperature_inconsistent
108 } irp_temperature_state;
109
110 #include "end.h"
111
112 #endif