diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2016-10-28 22:26:53 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2016-10-28 22:26:53 (GMT) |
commit | 8c71b36d401b2473342daddcb9b7eb4b83ba3295 (patch) | |
tree | 13515f99f3e01fc2d1701189e500fa69763da7f9 /src/gtkext | |
parent | 2c70e3332b43bdcbe215081b697395d254418e48 (diff) |
Optimized access to instruction sources and destinations.
Diffstat (limited to 'src/gtkext')
-rw-r--r-- | src/gtkext/graph/cluster.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/gtkext/graph/cluster.c b/src/gtkext/graph/cluster.c index 2f6feda..a619b2d 100644 --- a/src/gtkext/graph/cluster.c +++ b/src/gtkext/graph/cluster.c @@ -904,8 +904,7 @@ static void g_graph_cluster_define_links(GGraphCluster *cluster, GHashTable *all { unsigned int level; /* Niveau du nouvel ensemble */ 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 #1 */ GGraphCluster *target; /* Bloc ciblé par un lien */ @@ -922,10 +921,10 @@ static void g_graph_cluster_define_links(GGraphCluster *cluster, GHashTable *all g_basic_block_get_boundary(cluster->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++) - switch (types[i]) + switch (dests[i].type) { case ILT_EXEC_FLOW: case ILT_JUMP: @@ -933,7 +932,7 @@ static void g_graph_cluster_define_links(GGraphCluster *cluster, GHashTable *all case ILT_JUMP_IF_TRUE: case ILT_JUMP_IF_FALSE: - target = G_GRAPH_CLUSTER(g_hash_table_lookup(all, dests[i])); + target = G_GRAPH_CLUSTER(g_hash_table_lookup(all, dests[i].linked)); assert(target != NULL); /* Point de départ */ @@ -983,12 +982,12 @@ static void g_graph_cluster_define_links(GGraphCluster *cluster, GHashTable *all leaving->index = cluster->ba_count - 1; - incoming->type = types[i]; + incoming->type = dests[i].type; - if (types[i] == ILT_JUMP_IF_TRUE) + if (incoming->type == ILT_JUMP_IF_TRUE) incoming->edge = g_graph_edge_new_true(&leaving->start, &incoming->y, &incoming->end); - else if (types[i] == ILT_JUMP_IF_FALSE) + else if (incoming->type == ILT_JUMP_IF_FALSE) incoming->edge = g_graph_edge_new_false(&leaving->start, &incoming->y, &incoming->end); else @@ -1509,8 +1508,7 @@ static GGraphCluster *setup_graph_clusters(GLoadedBinary *binary, const GBlockLi #ifndef NDEBUG gboolean new; /* Bloc déjà traité ? */ #endif - 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 #1 */ GBasicBlock *target; /* Bloc ciblé par un lien */ @@ -1536,10 +1534,10 @@ static GGraphCluster *setup_graph_clusters(GLoadedBinary *binary, const GBlockLi /* Détermination des blocs suivants */ 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++) - switch (types[i]) + switch (dests[i].type) { case ILT_EXEC_FLOW: case ILT_JUMP: @@ -1547,7 +1545,7 @@ static GGraphCluster *setup_graph_clusters(GLoadedBinary *binary, const GBlockLi case ILT_JUMP_IF_TRUE: case ILT_JUMP_IF_FALSE: - 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. @@ -1560,7 +1558,7 @@ static GGraphCluster *setup_graph_clusters(GLoadedBinary *binary, const GBlockLi * */ - printf(" NEW BLK :: %d -> %p\n", types[i], target); + printf(" NEW BLK :: %d -> %p\n", dests[i].type, target); if (target != NULL) { @@ -1590,11 +1588,11 @@ static GGraphCluster *setup_graph_clusters(GLoadedBinary *binary, const GBlockLi * la table globale. */ - if (!g_hash_table_contains(all, dests[i])) + if (!g_hash_table_contains(all, dests[i].linked)) { assert((pending->count + 1) < g_block_list_count_blocks(list)); pending->list[pending->count++] = target; - printf(" --push-- %d -> %p\n", types[i], target); + printf(" --push-- %d -> %p\n", dests[i].type, target); } } |