diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2013-02-02 18:51:02 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2013-02-02 18:51:02 (GMT) |
commit | 5b89c8369d2a26089f22be7c482e8254244ebc8c (patch) | |
tree | fdd7a23a256a0841f0d0d32a0ce33ceeb54e671e /src/analysis/blocks | |
parent | 0936f64aac6a4fa9ebc08962bc9cac663f210c00 (diff) |
Closed some switch cases with a 'break' keyword.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@336 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/analysis/blocks')
-rw-r--r-- | src/analysis/blocks/flow.c | 27 | ||||
-rw-r--r-- | src/analysis/blocks/virtual.c | 27 |
2 files changed, 54 insertions, 0 deletions
diff --git a/src/analysis/blocks/flow.c b/src/analysis/blocks/flow.c index 4df729c..0b68a14 100644 --- a/src/analysis/blocks/flow.c +++ b/src/analysis/blocks/flow.c @@ -74,6 +74,9 @@ static bool g_flow_block_visit(GFlowBlock *, instr_block_visitor_cb, void *); /* Etablit la liste de tous les blocs présents. */ static void g_flow_block_list_all_blocks(const GFlowBlock *, GInstrBlock ***, size_t *); +/* Etablit la liste de tous les blocs terminaux. */ +static void g_flow_block_list_leafs_blocks(const GFlowBlock *, GInstrBlock ***, size_t *); + /* Prend note de l'usage d'un registre, au besoin. */ static void g_flow_block_memorize_access(GFlowBlock *, GArchRegister *, RegAccessType, vmpa_t); @@ -134,6 +137,7 @@ static void g_flow_block_init(GFlowBlock *block) parent->find_by_addr = (find_by_addr_fc)g_flow_block_find_by_addr; parent->visit_blocks = (visit_all_blocks_fc)g_flow_block_visit; parent->list_blocks = (list_all_blocks_fc)g_flow_block_list_all_blocks; + parent->list_leafs = (list_leafs_blocks_fc)g_flow_block_list_leafs_blocks; //parent->list_regs = (list_regs_accesses_fc)g_flow_block_list_regs_accesses; block->regs = g_raccess_list_new(); @@ -315,6 +319,29 @@ static void g_flow_block_list_all_blocks(const GFlowBlock *block, GInstrBlock ** /****************************************************************************** * * +* Paramètres : block = bloc d'instructions à consulter. * +* list = ensemble de blocs à compléter. [OUT] * +* count = nombre de blocs au total. [OUT] * +* * +* Description : Etablit la liste de tous les blocs terminaux. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_flow_block_list_leafs_blocks(const GFlowBlock *block, GInstrBlock ***list, size_t *count) +{ + (*list) = (GInstrBlock **)realloc(*list, ++(*count) * sizeof(GInstrBlock *)); + + (*list)[*count - 1] = G_INSTR_BLOCK(block); + +} + + +/****************************************************************************** +* * * Paramètres : block = bloc d'instructions à mettre à jour. * * reg = registre visé par l'opération. * * type = type d'accès à l'opérande. * diff --git a/src/analysis/blocks/virtual.c b/src/analysis/blocks/virtual.c index 42492e9..0cc6a0d 100644 --- a/src/analysis/blocks/virtual.c +++ b/src/analysis/blocks/virtual.c @@ -79,6 +79,9 @@ static bool g_virtual_block_visit(GVirtualBlock *, instr_block_visitor_cb, void /* Etablit la liste de tous les blocs présents. */ static void g_virtual_block_list_all_blocks(const GVirtualBlock *, GInstrBlock ***, size_t *); +/* Etablit la liste de tous les blocs terminaux. */ +static void g_virtual_block_list_leafs_blocks(const GVirtualBlock *, GInstrBlock ***, size_t *); + /* Fournit les différents accès aux registres. */ //static const reg_access *g_virtual_block_list_regs_accesses(const GVirtualBlock *, size_t *); @@ -133,6 +136,7 @@ static void g_virtual_block_init(GVirtualBlock *block) parent->find_by_addr = (find_by_addr_fc)g_virtual_block_find_by_addr; parent->visit_blocks = (visit_all_blocks_fc)g_virtual_block_visit; parent->list_blocks = (list_all_blocks_fc)g_virtual_block_list_all_blocks; + parent->list_leafs = (list_leafs_blocks_fc)g_virtual_block_list_leafs_blocks; //parent->list_regs = (list_regs_accesses_fc)g_virtual_block_list_regs_accesses; } @@ -300,6 +304,29 @@ static void g_virtual_block_list_all_blocks(const GVirtualBlock *block, GInstrBl } + +/****************************************************************************** +* * +* Paramètres : block = bloc d'instructions à consulter. * +* list = ensemble de blocs à compléter. [OUT] * +* count = nombre de blocs au total. [OUT] * +* * +* Description : Etablit la liste de tous les blocs terminaux. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_virtual_block_list_leafs_blocks(const GVirtualBlock *block, GInstrBlock ***list, size_t *count) +{ + if (block->children_count > 0) + g_instr_block_list_leafs_blocks(block->children[block->children_count - 1], list, count); + +} + + #if 0 /****************************************************************************** * * |