Cleaned up, removed global File handle
[libfirm] / ir / ir / irgopt.c
index 733fe7d..9b6e70e 100644 (file)
@@ -691,7 +691,6 @@ int inline_method(ir_node *call, ir_graph *called_graph) {
   if ( (prop != irg_inline_forced) && (!get_opt_optimize() || !get_opt_inline() ||
                                        (prop == irg_inline_forbidden))) return 0;
 
-
   /*
    * currently, we cannot inline two cases:
    * - call with compound arguments
@@ -1064,8 +1063,10 @@ static ir_graph *get_call_called_irg(ir_node *call) {
   if (get_irn_op(addr) == op_Const) {
     /* Check whether the constant is the pointer to a compiled entity. */
     tv = get_Const_tarval(addr);
-    if (tarval_to_entity(tv))
-      called_irg = get_entity_irg(tarval_to_entity(tv));
+    if (get_tarval_entity(tv))
+      called_irg = get_entity_irg(get_tarval_entity(tv));
+  } else if (get_irn_op(addr) == op_SymConst && get_SymConst_kind(addr) == symconst_addr_ent) {
+    called_irg = get_entity_irg(get_SymConst_entity(addr));
   }
   return called_irg;
 }
@@ -1082,8 +1083,8 @@ static void collect_calls(ir_node *call, void *env) {
   if (get_irn_op(addr) == op_Const) {
     /* Check whether the constant is the pointer to a compiled entity. */
     tv = get_Const_tarval(addr);
-    if (tarval_to_entity(tv)) {
-      called_irg = get_entity_irg(tarval_to_entity(tv));
+    if (get_tarval_entity(tv)) {
+      called_irg = get_entity_irg(get_tarval_entity(tv));
       if (called_irg && ienv->pos < MAX_INLINE) {
         /* The Call node calls a locally defined method.  Remember to inline. */
         ienv->calls[ienv->pos++] = call;
@@ -1127,7 +1128,7 @@ void inline_small_irgs(ir_graph *irg, int size) {
       tarval *tv;
       ir_graph *callee;
       tv = get_Const_tarval(get_Call_ptr(env.calls[i]));
-      callee = get_entity_irg(tarval_to_entity(tv));
+      callee = get_entity_irg(get_tarval_entity(tv));
       if (((_obstack_memory_used(callee->obst) - obstack_room(callee->obst)) < size) ||
         (get_irg_inline_property(callee) == irg_inline_forced)) {
         inline_method(env.calls[i], callee);
@@ -1268,12 +1269,12 @@ void inline_leave_functions(int maxsize, int leavesize, int size) {
 /*         get_entity_name(get_irg_entity(callee))); */
           if (inline_method(call, callee)) {
             did_inline = 1;
-        env->n_call_nodes--;
-        eset_insert_all(env->call_nodes, callee_env->call_nodes);
-        env->n_call_nodes += callee_env->n_call_nodes;
-        env->n_nodes += callee_env->n_nodes;
-        callee_env->n_callers--;
-      }
+           env->n_call_nodes--;
+           eset_insert_all(env->call_nodes, callee_env->call_nodes);
+           env->n_call_nodes += callee_env->n_call_nodes;
+           env->n_nodes += callee_env->n_nodes;
+           callee_env->n_callers--;
+         }
         } else {
           eset_insert(env->call_nodes, call);
         }