summaryrefslogtreecommitdiff
path: root/src/analysis/disass/rank.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/analysis/disass/rank.c')
-rw-r--r--src/analysis/disass/rank.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/analysis/disass/rank.c b/src/analysis/disass/rank.c
index 3721ca0..cd5915c 100644
--- a/src/analysis/disass/rank.c
+++ b/src/analysis/disass/rank.c
@@ -61,8 +61,7 @@ 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*/
- GArchInstruction **dests; /* Instr. visée par une autre */
- InstructionLinkType *types; /* Type de lien entre lignes */
+ instr_link_t *dests; /* Instr. visées par une autre */
size_t dcount; /* Nombre de liens de dest. */
size_t i; /* Boucle de parcours */
const mrange_t *range; /* Emplacement d'une cible */
@@ -79,13 +78,13 @@ 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, &types);
+ dcount = g_arch_instruction_get_destinations(last, &dests);
for (i = 0; i < dcount; i++)
{
- range = g_arch_instruction_get_range(dests[i]);
+ range = g_arch_instruction_get_range(dests[i].linked);
- switch (types[i])
+ switch (dests[i].type)
{
case ILT_EXEC_FLOW:
case ILT_CATCH_EXCEPTION:
@@ -305,10 +304,10 @@ void rank_routine_block(const GBlockList *list, GBasicBlock *block)
{
unsigned int next; /* Rang suivant obtenu */
GArchInstruction *last; /* Dernière instruction du bloc*/
- GArchInstruction **dests; /* Instr. visée par une autre */
- InstructionLinkType *types; /* Type de lien entre lignes */
+ instr_link_t *dests; /* Instr. visées par une autre */
size_t dcount; /* Nombre de liens de dest. */
size_t i; /* Boucle de parcours */
+ InstructionLinkType type; /* Raccourci pour confort */
GBasicBlock *target; /* Bloc ciblé par un lien */
unsigned int rank; /* Rang à constituer */
@@ -317,26 +316,28 @@ 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, &types);
+ dcount = g_arch_instruction_get_destinations(last, &dests);
for (i = 0; i < dcount; i++)
{
+ type = dests[i].type;
+
/* La boucle de remontée n'abaisse pas les rangs */
- if (types[i] == ILT_LOOP) continue;
+ if (type == ILT_LOOP) continue;
/**
* On se doit de suivre le même cheminement que celui emprunté lors
* du parcours de create_dragon_nodes().
* Sinon, les chemins divergent et une récursion infinie peut survenir.
*/
- if (types[i] != ILT_EXEC_FLOW
- && types[i] != ILT_JUMP
- && types[i] != ILT_CASE_JUMP
- && types[i] != ILT_JUMP_IF_TRUE
- && types[i] != ILT_JUMP_IF_FALSE)
+ if (type != ILT_EXEC_FLOW
+ && type != ILT_JUMP
+ && type != ILT_CASE_JUMP
+ && type != ILT_JUMP_IF_TRUE
+ && type != ILT_JUMP_IF_FALSE)
continue;
- target = g_block_list_find_by_starting_instr(list, dests[i]);
+ target = g_block_list_find_by_starting_instr(list, dests[i].linked);
/**
* Les sauts ne se font pas toujours à l'intérieur d'une même fonction.