From: Michael Beck Date: Tue, 12 Oct 2004 08:59:29 +0000 (+0000) Subject: Added get_irn_pinned() function X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=4a2946fd1f06b02a84c4bf8307d0ad0f9d602336;p=libfirm Added get_irn_pinned() function [r4101] --- diff --git a/ir/ir/irop.c b/ir/ir/irop.c index 3567ead6f..30fab976a 100644 --- a/ir/ir/irop.c +++ b/ir/ir/irop.c @@ -24,6 +24,9 @@ # include "xmalloc.h" +/** the available next opcode */ +static unsigned next_iro = iro_MaxOpcode; + ir_op *op_Block; ir_op *get_op_Block (void) { return op_Block; } ir_op *op_Start; ir_op *get_op_Start (void) { return op_Start; } @@ -274,3 +277,7 @@ void set_op_pinned(ir_op *op, op_pin_state op_pin_state_pinned) { if (op == op_Block || op == op_Phi || is_cfopcode(op)) return; op->op_pin_state_pinned = op_pin_state_pinned; } + +unsigned get_next_ir_opcode(void) { + return next_iro++; +} diff --git a/ir/ir/irop.h b/ir/ir/irop.h index d08e2d1c9..9f9215c05 100644 --- a/ir/ir/irop.h +++ b/ir/ir/irop.h @@ -27,7 +27,7 @@ # include "ident.h" -/** the opcodes */ +/** The opcodes of the libFirm predefined operations. */ typedef enum { iro_Block, iro_Start, iro_End, iro_Jmp, iro_Cond, iro_Return, iro_Raise, @@ -128,4 +128,7 @@ op_pin_state get_op_pinned(const ir_op *op); for Block, Phi and control flow nodes. */ void set_op_pinned(ir_op *op, op_pin_state pinned); +/** Returns the next free IR opcode number, allows to register user ops */ +unsigned get_next_ir_opcode(void); + # endif /* _IROP_H_ */ diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index a2f679225..c1dbc08aa 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -42,18 +42,6 @@ follow_Id (ir_node *n) return n; } -/** - * Returns the tarval of a Const node or tarval_bad for all other nodes. - */ -static INLINE tarval * -value_of (ir_node *n) -{ - if ((n != NULL) && (get_irn_op(n) == op_Const)) - return get_Const_tarval(n); /* might return tarval_bad */ - else - return tarval_bad; -} - /** * return the value of a Constant */ @@ -1728,7 +1716,7 @@ vt_cmp (const void *elt, const void *key) return 1; /* for block-local cse and op_pin_state_pinned nodes: */ - if (!get_opt_global_cse() || (get_op_pinned(get_irn_op(a)) == op_pin_state_pinned)) { + if (!get_opt_global_cse() || (get_irn_pinned(a) == op_pin_state_pinned)) { if (get_irn_n(a, -1) != get_irn_n(b, -1)) return 1; } diff --git a/ir/ir/iropt_t.h b/ir/ir/iropt_t.h index 5c7a7a70d..4c7c5b51d 100644 --- a/ir/ir/iropt_t.h +++ b/ir/ir/iropt_t.h @@ -41,5 +41,16 @@ ir_node *optimize_in_place_2 (ir_node *n); /* Calculate a hash value of a node. */ unsigned ir_node_hash (ir_node *node); +/** + * Returns the tarval of a Const node or tarval_bad for all other nodes. + */ +static INLINE tarval * +value_of(ir_node *n) { + if ((n != NULL) && (get_irn_op(n) == op_Const)) + return get_Const_tarval(n); /* might return tarval_bad */ + else + return tarval_bad; +} + # endif /* _IROPT_T_H_ */