Add arch_get_register_req_out().
[libfirm] / ir / be / benode.c
index a0457f9..7c511ee 100644 (file)
@@ -27,9 +27,7 @@
  * Backend node support for generic backend nodes.
  * This file provides Perm, Copy, Spill and Reload nodes.
  */
-#ifdef HAVE_CONFIG_H
 #include "config.h"
-#endif
 
 #include <stdlib.h>
 
@@ -259,7 +257,7 @@ static int Call_cmp_attr(ir_node *a, ir_node *b) {
        return _node_cmp_attr(&a_attr->node_attr, &b_attr->node_attr);
 }
 
-static INLINE be_req_t *get_be_req(const ir_node *node, int pos)
+static inline be_req_t *get_be_req(const ir_node *node, int pos)
 {
        int idx;
        const be_node_attr_t *attr;
@@ -280,7 +278,7 @@ static INLINE be_req_t *get_be_req(const ir_node *node, int pos)
        return pos < 0 ? &rd->req : &rd->in_req;
 }
 
-static INLINE arch_register_req_t *get_req(const ir_node *node, int pos)
+static inline arch_register_req_t *get_req(const ir_node *node, int pos)
 {
        be_req_t *bereq = get_be_req(node, pos);
        return &bereq->req;
@@ -1108,6 +1106,7 @@ be_node_get_irn_reg_req(const ir_node *irn, int pos)
                if (get_irn_mode(irn) == mode_T)
                        return arch_no_register_req;
 
+               assert(pos == -1);
                out_pos = redir_proj((const ir_node **)&irn);
                assert(is_be_node(irn));
                return get_out_reg_req(irn, out_pos);
@@ -1155,12 +1154,10 @@ restart:
                                irn = get_Proj_pred(irn);
                        }
                        goto restart;
-                       break;
+
                default:
-                       return arch_irn_class_normal;
+                       return 0;
        }
-
-       return 0;
 }
 
 static arch_irn_flags_t be_node_get_flags(const ir_node *node)
@@ -1251,14 +1248,13 @@ typedef struct {
        arch_irn_flags_t       flags;
 } phi_attr_t;
 
-struct {
-       arch_env_t  *arch_env;
-       pmap        *phi_attrs;
+static struct {
+       pmap *phi_attrs;
 } phi_handler;
 
 #define get_phi_handler_from_ops(h)      container_of(h, phi_handler_t, irn_ops)
 
-static INLINE
+static inline
 phi_attr_t *get_Phi_attr(const ir_node *phi)
 {
        phi_attr_t *attr = pmap_get(phi_handler.phi_attrs, (void*) phi);
@@ -1292,7 +1288,7 @@ const arch_register_req_t *get_Phi_reg_req_recursive(const ir_node *phi,
                /* Matze: don't we unnecessary constraint our phis with this?
                 * we only need to take the regclass IMO*/
                if(!is_Phi(op))
-                       return arch_get_register_req(op, BE_OUT_POS(0));
+                       return arch_get_register_req_out(op);
        }
 
        /*
@@ -1377,7 +1373,7 @@ static const arch_register_t *phi_get_irn_reg(const ir_node *irn)
 static arch_irn_class_t phi_classify(const ir_node *irn)
 {
        (void) irn;
-       return arch_irn_class_normal;
+       return 0;
 }
 
 static arch_irn_flags_t phi_get_flags(const ir_node *irn)
@@ -1428,9 +1424,8 @@ static const arch_irn_ops_t phi_irn_ops = {
        NULL,    /* perform_memory_operand  */
 };
 
-void be_phi_handler_new(be_main_env_t *env)
+void be_phi_handler_new(void)
 {
-       phi_handler.arch_env  = env->arch_env;
        phi_handler.phi_attrs = pmap_create();
        op_Phi->ops.be_ops    = &phi_irn_ops;
 }