From 81c6fed4d833f67749abace512dd7f8f372b1369 Mon Sep 17 00:00:00 2001 From: "yu.dongliang" <18588496441@163.com> Date: Sat, 30 Dec 2023 22:46:48 +0800 Subject: [PATCH] delete some unused code --- core/scf_3ac.c | 27 +++++++++++++-------------- core/scf_optimizer_basic_block.c | 6 ------ core/scf_optimizer_group.c | 1 - core/scf_optimizer_loop.c | 4 +--- core/scf_pointer_alias.c | 4 ---- 5 files changed, 14 insertions(+), 28 deletions(-) diff --git a/core/scf_3ac.c b/core/scf_3ac.c index edc8cca..e15270c 100644 --- a/core/scf_3ac.c +++ b/core/scf_3ac.c @@ -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) { diff --git a/core/scf_optimizer_basic_block.c b/core/scf_optimizer_basic_block.c index 66ad72e..d2d99c3 100644 --- a/core/scf_optimizer_basic_block.c +++ b/core/scf_optimizer_basic_block.c @@ -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); diff --git a/core/scf_optimizer_group.c b/core/scf_optimizer_group.c index 75f9698..cc9f9ad 100644 --- a/core/scf_optimizer_group.c +++ b/core/scf_optimizer_group.c @@ -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; diff --git a/core/scf_optimizer_loop.c b/core/scf_optimizer_loop.c index 08d2e5f..387ce87 100644 --- a/core/scf_optimizer_loop.c +++ b/core/scf_optimizer_loop.c @@ -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; diff --git a/core/scf_pointer_alias.c b/core/scf_pointer_alias.c index 1dcdc21..731c3bb 100644 --- a/core/scf_pointer_alias.c +++ b/core/scf_pointer_alias.c @@ -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); -- 2.25.1