more...
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Sat, 25 Sep 2004 11:24:55 +0000 (11:24 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Sat, 25 Sep 2004 11:24:55 +0000 (11:24 +0000)
[r3954]

ir/ana/field_temperature.c
ir/ana/field_temperature.h

index cc4140e..9afc3e6 100644 (file)
@@ -67,9 +67,44 @@ void set_entity_access(entity *ent, int pos, ir_node *n) {
 
 
 /* *************************************************************************** */
-/*   Access routines for nodes                                                 */
+/*   Access routines for types                                                 */
 /* *************************************************************************** */
 
+/** Number of Alloc nodes that create an instance of this type */
+int get_type_n_allocations(type *tp) {
+  assert(tp && is_type(tp));
+
+  if (!tp->allocations) { tp->allocations = NEW_ARR_F(ir_node *, 0); }
+
+  return ARR_LEN(tp->allocations);
+}
+
+/** Alloc node that create an instance of this type */
+ir_node *get_type_allocation(type *tp, int pos) {
+  assert(0 <= pos && pos < get_type_n_allocations(tp));
+
+  return tp->allocations[pos];
+}
+
+void add_type_allocation(type *tp, ir_node *n) {
+  assert(tp && is_type(tp));
+  assert(n && is_ir_node(n));
+
+  if (!tp->allocations) tp->allocations = NEW_ARR_F(ir_node *, 0);
+
+  ARR_APP1(ir_node *, tp->allocations, n);
+}
+
+void set_type_allocation(type *tp, int pos, ir_node *n) {
+  assert(0 <= pos && pos < get_type_n_allocations(tp));
+  assert(n && is_ir_node(n));
+
+  tp->allocations[pos] = n;
+}
+
+
+
+
 /* *************************************************************************** */
 /*   Access routines for irnodes                                               */
 /* *************************************************************************** */
@@ -170,6 +205,11 @@ void chain_accesses(ir_node *n, void *env) {
   int i, n_ents;
   ir_node *addr;
 
+  if (get_irn_op(n) == op_Alloc) {
+    add_type_allocation(get_Alloc_type(n), n);
+    return;
+  }
+
   if (is_memop(n)) {
     addr = get_memop_ptr(n);
   } else {
index 4439768..3cfc7ba 100644 (file)
@@ -32,6 +32,7 @@
 #include "entity.h"
 
 
+
 /** The entities that can be accessed by this Sel node. */
 int     get_Sel_n_accessed_entities(ir_node *sel);
 entity *get_Sel_accessed_entity    (ir_node *sel, int pos);
@@ -39,12 +40,22 @@ entity *get_Sel_accessed_entity    (ir_node *sel, int pos);
 
 /** Number of Load/Store nodes that possibly access this entity. */
 int get_entity_n_accesses(entity *ent);
-
 /** Load/Store node that possibly access this entity. */
 ir_node *get_entity_access(entity *ent, int pos);
 
+/** Number of Alloc nodes that create an instance of this type */
+int get_type_n_allocations(type *tp);
+/** Alloc node that create an instance of this type */
+ir_node *get_type_allocation(type *tp, int pos);
+
+
+/** Get the weighted interprocedural loop depth of the node.
+    The depth is estimated by a heuristic. */
 int get_weighted_loop_depth(ir_node *n);
 
+
+
+
 /** compute the field temperature. */
 void compute_field_temperature(void);