fehler109
[libfirm] / ir / be / ppc32 / bearch_ppc32.c
index de8f17b..ea04f8a 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.
  *
@@ -37,6 +37,7 @@
 
 #include "bitset.h"
 #include "debug.h"
+#include "error.h"
 
 #include "../bearch_t.h"                /* the general register allocator interface */
 #include "../benode_t.h"
@@ -506,7 +507,7 @@ static void ppc32_transform_spill(ir_node *node, void *env)
                        store = new_rd_ppc32_Stfd(dbg, current_ir_graph, block,
                                get_irn_n(node, 0), get_irn_n(node, 1), new_rd_NoMem(current_ir_graph));
                }
-               else assert(0 && "Spill for register class not supported yet!");
+               else panic("Spill for register class not supported yet!");
 
                set_ppc32_frame_entity(store, be_get_frame_entity(node));
 
@@ -540,7 +541,7 @@ static void ppc32_transform_spill(ir_node *node, void *env)
                {
                        load = new_rd_ppc32_Lfd(dbg, current_ir_graph, block,   get_irn_n(node, 0), get_irn_n(node, 1));
                }
-               else assert(0 && "Reload for register class not supported yet!");
+               else panic("Reload for register class not supported yet!");
 
                set_ppc32_frame_entity(load, be_get_frame_entity(node));
 
@@ -735,14 +736,15 @@ static void ppc32_done(void *self) {
 
 
 
-static int ppc32_get_n_reg_class(const void *self) {
+static unsigned ppc32_get_n_reg_class(const void *self) {
        (void) self;
        return N_CLASSES;
 }
 
-static const arch_register_class_t *ppc32_get_reg_class(const void *self, int i) {
+static const arch_register_class_t *ppc32_get_reg_class(const void *self,
+                                                        unsigned i) {
        (void) self;
-       assert(i >= 0 && i < N_CLASSES && "Invalid ppc register class requested.");
+       assert(i < N_CLASSES && "Invalid ppc register class requested.");
        return &ppc32_reg_classes[i];
 }
 
@@ -790,10 +792,9 @@ static void ppc32_get_call_abi(const void *self, ir_type *method_type, be_abi_ca
 
        for (i = 0; i < n; i++) {
                tp   = get_method_param_type(method_type, i);
+               mode = get_type_mode(tp);
                if(is_atomic_type(tp))
                {
-                       mode = get_type_mode(tp);
-
                        if(mode_is_float(mode))
                        {
                                if(fpregi <= REG_F13)
@@ -822,14 +823,14 @@ static void ppc32_get_call_abi(const void *self, ir_type *method_type, be_abi_ca
                                be_abi_call_param_reg(abi, i, reg);
                        else
                        {
-                               be_abi_call_param_stack(abi, i, 4, stackoffs-lastoffs, 0);
+                               be_abi_call_param_stack(abi, i, mode, 4, stackoffs - lastoffs, 0);
                                lastoffs = stackoffs+stackparamsize;
                        }
                        stackoffs += stackparamsize;
                }
                else
                {
-                       be_abi_call_param_stack(abi, i, 4, stackoffs-lastoffs, 0);
+                       be_abi_call_param_stack(abi, i, mode, 4, stackoffs - lastoffs, 0);
                        stackoffs += (get_type_size_bytes(tp)+3) & -4;
                        lastoffs = stackoffs;
                }