bugfix, removed dead code
[libfirm] / ir / ana / field_temperature.c
1 /*
2  * Project:     libFIRM
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
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 #include "field_temperature.h"
14
15 #include "irnode_t.h"
16 #include "irgraph_t.h"
17 #include "irprog_t.h"
18 #include "entity_t.h"
19 #include "irgwalk.h"
20
21 #include "array.h"
22
23 /* *************************************************************************** */
24 /* initialize, global variables.                                               */
25 /* *************************************************************************** */
26
27
28 /* *************************************************************************** */
29 /*   Access routines for irnodes                                               */
30 /* *************************************************************************** */
31
32 /* The entities that can be accessed by this Sel node. */
33 int get_Sel_n_accessed_entities(ir_node *sel) {
34   return 1;
35 }
36
37 entity *get_Sel_accessed_entity(ir_node *sel, int pos) {
38   return get_Sel_entity(sel);
39 }
40
41
42
43 /* *************************************************************************** */
44 /* The heuristic                                                               */
45 /* *************************************************************************** */
46
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);
50 }
51
52 int get_irn_loop_depth(ir_node *n) {
53   return get_loop_depth(get_irn_loop(get_nodes_block(n)));
54 }
55
56 int get_irn_recursion_depth(ir_node *n) {
57   ir_graph *irg = get_irn_irg(n);
58   return get_irg_recursion_depth(irg);
59 }
60
61
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);
66
67   return loop_call_depth + loop_depth + recursion_depth;
68 }
69
70 /* *************************************************************************** */
71 /* Auxiliary                                                                   */
72 /* *************************************************************************** */
73
74
75 int is_jack_rts_class(type *t) {
76   ident *name = get_type_ident(t);
77
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;
82
83   return 0;
84 }