Added get_irn_pinned() function
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Tue, 12 Oct 2004 08:59:29 +0000 (08:59 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Tue, 12 Oct 2004 08:59:29 +0000 (08:59 +0000)
[r4101]

ir/ir/irop.c
ir/ir/irop.h
ir/ir/iropt.c
ir/ir/iropt_t.h

index 3567ead..30fab97 100644 (file)
@@ -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++;
+}
index d08e2d1..9f9215c 100644 (file)
@@ -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_ */
index a2f6792..c1dbc08 100644 (file)
@@ -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;
   }
index 5c7a7a7..4c7c5b5 100644 (file)
@@ -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_ */