delete some unused code
authoryu.dongliang <18588496441@163.com>
Sat, 30 Dec 2023 14:46:48 +0000 (22:46 +0800)
committeryu.dongliang <18588496441@163.com>
Sat, 30 Dec 2023 14:46:48 +0000 (22:46 +0800)
core/scf_3ac.c
core/scf_optimizer_basic_block.c
core/scf_optimizer_group.c
core/scf_optimizer_loop.c
core/scf_pointer_alias.c

index edc8cca2ba368b5f90a64143639ca50248878c2d..e15270cea4f9409788c09fc48069636e5f08404e 100644 (file)
@@ -635,12 +635,15 @@ static int _3ac_code_to_dag(scf_3ac_code_t* c, scf_list_t* dag, int nb_operands0
 
 int scf_3ac_code_to_dag(scf_3ac_code_t* c, scf_list_t* dag)
 {
+       scf_3ac_operand_t* src;
+       scf_3ac_operand_t* dst;
+
        int ret = 0;
 
        if (scf_type_is_assign(c->op->type)) {
 
-               scf_3ac_operand_t* src = c->srcs->data[0];
-               scf_3ac_operand_t* dst = c->dsts->data[0];
+               src = c->srcs->data[0];
+               dst = c->dsts->data[0];
 
                ret = scf_dag_get_node(dag, src->node, &src->dag_node);
                if (ret < 0)
@@ -688,7 +691,6 @@ int scf_3ac_code_to_dag(scf_3ac_code_t* c, scf_list_t* dag)
                        || scf_type_is_assign_dereference(c->op->type)
                        || scf_type_is_assign_pointer(c->op->type)) {
 
-               scf_3ac_operand_t* src;
                scf_dag_node_t*    assign;
 
                assert(c->srcs);
@@ -714,7 +716,6 @@ int scf_3ac_code_to_dag(scf_3ac_code_t* c, scf_list_t* dag)
        } else if (SCF_OP_3AC_CMP == c->op->type
                        || SCF_OP_3AC_TEQ == c->op->type) {
 
-               scf_3ac_operand_t* src;
                scf_dag_node_t*    dn_cmp = scf_dag_node_alloc(c->op->type, NULL, NULL);
 
                scf_list_add_tail(dag, &dn_cmp->list);
@@ -741,8 +742,7 @@ int scf_3ac_code_to_dag(scf_3ac_code_t* c, scf_list_t* dag)
                        || SCF_OP_3AC_SETGE == c->op->type) {
 
                assert(c->dsts && 1 == c->dsts->size);
-
-               scf_3ac_operand_t* dst      = c->dsts->data[0];
+               dst = c->dsts->data[0];
 
                scf_dag_node_t*    dn_setcc = scf_dag_node_alloc(c->op->type, NULL, NULL);
                scf_list_add_tail(dag, &dn_setcc->list);
@@ -762,11 +762,11 @@ int scf_3ac_code_to_dag(scf_3ac_code_t* c, scf_list_t* dag)
                        || SCF_OP_3AC_INC  == c->op->type
                        || SCF_OP_3AC_DEC  == c->op->type) {
 
-               scf_3ac_operand_t* src = c->srcs->data[0];
+               src = c->srcs->data[0];
 
                assert(src->node->parent);
-               scf_variable_t*    var_parent = _scf_operand_get(src->node->parent);
-               scf_dag_node_t*    dn_parent  = scf_dag_node_alloc(c->op->type, var_parent, NULL);
+               scf_variable_t*    v_parent = _scf_operand_get(src->node->parent);
+               scf_dag_node_t*    dn_parent  = scf_dag_node_alloc(c->op->type, v_parent, NULL);
                scf_list_add_tail(dag, &dn_parent->list);
 
                ret = scf_dag_get_node(dag, src->node, &src->dag_node);
@@ -778,14 +778,13 @@ int scf_3ac_code_to_dag(scf_3ac_code_t* c, scf_list_t* dag)
                        return ret;
 
                if (c->dsts) {
-                       scf_3ac_operand_t* dst = c->dsts->data[0];
+                       dst = c->dsts->data[0];
                        assert(dst->node);
                        dst->dag_node = dn_parent;
                }
        } else if (SCF_OP_RETURN == c->op->type) {
 
                if (c->srcs) {
-                       scf_3ac_operand_t* src;
                        scf_dag_node_t*    dn_return = scf_dag_node_alloc(c->op->type, NULL, NULL);
 
                        scf_list_add_tail(dag, &dn_return->list);
@@ -812,11 +811,11 @@ int scf_3ac_code_to_dag(scf_3ac_code_t* c, scf_list_t* dag)
                int nb_operands1   = -1;
 
                if (c->dsts) {
-                       scf_3ac_operand_t* dst0 = c->dsts->data[0];
+                       dst = c->dsts->data[0];
 
-                       assert(dst0->node->op);
+                       assert(dst->node->op);
 
-                       nb_operands0 = dst0->node->op->nb_operands;
+                       nb_operands0 = dst->node->op->nb_operands;
                        nb_operands1 = nb_operands0;
 
                        switch (c->op->type) {
index 66ad72e11dcdac66b2806e55d15b13ac570c2d73..d2d99c365a61c1b1d2585aa07076378fc59fee48 100644 (file)
@@ -138,15 +138,11 @@ static int _bb_dag_update(scf_basic_block_t* bb)
 static int __optimize_basic_block(scf_basic_block_t* bb, scf_function_t* f)
 {
        scf_3ac_operand_t* src;
-       scf_3ac_operand_t* src2;
        scf_3ac_operand_t* dst;
-       scf_3ac_operand_t* dst2;
        scf_dag_node_t*    dn;
        scf_3ac_code_t*    c;
-       scf_3ac_code_t*    c2;
        scf_vector_t*      roots;
        scf_list_t*        l;
-       scf_list_t*        l2;
        scf_list_t         h;
 
        int ret;
@@ -218,13 +214,11 @@ static int __optimize_basic_block(scf_basic_block_t* bb, scf_function_t* f)
                c->basic_block = bb;
        }
 
-#if 1
        ret = scf_basic_block_active_vars(bb);
        if (ret < 0) {
                scf_loge("\n");
                return ret;
        }
-#endif
 
        scf_dag_node_free_list(&bb->dag_list_head);
        scf_vector_free(roots);
index 75f96984fb67b3114890db98d3025d1ba6f7a402..cc9f9ad54dc0512f338b4751119fac70976c7991 100644 (file)
@@ -4,7 +4,6 @@ int bbg_find_entry_exit(scf_bb_group_t* bbg)
 {
        scf_basic_block_t* bb;
        scf_basic_block_t* bb2;
-       scf_bb_group_t*    bbg2;
 
        int j;
        int k;
index 08d2e5f4fd3caf5f1c688db2a09338d7c2fd6cfa..387ce87c36ca2cc482e95f3197bc3da1ccf5c3a3 100644 (file)
@@ -3,10 +3,8 @@
 static int __bb_dfs_loop2(scf_basic_block_t* root, scf_vector_t* loop)
 {
        scf_basic_block_t* bb;
-       scf_bb_edge_t*     edge;
 
        int i;
-       int ret;
 
        assert(!root->jmp_flag);
 
@@ -19,7 +17,7 @@ static int __bb_dfs_loop2(scf_basic_block_t* root, scf_vector_t* loop)
                if (bb->visited_flag)
                        continue;
 
-               ret = scf_vector_add(loop, bb);
+               int ret = scf_vector_add(loop, bb);
                if ( ret < 0)
                        return ret;
 
index 1dcdc21f4513b91cd9bd3eb82489188ae42126b9..731c3bb5b067cf1748af5b8c353b45d5d54a3bac 100644 (file)
@@ -731,10 +731,6 @@ int _dn_status_alias_dereference(scf_vector_t* aliases, scf_dn_status_t* ds_poin
        scf_3ac_code_t*  c2;
        scf_list_t*      l2;
 
-       int count;
-       int ret;
-       int i;
-
        assert(ds_pointer);
        assert(ds_pointer->dag_node);