X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fcommon%2Firtools.h;h=fe85e0a447b595c52c9c1b56b2b4d7c64aa97162;hb=c64fe299008a45e1bd3b90656d357a77edbb79c9;hp=ae9ba11521aca82bb526a713a74ef847f90459fa;hpb=4b363c6a4e0584ce755b5f82fc3d7a9dc38658b2;p=libfirm diff --git a/ir/common/irtools.h b/ir/common/irtools.h index ae9ba1152..fe85e0a44 100644 --- a/ir/common/irtools.h +++ b/ir/common/irtools.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -59,7 +59,7 @@ lc_opt_entry_t *firm_opt_get_root(void); /** * convert a pointer into an integer */ -#define PTR_TO_INT(v) ((int)((char *)(v) - (char *)0)) +#define PTR_TO_INT(v) (((char *)(v) - (char *)0)) /** * Dump a pset containing Firm objects. @@ -77,11 +77,51 @@ 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 + * Do not implement it by yourself, use this one. */ void firm_clear_node_and_phi_links(ir_node *n, void *env); /** + * Walker function, sets all phi list heads fields of visited Blocks + * to NULL. + * Use in conjunction with firm_collect_block_phis(). + */ +void firm_clear_block_phis(ir_node *node, void *env); + +/** + * Walker function, links all visited Phi nodes into its block links. + * Use in conjunction with firm_clear_block_phis(). + */ +void firm_collect_block_phis(ir_node *node, void *env); + +/** + * Creates an exact copy of a node with same inputs and attributes in the + * same block. + * + * @param node the node to copy + */ +ir_node *exact_copy(const ir_node *node); + +/** + * Create an exact copy of a node with same inputs and attributes in the same + * block but puts the node on a graph which might be different than the graph + * of the original node. + * Note: You have to fixup the inputs/block later + */ +ir_node *irn_copy_into_irg(const ir_node *node, ir_graph *irg); + +/** + * This is a helper function used by some routines copying irg graphs + * This assumes that we have "old" nodes which have been copied to "new" + * nodes; The inputs of the new nodes still point to old nodes. + * + * Given an old(!) node this function rewires the matching new_node + * so that all its inputs point to new nodes afterwards. + */ +void irn_rewire_inputs(ir_node *node); + +/** + * @deprecated * 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. * @@ -94,15 +134,4 @@ void firm_clear_node_and_phi_links(ir_node *n, void *env); */ void copy_irn_to_irg(ir_node *n, ir_graph *irg); -/** - * Creates an exact copy of a node. - * The copy resists on the same graph in the same block. - * - * @param n the node to copy - * - * @note If the copy is not changed, the next CSE operation will - * replace it by the original, so beware. - */ -ir_node *exact_copy(const ir_node *n); - #endif