3 * File name: ir/ana/field_temperature.c
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 #include "field_temperature.h"
16 #include "irgraph_t.h"
23 /* *************************************************************************** */
24 /* initialize, global variables. */
25 /* *************************************************************************** */
28 /* *************************************************************************** */
29 /* Access routines for irnodes */
30 /* *************************************************************************** */
32 /* The entities that can be accessed by this Sel node. */
33 int get_Sel_n_accessed_entities(ir_node *sel) {
37 entity *get_Sel_accessed_entity(ir_node *sel, int pos) {
38 return get_Sel_entity(sel);
43 /* *************************************************************************** */
45 /* *************************************************************************** */
47 int get_irn_loop_call_depth(ir_node *n) {
48 ir_graph *irg = get_irn_irg(n);
49 return get_irg_loop_depth(irg);
52 int get_irn_loop_depth(ir_node *n) {
53 return get_loop_depth(get_irn_loop(get_nodes_block(n)));
56 int get_irn_recursion_depth(ir_node *n) {
57 ir_graph *irg = get_irn_irg(n);
58 return get_irg_recursion_depth(irg);
62 int get_weighted_loop_depth(ir_node *n) {
63 int loop_call_depth = get_irn_loop_call_depth(n);
64 int loop_depth = get_irn_loop_depth(n);
65 int recursion_depth = get_irn_recursion_depth(n);
67 return loop_call_depth + loop_depth + recursion_depth;
70 /* *************************************************************************** */
72 /* *************************************************************************** */
75 int is_jack_rts_class(type *t) {
76 ident *name = get_type_ident(t);
78 if (id_is_prefix(new_id_from_str("java/"), name)) return 1;
79 if (id_is_prefix(new_id_from_str("["), name)) return 1;
80 if (id_is_prefix(new_id_from_str("gnu/"), name)) return 1;
81 if (id_is_prefix(new_id_from_str("java/"), name)) return 1;