From: Götz Lindenmaier Date: Thu, 23 Jun 2005 14:30:59 +0000 (+0000) Subject: accessor to check whether node currently is pinned. X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=bc5f997720461b8a5a6154bf6972bf1b552977a8;p=libfirm accessor to check whether node currently is pinned. [r6117] --- diff --git a/ir/ir/irnode.c b/ir/ir/irnode.c index 58a50e439..7ddc7d81c 100644 --- a/ir/ir/irnode.c +++ b/ir/ir/irnode.c @@ -407,6 +407,11 @@ op_pin_state return _get_irn_pinned(node); } +op_pin_state +(is_irn_pinned_in_irg) (const ir_node *node) { + return _is_irn_pinned_in_irg(node); +} + void set_irn_pinned(ir_node *node, op_pin_state state) { /* due to optimization an opt may be turned into a Tuple */ if (get_irn_op(node) == op_Tuple) diff --git a/ir/ir/irnode.h b/ir/ir/irnode.h index 094757d5f..6df3c1d84 100644 --- a/ir/ir/irnode.h +++ b/ir/ir/irnode.h @@ -161,12 +161,26 @@ ir_graph *get_irn_irg (const ir_node *node); of node cast to long. */ long get_irn_node_nr (const ir_node *node); -/** Returns the pinned state of a node. */ +/** Returns the pinned state of a node. + * + * Returns whether the node _always_ must be pinned. + * I.e., the node is not floating after global cse. + * + * @returns Either state op_pin_state_pinned or op_pin_state_floats. + */ op_pin_state get_irn_pinned (const ir_node *node); /** Set pin state for nodes with op pin state op_pin_state_exc_pinned */ void set_irn_pinned(ir_node *node, op_pin_state state); +/** Returns whether the node is currently pinned. + * + * If get_irn_pinned returns op_pin_state_floats and the graph the + * node belongs to is in state op_poin_state_floats then this function + * returns 'floats', else 'pinned'. + */ +op_pin_state is_irn_pinned_in_irg (const ir_node *node); + /** * irnode constructor. * Create a new irnode in irg, with an op, mode, arity and diff --git a/ir/ir/irnode_t.h b/ir/ir/irnode_t.h index fa951f6aa..e9a931c79 100644 --- a/ir/ir/irnode_t.h +++ b/ir/ir/irnode_t.h @@ -497,19 +497,31 @@ _get_irn_link(const ir_node *node) { } /** - * Returns the pinned state of a node. + * Returns whether the node _always_ must be pinned. + * I.e., the node is not floating after global cse. + * * Intern version of libFirm. */ static INLINE op_pin_state _get_irn_pinned(const ir_node *node) { op_pin_state state; assert(node && _is_ir_node(node)); + /* Check opcode */ state = _get_op_pinned(_get_irn_op(node)); + if (state >= op_pin_state_exc_pinned) return get_opt_fragile_ops() ? node->attr.except.pin_state : op_pin_state_pinned; return state; } +static INLINE op_pin_state +_is_irn_pinned_in_irg(const ir_node *node) { + if (get_irg_pinned(get_irn_irg(node)) == op_pin_state_floats) { + return get_irn_pinned(node) + } + return op_pin_state_pinned; +} + static INLINE int _is_unop(const ir_node *node) { assert(node && _is_ir_node(node)); @@ -651,6 +663,8 @@ static INLINE type *_get_irn_type(ir_node *node) { #define irn_not_visited(node) _irn_not_visited(node) #define set_irn_link(node, link) _set_irn_link(node, link) #define get_irn_link(node) _get_irn_link(node) +#define get_irn_pinned(node) _get_irn_pinned(node) +#define is_irn_pinned_in_irg(node) _is_irn_pinned_in_irg(node) #define is_unop(node) _is_unop(node) #define is_binop(node) _is_binop(node) #define is_Const(node) _is_Const(node)