#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);
}
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);
}
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;
}
-#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);
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));
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;
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;
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;
}
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;
}