@@ -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;
@@ -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 *);
@@ -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)
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 <luc.vanoostenryck@gmail.com> --- flow.c | 4 ++-- flow.h | 2 +- simplify.c | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-)