diff options
Diffstat (limited to 'src/analysis/disass/loop.c')
-rw-r--r-- | src/analysis/disass/loop.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/analysis/disass/loop.c b/src/analysis/disass/loop.c index d8ca355..b7e7ff9 100644 --- a/src/analysis/disass/loop.c +++ b/src/analysis/disass/loop.c @@ -49,9 +49,9 @@ static void detect_back_edges(dragon_node *nodes, size_t count) dragon_node *node; /* Noeud à traiter */ const bitfield_t *dominators; /* Liste de dominateurs */ GArchInstruction *last; /* Instruction finale de noeud */ - instr_link_t *dests; /* Instr. visées par une autre */ size_t dcount; /* Nombre de liens de dest. */ size_t i; /* Boucle de parcours #2 */ + instr_link_t *dest; /* Instr. visée par une autre */ dragon_node *target; /* Noeud référence à tester */ size_t id; /* Indice du bit associé */ @@ -63,11 +63,14 @@ static void detect_back_edges(dragon_node *nodes, size_t count) get_dragon_node_bounding_instructions(node, NULL, &last); - g_arch_instruction_wlock_dest(last); - dcount = g_arch_instruction_get_destinations(last, &dests); + g_arch_instruction_lock_dest(last); + dcount = g_arch_instruction_count_destinations(last); for (i = 0; i < dcount; i++) - switch (dests[i].type) + { + dest = g_arch_instruction_get_destination(last, i); + + switch (dest->type) { case ILT_EXEC_FLOW: case ILT_JUMP: @@ -75,7 +78,7 @@ static void detect_back_edges(dragon_node *nodes, size_t count) case ILT_JUMP_IF_TRUE: case ILT_JUMP_IF_FALSE: - target = find_node_for_instruction(nodes, count, false, dests[i].linked); + target = find_node_for_instruction(nodes, count, false, dest->linked); if (target == NULL) break; id = get_dragon_node_index(nodes, target); @@ -89,7 +92,7 @@ static void detect_back_edges(dragon_node *nodes, size_t count) (unsigned int)g_arch_instruction_get_range(dests[i])->addr.virtual); */ - /* status = */g_arch_instruction_change_link(last, dests[i].linked, dests[i].type, ILT_LOOP); + /* status = */g_arch_instruction_change_link(last, dest->linked, dest->type, ILT_LOOP); } @@ -101,7 +104,9 @@ static void detect_back_edges(dragon_node *nodes, size_t count) } - g_arch_instruction_wunlock_dest(last); + } + + g_arch_instruction_unlock_dest(last); } |