From d9b6d0969fc324f197178583eee70bb58f0c845e Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Tue, 22 Jul 2008 12:32:11 +0000 Subject: [PATCH] const changes and enhancements to irouts [r20596] --- include/libfirm/irloop.h | 2 +- include/libfirm/irouts.h | 7 +++++++ ir/ana/irouts.c | 5 +++++ ir/ana/irscc.c | 4 ++-- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/include/libfirm/irloop.h b/include/libfirm/irloop.h index 6bfc4cc1a..c7219b572 100644 --- a/include/libfirm/irloop.h +++ b/include/libfirm/irloop.h @@ -219,6 +219,6 @@ void free_all_loop_information (void); * * Returns non-zero, if the node n is not changed in the loop block * belongs to or in inner loops of this block. */ -int is_loop_invariant(ir_node *n, ir_node *block); +int is_loop_invariant(const ir_node *n, const ir_node *block); #endif diff --git a/include/libfirm/irouts.h b/include/libfirm/irouts.h index 80108914f..a574a3bab 100644 --- a/include/libfirm/irouts.h +++ b/include/libfirm/irouts.h @@ -75,6 +75,13 @@ void irg_out_block_walk(ir_node *node, irg_walk_func *pre, irg_walk_func *post, void *env); +/** + * returns 1 if outs have been computed for a node, 0 otherwise. + * + * this is usefull to detect newly created nodes that have no outs set yet + */ +int get_irn_outs_computed(const ir_node *node); + /*------------------------------------------------------------------*/ /* Building and Removing the out datastructure */ /*------------------------------------------------------------------*/ diff --git a/ir/ana/irouts.c b/ir/ana/irouts.c index 92a57553a..2b6ecddc5 100644 --- a/ir/ana/irouts.c +++ b/ir/ana/irouts.c @@ -59,6 +59,11 @@ static void reset_outs(ir_node *node, void *unused) { } #endif +int get_irn_outs_computed(const ir_node *node) +{ + return node->out != NULL; +} + /* returns the number of successors of the node: */ int get_irn_n_outs(ir_node *node) { assert(node && node->kind == k_ir_node); diff --git a/ir/ana/irscc.c b/ir/ana/irscc.c index 4494289c7..e474878a9 100644 --- a/ir/ana/irscc.c +++ b/ir/ana/irscc.c @@ -1248,8 +1248,8 @@ int is_loop_variant(ir_loop *l, ir_loop *b) { * * Returns non-zero, if the node n is not changed in the loop block * belongs to or in inner loops of this blocks loop. */ -int is_loop_invariant(ir_node *n, ir_node *block) { +int is_loop_invariant(const ir_node *n, const ir_node *block) { ir_loop *l = get_irn_loop(block); - ir_node *b = is_Block(n) ? n : get_nodes_block(n); + const ir_node *b = is_Block(n) ? n : get_nodes_block(n); return !is_loop_variant(l, get_irn_loop(b)); } -- 2.20.1