X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=ir%2Fana%2Fcdep.c;h=baea84b2d002dfbc22a4f7f5d018977cd46d213f;hb=660f709377ad5d9b9742e9c1bcc37a6f999715b3;hp=d746f19dac78ade75c790f855cd63fdaceee49fc;hpb=3571b99127e71fef4e0e017b2b60ea5be6210468;p=libfirm diff --git a/ir/ana/cdep.c b/ir/ana/cdep.c index d746f19da..baea84b2d 100644 --- a/ir/ana/cdep.c +++ b/ir/ana/cdep.c @@ -32,10 +32,12 @@ #include "xmalloc.h" #include "cdep.h" #include "irprintf.h" +#include "irdump.h" + static pmap *cdep_map; -cdep *find_cdep(const ir_node *block) +ir_cdep *find_cdep(const ir_node *block) { return pmap_get(cdep_map, (void *)block); } @@ -43,7 +45,7 @@ cdep *find_cdep(const ir_node *block) void exchange_cdep(ir_node *old, const ir_node *nw) { - cdep *cdep = find_cdep(nw); + ir_cdep *cdep = find_cdep(nw); pmap_insert(cdep_map, old, cdep); } @@ -51,19 +53,19 @@ void exchange_cdep(ir_node *old, const ir_node *nw) static void add_cdep(ir_node* node, ir_node* dep_on) { - cdep *dep = find_cdep(node); + ir_cdep *dep = find_cdep(node); #if 0 ir_fprintf(stderr, "Adding cdep of %+F on %+F\n", node, dep_on); #endif if (dep == NULL) { - cdep *newdep = xmalloc(sizeof(*newdep)); + ir_cdep *newdep = xmalloc(sizeof(*newdep)); newdep->node = dep_on; newdep->next = NULL; pmap_insert(cdep_map, node, newdep); } else { - cdep *newdep; + ir_cdep *newdep; for (;;) { if (dep->node == dep_on) return; @@ -114,14 +116,12 @@ static void cdep_pre(ir_node *node, void *ctx) } -#include "irdump.h" - /** * A block edge hook: add all cdep edges of block. */ static int cdep_edge_hook(FILE *F, ir_node *block) { - cdep *cd; + ir_cdep *cd; #if 0 ir_node *pdom = get_Block_ipostdom(block); @@ -156,7 +156,10 @@ void compute_cdep(ir_graph *irg) assure_postdoms(irg); - /* we must temporary change the post dominator relation */ + /* we must temporary change the post dominator relation: + the ipdom of the startblock is the end block. + Firm does NOT add the phantom edge from Start to End. + */ start_block = get_irg_start_block(irg); rem = get_Block_ipostdom(start_block); set_Block_ipostdom(start_block, get_irg_end_block(irg)); @@ -187,7 +190,7 @@ void free_cdep(ir_graph *irg) int is_cdep_on(const ir_node *dependee, const ir_node *candidate) { - const cdep *dep; + const ir_cdep *dep; for (dep = find_cdep(dependee); dep != NULL; dep = dep->next) { if (dep->node == candidate) return 1; @@ -198,7 +201,7 @@ int is_cdep_on(const ir_node *dependee, const ir_node *candidate) int is_iterated_cdep_on(ir_node *dependee, ir_node *candidate) { - const cdep *dep; + const ir_cdep *dep; while ((dep = find_cdep(dependee)) != NULL) { if (dep->next != NULL) return 0; @@ -211,7 +214,7 @@ int is_iterated_cdep_on(ir_node *dependee, ir_node *candidate) ir_node *get_unique_cdep(const ir_node *block) { - cdep *cdep = find_cdep(block); + ir_cdep *cdep = find_cdep(block); return cdep != NULL && cdep->next == NULL ? cdep->node : NULL; } @@ -219,7 +222,7 @@ ir_node *get_unique_cdep(const ir_node *block) int has_multiple_cdep(const ir_node *block) { - cdep *cdep = find_cdep(block); + ir_cdep *cdep = find_cdep(block); return cdep != NULL && cdep->next != NULL; }