Do not mark the transformed as visited. It makes no sense at all.
[libfirm] / ir / be / ppc32 / ppc32_transform_conv.c
index 00afd25..205c997 100644 (file)
@@ -1,6 +1,28 @@
-/* The codegenerator (transform FIRM Conv nodes into ppc FIRM) */
-/* $Id$ */
+/*
+ * Copyright (C) 1995-2008 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.
+ */
 
+/**
+ * @file
+ * @brief   The codegenerator (transform FIRM Conv nodes into ppc FIRM)
+ * @author  Moritz Kroll, Jens Mueller
+ * @version $Id$
+ */
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -13,9 +35,9 @@
 #include "iredges_t.h"
 #include "irvrfy.h"
 #include "ircons.h"
-#include "dbginfo.h"
 #include "iropt_t.h"
 #include "debug.h"
+#include "error.h"
 
 #include "../benode_t.h"
 #include "bearch_ppc32_t.h"
@@ -66,7 +88,7 @@ static ir_node *own_gen_convert_call(ppc32_transform_env_t *env, ir_node *op, co
        set_method_res_type(method_type, 0, new_type_primitive(new_id_from_str("conv_result"), to_mode));
 
        method_ent   = new_entity(get_glob_type(), new_id_from_str(funcname), method_type);
-       callee       = new_rd_SymConst_addr_ent(env->dbg, env->irg, method_ent, method_type);
+       callee       = new_rd_SymConst_addr_ent(env->dbg, env->irg, mode_P_code, method_ent, method_type);
        call         = new_rd_Call(env->dbg, env->irg, env->block, memory, callee, 1, in, method_type);
        call_results = new_rd_Proj(env->dbg, env->irg, env->block, call, mode_T, pn_Call_T_result);
        memory       = new_rd_Proj(env->dbg, env->irg, env->block, call, mode_M, pn_Call_M_regular);
@@ -87,8 +109,8 @@ static ir_node *own_gen_convert_call(ppc32_transform_env_t *env, ir_node *op, co
 static ir_node *gen_Conv(ppc32_transform_env_t *env, ir_node *op) {
        ir_mode *from_mode = get_irn_mode(get_irn_n(env->irn,0));
        ir_mode *to_mode = env->mode;
-       modecode from_modecode=get_mode_modecode(from_mode);
-       modecode to_modecode=get_mode_modecode(to_mode);
+       ir_modecode from_modecode=get_mode_modecode(from_mode);
+       ir_modecode to_modecode=get_mode_modecode(to_mode);
 
        switch(from_modecode){
                case irm_F:
@@ -152,11 +174,7 @@ static ir_node *gen_Conv(ppc32_transform_env_t *env, ir_node *op) {
                default:
                        break;
        }
-       fprintf(stderr, "Mode for Conv not supported: %s -> %s\n", get_mode_name(from_mode), get_mode_name(to_mode));
-       assert(0);
-       return 0;
-
-       // return op;
+       panic("Mode for Conv not supported: %F -> %F", from_mode, to_mode);
 }
 
 int search_from_node_in_block(ir_node *from, ir_node *to)
@@ -196,7 +214,7 @@ void finalize_block(ppc32_code_gen_t *cgenv)
                memslot = frame_alloc_area(frame_type, get_mode_size_bytes(mode_D), 4, 0);
        }
 
-       attr->convs = xmalloc(attr->conv_count * sizeof(ir_node *));
+       attr->convs = XMALLOCN(ir_node*, attr->conv_count);
 
        for (i = 0, current_conv = attr->first_conv; i < attr->conv_count; i++, current_conv = current_conv->link)
        {
@@ -223,7 +241,7 @@ void finalize_block(ppc32_code_gen_t *cgenv)
 
 void init_block(void)
 {
-       cw_block_attr *attr = xmalloc(sizeof(cw_block_attr));
+       cw_block_attr *attr = XMALLOC(cw_block_attr);
        attr->first_conv    = NULL;
        attr->convs         = NULL; /* attr->convs is set in finalize_block() */
        attr->conv_count    = 0;
@@ -347,7 +365,7 @@ static ir_node *gen_SymConst(ppc32_transform_env_t *env) {
  */
 void ppc32_conv_walk(ir_node *node, void *env) {
        ppc32_code_gen_t *cgenv = (ppc32_code_gen_t *)env;
-       opcode  code          = get_irn_opcode(node);
+       ir_opcode  code         = get_irn_opcode(node);
        ppc32_transform_env_t tenv;
 
        if (is_Block(node))
@@ -366,8 +384,8 @@ void ppc32_conv_walk(ir_node *node, void *env) {
 
        if (code == iro_Conv)
        {
-               modecode from_mode=get_mode_modecode(get_irn_mode(get_irn_n(node,0)));
-               modecode to_mode=get_mode_modecode(get_irn_mode(node));
+               ir_modecode from_mode=get_mode_modecode(get_irn_mode(get_irn_n(node,0)));
+               ir_modecode to_mode=get_mode_modecode(get_irn_mode(node));
                cw_block_attr *attr;
 
                if(from_mode == to_mode) return;
@@ -448,7 +466,7 @@ void ppc32_conv_walk(ir_node *node, void *env) {
  */
 void ppc32_pretransform_walk(ir_node *node, void *env) {
        ppc32_code_gen_t *cgenv = (ppc32_code_gen_t *)env;
-       opcode  code          = get_irn_opcode(node);
+       ir_opcode  code         = get_irn_opcode(node);
        ppc32_transform_env_t tenv;
 
        if (is_Block(node))