Commit bc5f9977 authored by Götz Lindenmaier's avatar Götz Lindenmaier
Browse files

accessor to check whether node currently is pinned.

[r6117]
parent 7129e9d4
......@@ -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)
......
......@@ -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
......
......@@ -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)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment