fixed flags
authorChristian Würdig <chriswue@ipd.info.uni-karlsruhe.de>
Fri, 6 Oct 2006 10:41:49 +0000 (10:41 +0000)
committerChristian Würdig <chriswue@ipd.info.uni-karlsruhe.de>
Fri, 6 Oct 2006 10:41:49 +0000 (10:41 +0000)
ir/be/ia32/bearch_ia32.c
ir/be/ia32/ia32_new_nodes.c

index 5a3dfe1..882e3a4 100644 (file)
@@ -265,17 +265,19 @@ static arch_irn_class_t ia32_classify(const void *self, const ir_node *irn) {
 }
 
 static arch_irn_flags_t ia32_get_flags(const void *self, const ir_node *irn) {
-       arch_irn_flags_t flags = arch_irn_flags_none;
+       arch_irn_flags_t flags;
+       ir_node          *pred = is_Proj(irn) ? get_Proj_pred(irn) : NULL;
 
-       if (is_Proj(irn) && is_ia32_irn(get_Proj_pred(irn))) {
-               flags |= get_ia32_out_flags(irn, get_Proj_proj(irn));
-       }
-
-       irn = skip_Proj(irn);
-       if (is_ia32_irn(irn))
-               flags |= get_ia32_flags(irn);
-       else if (is_Unknown(irn))
+       if (is_Unknown(irn))
                flags = arch_irn_flags_ignore;
+       else {
+           /* pred is only set, if we have a Proj */
+               flags = pred && is_ia32_irn(pred) ? get_ia32_out_flags(pred, get_Proj_proj(irn)) : arch_irn_flags_none;
+
+               irn = skip_Proj(irn);
+               if (is_ia32_irn(irn))
+                       flags |= get_ia32_flags(irn);
+       }
 
        return flags;
 }
index 009ebef..8da3718 100644 (file)
@@ -1089,8 +1089,7 @@ void set_ia32_out_flags(ir_node *node, arch_irn_flags_t flags, int pos) {
  */
 arch_irn_flags_t get_ia32_out_flags(const ir_node *node, int pos) {
        ia32_attr_t *attr = get_ia32_attr(node);
-       assert(pos < (int) attr->data.n_res && "Invalid OUT position.");
-       return attr->out_flags[pos];
+       return pos < (int)attr->data.n_res ? attr->out_flags[pos] : arch_irn_flags_none;
 }
 
 #ifndef NDEBUG