added doxygen comments, transform mips to new emit style, use gnuas gendecls
[libfirm] / ir / be / mips / mips_new_nodes.c
index c7b299e..2f8f191 100644 (file)
@@ -1,18 +1,34 @@
+/*
+ * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
+ *
+ * This file is part of libFirm.
+ *
+ * This file may be distributed and/or modified under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation and appearing in the file LICENSE.GPL included in the
+ * packaging of this file.
+ *
+ * Licensees holding valid libFirm Professional Edition licenses may use
+ * this file in accordance with the libFirm Commercial License.
+ * Agreement provided with the Software.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
 /**
- * This file implements the creation of the achitecture specific firm opcodes
- * and the coresponding node constructors for the mips assembler irg.
- * $Id$
+ * @file
+ * @brief    This file implements the creation of the achitecture specific firm
+ *           opcodes and the coresponding node constructors for the mips
+ *           assembler irg.
+ * @author   Matthias Braun, Mehdi
+ * @version  $Id$
  */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#ifdef _WIN32
-#include <malloc.h>
-#else
-#include <alloca.h>
-#endif
-
 #include <stdlib.h>
 
 #include "irprog_t.h"
@@ -25,8 +41,9 @@
 #include "firm_common_t.h"
 #include "irvrfy_t.h"
 #include "irprintf.h"
+#include "xmalloc.h"
 
-#include "../bearch.h"
+#include "../bearch_t.h"
 
 #include "mips_nodes_attr.h"
 #include "mips_new_nodes.h"
@@ -412,7 +429,7 @@ ir_node *mips_transform_##srcnode(ir_node* node)                            \
                mips_attr_t *attr, *op_attr = get_mips_attr(op2);               \
                long val = get_tarval_long(op_attr->tv);                                \
                result = new_rd_mips_##inode(get_irn_dbg_info(node), get_irn_irg(node), get_nodes_block(node),  \
-                       op1, get_irn_mode(node));                                                       \
+                       op1);                                                                       \
                attr = get_mips_attr(result);                                                   \
                attr->tv = new_tarval_from_long(val, get_mode_sign(get_irn_mode(node)) ? mode_Hs : mode_Hu);    \
                return result;                                                                                  \
@@ -422,7 +439,7 @@ ir_node *mips_transform_##srcnode(ir_node* node)                            \
                mips_attr_t *attr, *op_attr = get_mips_attr(op1);       \
                long val = get_tarval_long(op_attr->tv);                                \
                result = new_rd_mips_##inode(get_irn_dbg_info(node), get_irn_irg(node), get_nodes_block(node),  \
-                       op2, get_irn_mode(node));                                                       \
+                       op2);                                                                       \
                attr = get_mips_attr(result);                                                   \
                attr->tv = new_tarval_from_long(val, get_mode_sign(get_irn_mode(node)) ? mode_Hs : mode_Hu);    \
                return result;                                                                                  \
@@ -431,7 +448,7 @@ ir_node *mips_transform_##srcnode(ir_node* node)                            \
        return node;                                                                                            \
 }
 
-MIPS_MAKE_IFOLDING_TRANSFORM(add, addi, 1)
+MIPS_MAKE_IFOLDING_TRANSFORM(addu, addiu, 1)
 MIPS_MAKE_IFOLDING_TRANSFORM(and, andi, 1)
 MIPS_MAKE_IFOLDING_TRANSFORM(or, ori, 1)
 MIPS_MAKE_IFOLDING_TRANSFORM(sra, srai, 0)
@@ -441,7 +458,7 @@ MIPS_MAKE_IFOLDING_TRANSFORM(sr, sri, 0)
 MIPS_MAKE_IFOLDING_TRANSFORM(slt, slti, 0)
 
 void mips_init_opcode_transforms(void) {
-       op_mips_add->ops.transform_node = mips_transform_add;
+       op_mips_addu->ops.transform_node = mips_transform_addu;
        op_mips_and->ops.transform_node = mips_transform_and;
        op_mips_or->ops.transform_node  = mips_transform_or;
        op_mips_sra->ops.transform_node = mips_transform_sra;