+double get_entity_estimated_n_loads(ir_entity *ent) {
+ int i, n_acc = get_entity_n_accesses(ent);
+ double n_loads = 0;
+ for (i = 0; i < n_acc; ++i) {
+ ir_node *acc = get_entity_access(ent, i);
+ if (is_Load(acc)) {
+ n_loads += get_irn_final_cost(acc);
+ }
+ }
+ return n_loads;
+}
+
+double get_entity_estimated_n_stores(ir_entity *ent) {
+ int i, n_acc = get_entity_n_accesses(ent);
+ double n_stores = 0;
+ for (i = 0; i < n_acc; ++i) {
+ ir_node *acc = get_entity_access(ent, i);
+ if (is_Store(acc))
+ n_stores += get_irn_final_cost(acc);
+ }
+ return n_stores;
+}
+
+/* @@@ Should we evaluate the callee array? */
+double get_entity_estimated_n_calls(ir_entity *ent) {
+ int i, n_acc = get_entity_n_accesses(ent);
+ double n_calls = 0;
+ for (i = 0; i < n_acc; ++i) {
+ ir_node *acc = get_entity_access(ent, i);
+ if (is_Call(acc))
+ n_calls += get_irn_final_cost(acc);
+ }
+ return n_calls;
+}
+
+double get_entity_estimated_n_dyncalls(ir_entity *ent) {
+ int i, n_acc = get_entity_n_accesses(ent);
+ double n_calls = 0;
+ for (i = 0; i < n_acc; ++i) {
+ ir_node *acc = get_entity_access(ent, i);
+
+ /* Call->Sel(ent) combination */
+ if (is_Call(acc) && is_Sel(get_Call_ptr(acc))) {
+ n_calls += get_irn_final_cost(acc);
+
+ /* MemOp->Sel combination for static, overwritten entities */
+ } else if (is_memop(acc) && is_Sel(get_memop_ptr(acc))) {
+ ir_entity *ent = get_Sel_entity(get_memop_ptr(acc));
+ if (is_Class_type(get_entity_owner(ent))) {
+ /* We might call this for inner entities in compounds. */
+ if (get_entity_n_overwrites(ent) > 0 ||
+ get_entity_n_overwrittenby(ent) > 0) {
+ n_calls += get_irn_final_cost(acc);
+ }
+ }
+ }
+
+ }
+ return n_calls;
+}
+
+#if 0
+/* Move this to the jack compiler */
+
+/* ------------------------------------------------------------------------- */
+/* Auxiliary */
+/* ------------------------------------------------------------------------- */
+
+int is_jack_rts_name(ident *name) {
+ if (id_is_suffix(new_id_from_str("Exception"), name)) return 1;
+ if (id_is_suffix(new_id_from_str("Throwable"), name)) return 1;
+ if (id_is_suffix(new_id_from_str("Error"), name)) return 1;
+
+ return 0;