set the global isa object
[libfirm] / ir / be / arm / arm_new_nodes.c
index d8fda8c..e90b0cc 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.
  *
@@ -47,7 +47,6 @@
 
 #include "arm_nodes_attr.h"
 #include "arm_new_nodes.h"
-#include "gen_arm_regalloc_if_t.h"
 
 #include "../beabi.h"
 #include "bearch_arm_t.h"
@@ -101,11 +100,27 @@ static void dump_reg_req(FILE *F, const ir_node *node,
                        }
 
                        if (reqs[i]->type & arch_register_req_type_should_be_same) {
-                               ir_fprintf(F, " same as %+F", get_irn_n(node, reqs[i]->other_same));
+                               const unsigned other = reqs[i]->other_same;
+                               int i;
+
+                               ir_fprintf(F, " same as");
+                               for (i = 0; 1U << i <= other; ++i) {
+                                       if (other & (1U << i)) {
+                                               ir_fprintf(F, " %+F", get_irn_n(node, i));
+                                       }
+                               }
                        }
 
                        if (reqs[i]->type & arch_register_req_type_should_be_different) {
-                               ir_fprintf(F, " different from %+F", get_irn_n(node, reqs[i]->other_different));
+                               const unsigned other = reqs[i]->other_different;
+                               int i;
+
+                               ir_fprintf(F, " different from");
+                               for (i = 0; 1U << i <= other; ++i) {
+                                       if (other & (1U << i)) {
+                                               ir_fprintf(F, " %+F", get_irn_n(node, i));
+                                       }
+                               }
                        }
 
                        fprintf(F, "\n");
@@ -226,7 +241,7 @@ static int arm_dump_node(ir_node *n, FILE *F, dump_reason_t reason) {
                                        }
                                }
                        }
