Added call to eliminate_phi_interferences. Enabled phi-destruction.
[libfirm] / ir / be / bearch_firm.c
index f52dc93..1aacdc1 100644 (file)
@@ -2,8 +2,13 @@
 /**
  * ISA implementation for Firm IR nodes.
  */
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include "bitset.h"
+#include "obst.h"
+
 #include "bearch.h"
 
 #include "irreflect.h"
@@ -80,12 +85,18 @@ static const rflct_arg_t *get_arg(const ir_node *irn, int pos)
 }
 
 static const arch_register_req_t *
-firm_get_irn_reg_req(const ir_node *irn, int pos)
+firm_get_irn_reg_req(const arch_irn_ops_t *self,
+    arch_register_req_t *req, const ir_node *irn, int pos)
 {
-  return mode_is_datab(get_irn_mode(irn)) ? &firm_std_reg_req : NULL;
+  if(mode_is_datab(get_irn_mode(irn)))
+    memcpy(req, &firm_std_reg_req, sizeof(*req));
+  else
+    req = NULL;
+
+  return req;
 }
 
-static int firm_get_n_operands(const ir_node *irn, int in_out)
+static int firm_get_n_operands(const arch_irn_ops_t *self, const ir_node *irn, int in_out)
 {
   int sig = rflct_get_signature(irn);
   return rflct_get_args_count(get_irn_opcode(irn), sig, in_out >= 0);
@@ -122,21 +133,34 @@ static struct irn_reg_assoc *get_irn_reg_assoc(const ir_node *irn, int pos)
   return set_insert(reg_set, &templ, sizeof(templ), hash);
 }
 
-static void firm_set_irn_reg(ir_node *irn, int pos, const arch_register_t *reg)
+static void firm_set_irn_reg(const arch_irn_ops_t *self, ir_node *irn,
+    int pos, const arch_register_t *reg)
 {
   struct irn_reg_assoc *assoc = get_irn_reg_assoc(irn, pos);
   assoc->reg = reg;
 }
 
-static const arch_register_t *firm_get_irn_reg(const ir_node *irn, int pos)
+static const arch_register_t *firm_get_irn_reg(const arch_irn_ops_t *self,
+    const ir_node *irn, int pos)
 {
   struct irn_reg_assoc *assoc = get_irn_reg_assoc(irn, pos);
   return assoc->reg;
 }
 
-static arch_irn_class_t firm_classify(const ir_node *irn)
+static arch_irn_class_t firm_classify(const arch_irn_ops_t *self, const ir_node *irn)
 {
-  return arch_irn_class_normal;
+    arch_irn_class_t res;
+
+    switch(get_irn_opcode(irn)) {
+        case iro_Cond:
+        case iro_Jmp:
+            res = arch_irn_class_branch;
+            break;
+        default:
+            res = arch_irn_class_normal;
+    }
+
+       return res;
 }
 
 static const arch_irn_ops_t irn_ops = {
@@ -153,7 +177,8 @@ const arch_isa_if_t firm_isa = {
   firm_get_reg_class
 };
 
-static const arch_irn_ops_t *firm_get_irn_ops(const ir_node *irn)
+static const arch_irn_ops_t *firm_get_irn_ops(const arch_irn_handler_t *self,
+    const ir_node *irn)
 {
   return &irn_ops;
 }