rename set_using_visited to set_using_irn_visited, some cosmetics, remove obsolete...
[libfirm] / ir / be / bearch.c
index 62fb8f8..f262c35 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
+ * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
  *
  * This file is part of libFirm.
  *
  */
 
 /**
- * Processor architecture specification.
- * @author Sebastian Hack
- * @date 11.2.2005
- *
- * $Id$
+ * @file
+ * @brief       Processor architecture specification.
+ * @author      Sebastian Hack
+ * @version     $Id$
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -37,7 +36,6 @@
 
 #include "bitset.h"
 #include "pset.h"
-#include "entity.h"
 #include "raw_bitset.h"
 
 #include "irprintf.h"
@@ -117,7 +115,7 @@ void arch_set_frame_offset(const arch_env_t *env, ir_node *irn, int offset)
        ops->impl->set_frame_offset(ops, irn, offset);
 }
 
-ir_entity *arch_get_frame_entity(const arch_env_t *env, ir_node *irn)
+ir_entity *arch_get_frame_entity(const arch_env_t *env, const ir_node *irn)
 {
        const arch_irn_ops_t *ops = get_irn_ops(env, irn);
        return ops->impl->get_frame_entity(ops, irn);
@@ -207,9 +205,11 @@ int arch_get_allocatable_regs(const arch_env_t *env, const ir_node *irn, int pos
        return req->cls->n_regs;
 }
 
-void arch_put_non_ignore_regs(const arch_env_t *env, const arch_register_class_t *cls, bitset_t *bs)
+void arch_put_non_ignore_regs(const arch_env_t *env,
+                              const arch_register_class_t *cls, bitset_t *bs)
 {
-       int i;
+       unsigned i;
+       (void) env;
 
        for(i = 0; i < cls->n_regs; ++i) {
                if(!arch_register_type_is(&cls->regs[i], ignore))
@@ -217,10 +217,12 @@ void arch_put_non_ignore_regs(const arch_env_t *env, const arch_register_class_t
        }
 }
 
-int arch_count_non_ignore_regs(const arch_env_t *env, const arch_register_class_t *cls)
+int arch_count_non_ignore_regs(const arch_env_t *env,
+                               const arch_register_class_t *cls)
 {
-       int i;
+       unsigned i;
        int result = 0;
+       (void) env;
 
        for(i = 0; i < cls->n_regs; ++i) {
                if(!arch_register_type_is(&cls->regs[i], ignore))
@@ -302,6 +304,7 @@ extern const char *arch_irn_flag_str(arch_irn_flags_t fl)
                XXX(ignore);
                XXX(rematerializable);
                XXX(modify_sp);
+               XXX(modify_flags);
                XXX(none);
 #undef XXX
        }
@@ -330,15 +333,29 @@ extern char *arch_register_req_format(char *buf, size_t len,
        }
 
        if(arch_register_req_is(req, should_be_same)) {
-               const ir_node *same = get_irn_n(node, req->other_same);
-               ir_snprintf(tmp, sizeof(tmp), " same to: %+F", same);
-               strncat(buf, tmp, len);
+               const unsigned other = req->other_same;
+               int i;
+
+               ir_snprintf(tmp, sizeof(tmp), " same to:");
+               for (i = 0; 1U << i <= other; ++i) {
+                       if (other & (1U << i)) {
+                               ir_snprintf(tmp, sizeof(tmp), " %+F", get_irn_n(skip_Proj_const(node), i));
+                               strncat(buf, tmp, len);
+                       }
+               }
        }
 
        if(arch_register_req_is(req, should_be_different)) {
-               const ir_node *different = get_irn_n(node, req->other_different);
-               ir_snprintf(tmp, sizeof(tmp), " different to: %+F", different);
-               strncat(buf, tmp, len);
+               const unsigned other = req->other_different;
+               int i;
+
+               ir_snprintf(tmp, sizeof(tmp), " different from:");
+               for (i = 0; 1U << i <= other; ++i) {
+                       if (other & (1U << i)) {
+                               ir_snprintf(tmp, sizeof(tmp), " %+F", get_irn_n(skip_Proj_const(node), i));
+                               strncat(buf, tmp, len);
+                       }
+               }
        }
 
        return buf;
@@ -348,7 +365,7 @@ static const arch_register_req_t no_requirement = {
        arch_register_req_type_none,
        NULL,
        NULL,
-       -1,
-       -1
+       0,
+       0
 };
 const arch_register_req_t *arch_no_register_req = &no_requirement;