From: Moritz Kroll Date: Thu, 25 Dec 2008 22:03:24 +0000 (+0000) Subject: Make get_idx_irn(irg, idx) public (useful for debugging purposes) X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=1b21df923ff1da723ff237fe533c3fb5603dbb33;p=libfirm Make get_idx_irn(irg, idx) public (useful for debugging purposes) [r24894] --- diff --git a/include/libfirm/irgraph.h b/include/libfirm/irgraph.h index f4f21a906..e970e1095 100644 --- a/include/libfirm/irgraph.h +++ b/include/libfirm/irgraph.h @@ -287,6 +287,16 @@ long get_irg_graph_nr(const ir_graph *irg); */ int get_irg_idx(const ir_graph *irg); +/** + * Get the node for an index. + * @param irg The graph. + * @param idx The index you want the node for. + * @return The node with that index or NULL, if there is no node with that index. + * @note The node you got might be dead. + */ +ir_node *get_idx_irn(ir_graph *irg, unsigned idx); + + /********************************************************************************/ /* States of an ir_graph. */ /********************************************************************************/ diff --git a/ir/ir/irgraph.c b/ir/ir/irgraph.c index deb76bdca..23a53c07b 100644 --- a/ir/ir/irgraph.c +++ b/ir/ir/irgraph.c @@ -584,6 +584,10 @@ int get_irg_idx(const ir_graph *irg) { return irg->index; } +ir_node *(get_idx_irn)(ir_graph *irg, unsigned idx) { + return _get_idx_irn(irg, idx); +} + ir_node * (get_irg_start_block)(const ir_graph *irg) { return _get_irg_start_block(irg); diff --git a/ir/ir/irgraph_t.h b/ir/ir/irgraph_t.h index 4675dfc74..7c941d14b 100644 --- a/ir/ir/irgraph_t.h +++ b/ir/ir/irgraph_t.h @@ -494,7 +494,7 @@ irg_kill_node(ir_graph *irg, ir_node *n) { * @note The node you got might be dead. */ static inline ir_node * -get_idx_irn(ir_graph *irg, unsigned idx) { +_get_idx_irn(ir_graph *irg, unsigned idx) { assert(idx < (unsigned) ARR_LEN(irg->idx_irn_map)); return irg->idx_irn_map[idx]; } @@ -600,5 +600,6 @@ _get_interprocedural_view(void) { #define dec_irg_block_visited(irg) _dec_irg_block_visited(irg) #define get_irg_estimated_node_cnt(irg) _get_irg_estimated_node_cnt(irg) #define get_irg_fp_model(irg) _get_irg_fp_model(irg) +#define get_idx_irn(irg, idx) _get_idx_irn(irg, idx) #endif