/**
* @file
* @brief control dependence analysis
- * @author Chrsitoph Mallon
+ * @author Christoph Mallon
* @version $Id$
*/
#ifndef FIRM_ANA_CDEP_H
#include "firm_types.h"
+/**
+ * An entry in the control dependence list.
+ */
typedef struct cdep cdep;
struct cdep {
- ir_node *node;
- cdep *next;
+ ir_node *node; /**< A node on which the current block is control dependent on. */
+ cdep *next; /**< Link to the next one if any. */
};
/** Compute the control dependence graph for a graph. */
void compute_cdep(ir_graph *irg);
+
+/** Free the control dependence info. */
void free_cdep(ir_graph *irg);
+/**
+ * Return a list of all control dependences of a block.
+ */
cdep *find_cdep(const ir_node *block);
void exchange_cdep(ir_node *old, const ir_node *nw);
+/**
+ * Check whether dependee is (directly) control dependent on candidate.
+ *
+ * @param dependee the (possible) dependent block
+ * @param candidate the (possible) block on which dependee is dependent
+ */
int is_cdep_on(const ir_node *dependee, const ir_node *candidate);
+/**
+ * Check whether dependee is (possible iterated) control dependent on candidate.
+ *
+ * @param dependee the (possible) dependent block
+ * @param candidate the (possible) block on which dependee is dependent
+ */
int is_iterated_cdep_on(ir_node *dependee, ir_node *candidate);
+/**
+ * If block is control dependent on exactly one node, return this node, else NULL.
+ *
+ * @param block the block to check
+ */
ir_node *get_unique_cdep(const ir_node *block);
+
+/**
+ * check if the given block is control dependent of more than one node.
+ *
+ * @param block the block to check
+ */
int has_multiple_cdep(const ir_node *block);
#endif
#include "xmalloc.h"
#include "cdep.h"
#include "irprintf.h"
+#include "irdump.h"
+
static pmap *cdep_map;
}
-#include "irdump.h"
-
/**
* A block edge hook: add all cdep edges of 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));