-                       if (is_arm_CondJmp(n) && get_arm_CondJmp_proj_num(n) >= 0) {
+                       if (is_arm_CmpBra(n) && get_arm_CondJmp_proj_num(n) >= 0) {
                                fprintf(F, "proj_num = (%d)\n", get_arm_CondJmp_proj_num(n));
                        }
                        /* TODO: dump all additional attributes */
@@ -276,13 +291,13 @@ const arm_SymConst_attr_t *get_arm_SymConst_attr_const(const ir_node *node) {
 }
 
 /* Returns the attributes of a CondJmp node. */
-arm_CondJmp_attr_t *get_arm_CondJmp_attr(ir_node *node) {
-       assert(is_arm_CondJmp(node));
+arm_CondJmp_attr_t *get_arm_CmpBra_attr(ir_node *node) {
+       assert(is_arm_CmpBra(node));
        return get_irn_generic_attr(node);
 }
 
-const arm_CondJmp_attr_t *get_arm_CondJmp_attr_const(const ir_node *node) {
-       assert(is_arm_CondJmp(node));
+const arm_CondJmp_attr_t *get_arm_CmpBra_attr_const(const ir_node *node) {
+       assert(is_arm_CmpBra(node));
        return get_irn_generic_attr_const(node);
 }
 
@@ -461,7 +476,7 @@ void set_arm_value(ir_node *node, tarval *tv) {
  * Returns the proj num
  */
 int get_arm_CondJmp_proj_num(const ir_node *node) {
-       const arm_CondJmp_attr_t *attr = get_arm_CondJmp_attr_const(node);
+       const arm_CondJmp_attr_t *attr = get_arm_CmpBra_attr_const(node);
        return attr->proj_num;
 }
 
@@ -469,7 +484,7 @@ int get_arm_CondJmp_proj_num(const ir_node *node) {
  * Sets the proj num
  */
 void set_arm_CondJmp_proj_num(ir_node *node, int proj_num) {
-       arm_CondJmp_attr_t *attr = get_arm_CondJmp_attr(node);
+       arm_CondJmp_attr_t *attr = get_arm_CmpBra_attr(node);
        attr->proj_num   = proj_num;
 }
 
@@ -530,12 +545,15 @@ arm_shift_modifier get_arm_shift_modifier(const ir_node *node) {
 }
 
 /* Set the ARM machine node attributes to default values. */
-static void init_arm_attributes(ir_node *node, int flags, const arch_register_req_t ** in_reqs,
-                                                const arch_register_req_t ** out_reqs, const be_execution_unit_t ***execution_units,
-                                                int n_res, unsigned latency) {
+static void init_arm_attributes(ir_node *node, int flags,
+                         const arch_register_req_t ** in_reqs,
+                                                const arch_register_req_t ** out_reqs,
+                         const be_execution_unit_t ***execution_units,
+                                                int n_res) {
        ir_graph       *irg  = get_irn_irg(node);
        struct obstack *obst = get_irg_obstack(irg);
        arm_attr_t     *attr = get_arm_attr(node);
+       (void) execution_units;
 
        attr->in_req           = in_reqs;
        attr->out_req          = out_reqs;
@@ -550,75 +568,6 @@ static void init_arm_attributes(ir_node *node, int flags, const arch_register_re
        memset(attr->slots, 0, n_res * sizeof(attr->slots[0]));
 }
 
-/***************************************************************************************
- *                  _                            _                   _
- *                 | |                          | |                 | |
- *  _ __   ___   __| | ___    ___ ___  _ __  ___| |_ _ __ _   _  ___| |_ ___  _ __ ___
- * | '_ \ / _ \ / _` |/ _ \  / __/ _ \| '_ \/ __| __| '__| | | |/ __| __/ _ \| '__/ __|
- * | | | | (_) | (_| |  __/ | (_| (_) | | | \__ \ |_| |  | |_| | (__| || (_) | |  \__ \
- * |_| |_|\___/ \__,_|\___|  \___\___/|_| |_|___/\__|_|   \__,_|\___|\__\___/|_|  |___/
- *
- ***************************************************************************************/
-
-#ifdef BIT
-#undef BIT
-#endif
-#define BIT(x)  (1 << (x % 32))
-
-static unsigned arm_req_sp_limited[] = { BIT(REG_SP) };
-static const arch_register_req_t _arm_req_sp = {
-       arch_register_req_type_limited,
-       &arm_reg_classes[CLASS_arm_gp],
-       arm_req_sp_limited,
-       -1,
-       -1
-};
-
-/* construct Store: Store(ptr, val, mem) = ST ptr,val */
-ir_node *new_r_arm_StoreStackMInc(ir_graph *irg, ir_node *block, ir_node *mem,
-                                  ir_node *sp, int n_regs, ir_node **regs,
-                                  ir_mode *mode) {
-       ir_node *res;
-       ir_node *in[16];
-       int flags = 0;
-       static const arch_register_req_t *_in_req_arm_StoreStackM4Inc[] =
-       {
-               &arm_StoreStackM4Inc_reg_req_in_0,
-               &arm_StoreStackM4Inc_reg_req_in_1,
-               &arm_StoreStackM4Inc_reg_req_in_2,
-               &arm_StoreStackM4Inc_reg_req_in_2,
-               &arm_StoreStackM4Inc_reg_req_in_2,
-               &arm_StoreStackM4Inc_reg_req_in_2,
-               &arm_StoreStackM4Inc_reg_req_in_2,
-               &arm_StoreStackM4Inc_reg_req_in_2,
-               &arm_StoreStackM4Inc_reg_req_in_2,
-               &arm_StoreStackM4Inc_reg_req_in_2,
-               &arm_StoreStackM4Inc_reg_req_in_2,
-               &arm_StoreStackM4Inc_reg_req_in_2,
-               &arm_StoreStackM4Inc_reg_req_in_2,
-               &arm_StoreStackM4Inc_reg_req_in_2,
-               &arm_StoreStackM4Inc_reg_req_in_2,
-               &arm_StoreStackM4Inc_reg_req_in_2,
-               &arm_StoreStackM4Inc_reg_req_in_2,
-       };
-
-       assert(n_regs <= 15);
-
-       in[0] = mem;
-       in[1] = sp;
-       memcpy(&in[2], regs, n_regs * sizeof(in[0]));
-       res = new_ir_node(NULL, irg, block, op_arm_StoreStackM4Inc, mode, 2 + n_regs, in);
-       flags |= arch_irn_flags_rematerializable;   /* op can be easily recalculated */
-
-       /* init node attributes */
-       init_arm_attributes(res, flags, _in_req_arm_StoreStackM4Inc, NULL, NULL, 0, 1);
-
-       res = optimize_node(res);
-       irn_vrfy_irg(res, irg);
-
-       return res;
-}
-
 /************************************************
  *   ___        _   _           _               *
  *  / _ \ _ __ | |_(_)_ __ ___ (_)_______ _ __  *
@@ -680,11 +629,15 @@ static int cmp_attr_arm(ir_node *a, ir_node *b) {
 }
 
 static int cmp_attr_arm_CondJmp(ir_node *a, ir_node *b) {
+       (void) a;
+       (void) b;
        /* never identical */
        return 1;
 }
 
 static int cmp_attr_arm_SwitchJmp(ir_node *a, ir_node *b) {
+       (void) a;
+       (void) b;
        /* never identical */
        return 1;
 }
@@ -711,16 +664,3 @@ static void arm_copy_attr(const ir_node *old_node, ir_node *new_node) {
 
 /* Include the generated constructor functions */
 #include "gen_arm_new_nodes.c.inl"
-
-/**
- * Registers the arm_copy_attr function for all ARM opcodes.
- */
-void arm_register_copy_attr_func(void) {
-       int i;
-
-       for (i = get_irp_n_opcodes() - 1; i >= 0; --i) {
-               ir_op *op = get_irp_opcode(i);
-               if (is_arm_op(op))
-                       op->ops.copy_attr = arm_copy_attr;
-       }
-}