2007-10-07 Andreia Gaita <avidigal@novell.com>
[mono.git] / mono / mini / aliasing.c
index 02fbaf33d4eb45205d65e08ba64596e8ae128770..2e4af8f24ab5d723cdbc9c9ea6b50bbcdab3443a 100644 (file)
@@ -199,7 +199,7 @@ print_tree_node (MonoInst *tree) {
        case OP_LOADI2_MEMBASE:
                printf ("[%s] <- [%s + 0x%x]", mono_arch_regname (tree->dreg), mono_arch_regname (tree->inst_basereg), (int)tree->inst_offset);
                break;
-       case CEE_BR:
+       case OP_BR:
        case OP_CALL_HANDLER:
                printf ("[B%d]", tree->inst_target_bb->block_num);
                break;
@@ -649,9 +649,21 @@ update_aliasing_information_on_inst (MonoAliasingInformation *info, MonoAliasing
        } else {
                MonoAliasType father_type = MONO_ALIASING_TYPE_NO_ALIAS;
                if ((context.subtree_aliases [0].type == MONO_ALIASING_TYPE_LOCAL) || (context.subtree_aliases [0].type == MONO_ALIASING_TYPE_LOCAL_FIELD)) {
+                       MonoAliasUsageInformation *use = mono_mempool_alloc (info->mempool, sizeof (MonoAliasUsageInformation));
+                       
+                       inst->ssa_op = MONO_SSA_INDIRECT_LOAD_STORE;
+                       use->inst = inst;
+                       use->affected_variables = &(info->variables [context.subtree_aliases [0].variable_index]);
+                       APPEND_USE (info, bb_info, use);
                        ADD_BAD_ALIAS (info, context.subtree_aliases [0].variable_index);
                }
                if ((context.subtree_aliases [1].type == MONO_ALIASING_TYPE_LOCAL) || (context.subtree_aliases [1].type == MONO_ALIASING_TYPE_LOCAL_FIELD)) {
+                       MonoAliasUsageInformation *use = mono_mempool_alloc (info->mempool, sizeof (MonoAliasUsageInformation));
+                       
+                       inst->ssa_op = MONO_SSA_INDIRECT_LOAD_STORE;
+                       use->inst = inst;
+                       use->affected_variables = &(info->variables [context.subtree_aliases [1].variable_index]);
+                       APPEND_USE (info, bb_info, use);
                        ADD_BAD_ALIAS (info, context.subtree_aliases [1].variable_index);
                }
                if (father_alias != NULL) { 
@@ -814,6 +826,7 @@ mono_aliasing_get_affected_variables_for_inst_traversing_code (MonoAliasingInfor
        }
 }
 
+#if 0
 static MonoLocalVariableList*
 mono_aliasing_get_affected_variables_for_inst_in_bb (MonoAliasingInformation *info, MonoInst *inst, MonoBasicBlock *bb) {
        MonoAliasUsageInformation *use;
@@ -826,6 +839,7 @@ mono_aliasing_get_affected_variables_for_inst_in_bb (MonoAliasingInformation *in
        g_assert_not_reached ();
        return NULL;
 }
+#endif
 
 MonoLocalVariableList*
 mono_aliasing_get_affected_variables_for_inst (MonoAliasingInformation *info, MonoInst *inst) {
@@ -884,10 +898,17 @@ mono_aliasing_deadce_on_inst (MonoAliasingInformation *info, MonoInst **possibly
        
        arity = mono_burg_arity [inst->opcode];
        
-       if (OP_IS_CALL (inst->opcode)) {
-               has_side_effects = TRUE;
-       } else {
+       switch (inst->opcode) {
+#define OPDEF(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10) case a1:
+#include "simple-cee-ops.h"
+#undef OPDEF
+#define MINI_OP(a1,a2) case a1:
+#include "simple-mini-ops.h"
+#undef MINI_OP
                has_side_effects = FALSE;
+               break;
+       default:
+               has_side_effects = TRUE;
        }
        
        if (arity) {
@@ -923,7 +944,7 @@ mono_aliasing_deadce_on_inst (MonoAliasingInformation *info, MonoInst **possibly
                                                printf ("KILLING slot %d at inst ", affected_variable->variable_index);
                                                mono_print_tree_nl (inst);
                                        }
-                                       possibly_dead_assignments [affected_variable->variable_index]->opcode = CEE_NOP;
+                                       possibly_dead_assignments [affected_variable->variable_index]->opcode = OP_NOP;
                                        possibly_dead_assignments [affected_variable->variable_index]->ssa_op = MONO_SSA_NOP;
                                        possibly_dead_assignments [affected_variable->variable_index] = NULL;
                                }
@@ -986,7 +1007,7 @@ mono_aliasing_deadce (MonoAliasingInformation *info) {
                
                for (inst = bb->code; inst != NULL; inst = inst->next) {
                        mono_aliasing_deadce_on_inst (info, possibly_dead_assignments, inst);
-                       if (inst->opcode == CEE_JMP) {
+                       if (inst->opcode == OP_JMP) {
                                /* Keep arguments live! */
                                for (variable_index = 0; variable_index < cfg->num_varinfo; variable_index++) {
                                        if (cfg->varinfo [variable_index]->opcode == OP_ARG) {
@@ -1009,7 +1030,7 @@ mono_aliasing_deadce (MonoAliasingInformation *info) {
                                
                                //printf ("FAST DEADCE DEAD LOCAL\n");
                                
-                               possibly_dead_assignments [variable_index]->opcode = CEE_NOP;
+                               possibly_dead_assignments [variable_index]->opcode = OP_NOP;
                                possibly_dead_assignments [variable_index]->ssa_op = MONO_SSA_NOP;
                        }
                }