added test for cast
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Fri, 7 May 2004 09:16:30 +0000 (09:16 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Fri, 7 May 2004 09:16:30 +0000 (09:16 +0000)
[r2861]

ir/ir/irnode.c
ir/ir/irnode.h

index f498645..6ee1682 100644 (file)
@@ -1817,6 +1817,8 @@ ir_graph *
 get_irn_irg(ir_node *node) {
   if (get_irn_op(node) != op_Block)
     node = get_nodes_block(node);
+  if (is_Bad(node))  /* sometimes bad is predecessor of nodes instead of block: in case of optimization */
+    node = get_nodes_block(node);
   assert(get_irn_op(node) == op_Block);
   return node->attr.block.irg;
 }
@@ -1853,6 +1855,15 @@ skip_Tuple (ir_node *node) {
   return node;
 }
 
+/** returns operand of node if node is a Cast */
+ir_node *skip_Cast  (ir_node *node) {
+  if (node && get_irn_op(node) == op_Cast) {
+    return skip_nop(get_irn_n(node, 0));
+  } else {
+    return node;
+  }
+}
+
 #if 0
 /* This should compact Id-cycles to self-cycles. It has the same (or less?) complexity
    than any other approach, as Id chains are resolved and all point to the real node, or
index 26ac6d5..c615ad4 100644 (file)
@@ -807,6 +807,8 @@ ir_node *skip_Id  (ir_node *node);   /* Same as skip_nop. */
 /* returns corresponding operand of Tuple if node is a Proj from
    a Tuple. */
 ir_node *skip_Tuple (ir_node *node);
+/** returns operand of node if node is a Cast */
+ir_node *skip_Cast  (ir_node *node);
 /** returns true if node is a Bad node. */
 int      is_Bad    (ir_node *node);
 /** returns true if the node is not a Block */