summaryrefslogtreecommitdiff
path: root/src/analysis/blocks
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-10-28 22:26:53 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-10-28 22:26:53 (GMT)
commit8c71b36d401b2473342daddcb9b7eb4b83ba3295 (patch)
tree13515f99f3e01fc2d1701189e500fa69763da7f9 /src/analysis/blocks
parent2c70e3332b43bdcbe215081b697395d254418e48 (diff)
Optimized access to instruction sources and destinations.
Diffstat (limited to 'src/analysis/blocks')
-rw-r--r--src/analysis/blocks/flow.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/analysis/blocks/flow.c b/src/analysis/blocks/flow.c
index 970fc21..0f278bd 100644
--- a/src/analysis/blocks/flow.c
+++ b/src/analysis/blocks/flow.c
@@ -565,8 +565,7 @@ void g_flow_block_get_boundary_addresses(const GFlowBlock *block, vmpa2t *start,
bool g_flow_block_is_looping_to(GFlowBlock *block, const GInstrBlock *list, GFlowBlock *target)
{
bool result; /* Bilan à retourner */
- 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 */
vmpa_t addr; /* Adresse de la destination */
@@ -575,23 +574,23 @@ bool g_flow_block_is_looping_to(GFlowBlock *block, const GInstrBlock *list, GFlo
result = (block == target);
g_arch_instruction_rlock_dest(block->last);
- dcount = g_arch_instruction_get_destinations(block->last, &dests, &types);
+ dcount = g_arch_instruction_get_destinations(block->last, &dests);
for (i = 0; i < dcount && !result; i++)
- switch (types[i])
+ switch (dests[i].type)
{
case ILT_EXEC_FLOW:
case ILT_JUMP:
case ILT_CASE_JUMP:
case ILT_JUMP_IF_TRUE:
case ILT_JUMP_IF_FALSE:
- g_arch_instruction_get_location(dests[i], NULL, NULL, &addr);
+ g_arch_instruction_get_location(dests[i].linked, NULL, NULL, &addr);
next = g_instr_block_find_by_addr(list, addr, true);
result = g_flow_block_is_looping_to(G_FLOW_BLOCK(next), list, target);
break;
case ILT_LOOP:
- g_arch_instruction_get_location(dests[i], NULL, NULL, &addr);
+ g_arch_instruction_get_location(dests[i].linked, NULL, NULL, &addr);
next = g_instr_block_find_by_addr(list, addr, true);
result = (G_FLOW_BLOCK(next) == target);
default:
@@ -625,8 +624,7 @@ bool g_flow_block_is_looping_to(GFlowBlock *block, const GInstrBlock *list, GFlo
bool g_flow_block_follow(GFlowBlock *block, const GInstrBlock *list, BlockFollowPosition mask, flow_block_follow_cb callback, void *data)
{
bool result; /* Bilan à retourner */
- 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 */
vmpa_t addr; /* Adresse de la destination */
@@ -638,10 +636,10 @@ bool g_flow_block_follow(GFlowBlock *block, const GInstrBlock *list, BlockFollow
result = callback(block, BFP_ENTER, data);
g_arch_instruction_rlock_dest(block->last);
- dcount = g_arch_instruction_get_destinations(block->last, &dests, &types);
+ dcount = g_arch_instruction_get_destinations(block->last, &dests);
for (i = 0; i < dcount && result; i++)
- switch (types[i])
+ switch (dests[i].type)
{
case ILT_EXEC_FLOW:
case ILT_JUMP:
@@ -649,7 +647,7 @@ bool g_flow_block_follow(GFlowBlock *block, const GInstrBlock *list, BlockFollow
case ILT_JUMP_IF_TRUE:
case ILT_JUMP_IF_FALSE:
- g_arch_instruction_get_location(dests[i], NULL, NULL, &addr);
+ g_arch_instruction_get_location(dests[i].linked, NULL, NULL, &addr);
next = g_instr_block_find_by_addr(list, addr, true);
if (next)