From 4ac342d1efdbeda4c8cd3b79d53ae6b15f1f5cfc Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Sun, 14 Mar 2021 15:12:21 +0100 Subject: rename insert_branch() to convert_to_jump() Since the existing branch is now reused, nothing is inserted anymore. So, rename this function to the more explanatory: convert_to_jump(). Signed-off-by: Luc Van Oostenryck --- flow.c | 4 ++-- flow.h | 2 +- simplify.c | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/flow.c b/flow.c index 38e0ccad..8106cfc0 100644 --- a/flow.c +++ b/flow.c @@ -268,7 +268,7 @@ try_to_rewrite_target: */ if (bb_list_size(target->parents) != 1) return retval; - insert_branch(insn, final); + convert_to_jump(insn, final); return 1; } @@ -711,7 +711,7 @@ void vrfy_flow(struct entrypoint *ep) /// // change a switch or a conditional branch into a branch -int insert_branch(struct instruction *insn, struct basic_block *target) +int convert_to_jump(struct instruction *insn, struct basic_block *target) { struct basic_block *bb = insn->bb; struct basic_block *child; diff --git a/flow.h b/flow.h index cad1de77..2103a10f 100644 --- a/flow.h +++ b/flow.h @@ -18,7 +18,7 @@ extern void simplify_symbol_usage(struct entrypoint *ep); extern void simplify_memops(struct entrypoint *ep); extern void pack_basic_blocks(struct entrypoint *ep); extern int simplify_cfg_early(struct entrypoint *ep); -extern int insert_branch(struct instruction *insn, struct basic_block *target); +extern int convert_to_jump(struct instruction *insn, struct basic_block *target); extern void convert_instruction_target(struct instruction *insn, pseudo_t src); extern void remove_dead_insns(struct entrypoint *); diff --git a/simplify.c b/simplify.c index 0bc201e8..7171bd56 100644 --- a/simplify.c +++ b/simplify.c @@ -2441,7 +2441,7 @@ static int simplify_branch(struct instruction *insn) /* Constant conditional */ if (constant(cond)) - return insert_branch(insn, cond->value ? insn->bb_true : insn->bb_false); + return convert_to_jump(insn, cond->value ? insn->bb_true : insn->bb_false); /* Same target? */ if (insn->bb_true == insn->bb_false) { @@ -2471,9 +2471,9 @@ static int simplify_branch(struct instruction *insn) long long val1 = def->src2->value; long long val2 = def->src3->value; if (!val1 && !val2) - return insert_branch(insn, insn->bb_false); + return convert_to_jump(insn, insn->bb_false); if (val1 && val2) - return insert_branch(insn, insn->bb_true); + return convert_to_jump(insn, insn->bb_true); if (val2) { struct basic_block *tmp = insn->bb_true; insn->bb_true = insn->bb_false; @@ -2509,7 +2509,7 @@ static int simplify_switch(struct instruction *insn) return 0; found: - return insert_branch(insn, jmp->target); + return convert_to_jump(insn, jmp->target); } static struct basic_block *is_label(pseudo_t pseudo) -- cgit 1.2.3-korg