*/
void turn_into_tuple(ir_node *node, int arity);
-/** Walks over the passed ir graph and collects all Phi nodes as a
- * list built with the link field in their corresponding block.
+/** Walks over the passed IR graph and collects all Phi nodes as a
+ * list in their corresponding block (using get_Block_phis() API).
* Further it collects all Proj nodes in a list of the node producing
* the tuple. In case of nested tuples the Projs are collected in the
* node producing the outermost Tuple.
* (old_block) of node. Moves node and its predecessors from old_block to
* new_block. Moves all Projs that depend on moved nodes and are in old_block
* to new_block. Moves all Phi nodes from old_block to new_block. To achieve
- * this the routine assumes that all Phi nodes are in a list (using the link
- * field) in the link field of old_block. Further it assumes that all Proj nodes
- * are accessible by the link field of the nodes producing the Tuple. This
+ * this the routine assumes that all Phi nodes are in the Phi list (see get_Block_phis())
+ * of old_block. Further it assumes that all Proj nodes are accessible by the link field
+ * of the nodes producing the Tuple. This
* can be established by collect_phiprojs(). part_block conserves this property.
* Adds a Jmp node to new_block that jumps to old_block.
* Assumes that node is contained in current_ir_graph. Sets current_block in
set_irn_link(n, NULL);
}
+/* the famous clear_node_and_phi_links() implementation. */
+void firm_clear_node_and_phi_links(ir_node *n, void *env) {
+ (void) env;
+ set_irn_link(n, NULL);
+ if (is_Block(n))
+ set_Block_phis(n, NULL);
+ else if (is_Phi(n))
+ set_Phi_next(n, NULL);
+}
+
/*
* Copies a node to a new irg. The Ins of the new node point to
* the predecessors on the old irg. n->link points to the new node.
/**
* The famous clear_link() walker-function.
- * Do not implement it by yourself, use this one
+ * Sets all links fields of visited nodes to NULL.
+ * Do not implement it by yourself, use this one.
*/
void firm_clear_link(ir_node *n, void *env);
+/**
+ * The famous clear_link_and_block_lists() walker-function.
+ * Sets all links fields of visited nodes to NULL.
+ * Additionally, clear all Phi-lists of visited blocks.
+ * Do not implement it by yourself, use this one
+ */
+void firm_clear_node_and_phi_links(ir_node *n, void *env);
+
/**
* Copies a node to a new irg. The Ins of the new node point to
* the predecessors on the old irg. n->link points to the new node.
}
}
-/**
- * clear all links, including the Phi list of blocks and Phi nodes.
- */
-static void clear_node_and_phis_links(ir_node *n, void *env) {
- (void) env;
-
- set_irn_link(n, NULL);
- if (is_Block(n))
- set_Block_phis(n, NULL);
- else if (is_Phi(n))
- set_Phi_next(n, NULL);
-}
-
void collect_phiprojs(ir_graph *irg) {
assert((ir_resources_reserved(irg) & (IR_RESOURCE_IRN_LINK|IR_RESOURCE_PHI_LIST)) ==
(IR_RESOURCE_IRN_LINK|IR_RESOURCE_PHI_LIST));
- irg_walk_graph(irg, clear_node_and_phis_links, collect_phiprojs_walker, NULL);
+ irg_walk_graph(irg, firm_clear_node_and_phi_links, collect_phiprojs_walker, NULL);
}
/*--------------------------------------------------------------------*/