summaryrefslogtreecommitdiff
path: root/src/analysis/disass/rank.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-04-13 16:34:34 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-04-13 16:34:34 (GMT)
commit6906aa19b7ac4c14615c30d15bfb26b0b86557d5 (patch)
treef0fb0b6ea116e4ec87f33b3b4198f6dc4c88766c /src/analysis/disass/rank.c
parentacc7b5f33e93bae3bf43e8f029976b7f74260b52 (diff)
Simplified the way links between instructions are handled.
Diffstat (limited to 'src/analysis/disass/rank.c')
-rw-r--r--src/analysis/disass/rank.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/analysis/disass/rank.c b/src/analysis/disass/rank.c
index 3f4cd9f..6ff194b 100644
--- a/src/analysis/disass/rank.c
+++ b/src/analysis/disass/rank.c
@@ -61,9 +61,9 @@ static bool rank_flow_block(GFlowBlock *block, BlockVisitOrder order, const GIns
unsigned int next; /* Rang suivant obtenu */
GInstrBlock *links; /* Blocs liés au bloc courant */
GArchInstruction *last; /* Dernière instruction du bloc*/
- instr_link_t *dests; /* Instr. visées par une autre */
size_t dcount; /* Nombre de liens de dest. */
size_t i; /* Boucle de parcours */
+ instr_link_t *dest; /* Instr. visée par une autre */
const mrange_t *range; /* Emplacement d'une cible */
GFlowBlock *target; /* Bloc ciblé par un lien */
unsigned int rank; /* Rang à constituer */
@@ -77,14 +77,16 @@ static bool rank_flow_block(GFlowBlock *block, BlockVisitOrder order, const GIns
g_flow_block_get_boundary(block, NULL, &last);
- g_arch_instruction_rlock_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++)
{
- range = g_arch_instruction_get_range(dests[i].linked);
+ dest = g_arch_instruction_get_destination(last, i);
- switch (dests[i].type)
+ range = g_arch_instruction_get_range(dest->linked);
+
+ switch (dest->type)
{
case ILT_EXEC_FLOW:
case ILT_CATCH_EXCEPTION:
@@ -175,7 +177,7 @@ static bool rank_flow_block(GFlowBlock *block, BlockVisitOrder order, const GIns
}
- g_arch_instruction_runlock_dest(last);
+ g_arch_instruction_unlock_dest(last);
return true;
@@ -304,9 +306,9 @@ void rank_routine_block(const GBlockList *list, GBasicBlock *block)
{
unsigned int next; /* Rang suivant obtenu */
GArchInstruction *last; /* Dernière instruction du bloc*/
- instr_link_t *dests; /* Instr. visées par une autre */
size_t dcount; /* Nombre de liens de dest. */
size_t i; /* Boucle de parcours */
+ instr_link_t *dest; /* Instr. visée par une autre */
InstructionLinkType type; /* Raccourci pour confort */
GBasicBlock *target; /* Bloc ciblé par un lien */
unsigned int rank; /* Rang à constituer */
@@ -315,12 +317,14 @@ void rank_routine_block(const GBlockList *list, GBasicBlock *block)
g_basic_block_get_boundary(block, NULL, &last);
- g_arch_instruction_rlock_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++)
{
- type = dests[i].type;
+ dest = g_arch_instruction_get_destination(last, i);
+
+ type = dest->type;
/* La boucle de remontée n'abaisse pas les rangs */
if (type == ILT_LOOP) continue;
@@ -337,7 +341,7 @@ void rank_routine_block(const GBlockList *list, GBasicBlock *block)
&& type != ILT_JUMP_IF_FALSE)
continue;
- target = g_block_list_find_by_starting_instr(list, dests[i].linked);
+ target = g_block_list_find_by_starting_instr(list, dest->linked);
/**
* Les sauts ne se font pas toujours à l'intérieur d'une même fonction.
@@ -366,7 +370,7 @@ void rank_routine_block(const GBlockList *list, GBasicBlock *block)
}
- g_arch_instruction_runlock_dest(last);
+ g_arch_instruction_unlock_dest(last);
}