X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fppc32%2Fppc32_transform.c;h=66e21bf6d79555cf9d8ffb0d64afb0bb9f83ef3a;hb=8d07d17eb2ade0b6b4aef0ebd68d6af3cc368b06;hp=c11c562394e1471748e529eb2c60103975e6914b;hpb=8535fe8732b0acf822be252812a7158ce5b8134a;p=libfirm diff --git a/ir/be/ppc32/ppc32_transform.c b/ir/be/ppc32/ppc32_transform.c index c11c56239..66e21bf6d 100644 --- a/ir/be/ppc32/ppc32_transform.c +++ b/ir/be/ppc32/ppc32_transform.c @@ -1,6 +1,28 @@ -/* The codegenerator (transform FIRM 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 into ppc FIRM) + * @author Moritz Kroll, Jens Mueller + * @version $Id$ + */ #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -13,7 +35,6 @@ #include "iredges_t.h" #include "irvrfy.h" #include "ircons.h" -#include "dbginfo.h" #include "iropt_t.h" #include "irprintf.h" #include "debug.h" @@ -22,14 +43,13 @@ #include "bearch_ppc32_t.h" #include "ppc32_nodes_attr.h" -#include "../arch/archop.h" /* we need this for Min and Max nodes */ +#include "archop.h" #include "ppc32_transform.h" #include "ppc32_new_nodes.h" #include "ppc32_map_regs.h" #include "gen_ppc32_regalloc_if.h" -extern pset *symbol_pset; extern ir_op *get_op_Mulh(void); int is_direct_entity(ir_entity *ent); @@ -57,17 +77,17 @@ ir_mode *get_ppc32_mode_Cond(void) { if (ppc32_mode_Cond) return ppc32_mode_Cond; else { - ppc32_mode_Cond = new_ir_mode("mode_Cond", irms_character, 4, 0, irma_none, 0); + ppc32_mode_Cond = new_ir_mode("mode_Cond", irms_int_number, 4, 0, irma_none, 0); return ppc32_mode_Cond; } } /** - * Calculates the modecode with size, sort and signed attributes + * Calculates the ir_modecode with size, sort and signed attributes */ -modecode get_nice_modecode(ir_mode *irmode) +ir_modecode get_nice_modecode(ir_mode *irmode) { - modecode mode = irm_max; + ir_modecode mode = irm_max; int sign = mode_is_signed(irmode); int bits = get_mode_size_bits(irmode); if(mode_is_int(irmode)) @@ -630,6 +650,7 @@ static ir_node *gen_Shrs(ppc32_transform_env_t *env) { tarval *tv_const = get_ppc32_constant_tarval(op2); int sh = get_tarval_long(tv_const); assert(0<=sh && sh<=31); + (void) sh; set_ppc32_constant_tarval(shift, tv_const); set_ppc32_offset_mode(shift, ppc32_ao_None); return shift; @@ -638,14 +659,14 @@ static ir_node *gen_Shrs(ppc32_transform_env_t *env) { } /** - * Creates an ppc RotL. + * Creates an ppc Rotl. * * @param env The transformation environment - * @return the created ppc RotL node + * @return the created ppc Rotl node */ -static ir_node *gen_Rot(ppc32_transform_env_t *env) { - ir_node *op1 = get_Rot_left(env->irn); - ir_node *op2 = get_Rot_right(env->irn); +static ir_node *gen_Rotl(ppc32_transform_env_t *env) { + ir_node *op1 = get_Rotl_left(env->irn); + ir_node *op2 = get_Rotl_right(env->irn); if(is_ppc32_Const(op2)) { @@ -770,8 +791,8 @@ static ir_node *own_gen_Andi_dot_lo16(ppc32_transform_env_t *env, ir_node *op, i */ static ir_node *gen_Conv(ppc32_transform_env_t *env) { ir_node *op = get_Conv_op(env->irn); - modecode from_mode=get_nice_modecode(get_irn_mode(op)); - modecode to_mode=get_nice_modecode(env->mode); + ir_modecode from_mode=get_nice_modecode(get_irn_mode(op)); + ir_modecode to_mode=get_nice_modecode(env->mode); #define SKIP return op @@ -1238,18 +1259,6 @@ static ir_node *gen_be_FrameAddr(ppc32_transform_env_t *env) { return add; } -/** - * Transforms a StackParam into a ppc Load - * - * @param env The transformation environment - */ -static ir_node *gen_be_StackParam(ppc32_transform_env_t *env) { - ir_node *load = new_rd_ppc32_Lwz(env->dbg, env->irg, env->block, get_irn_n(env->irn, 0), new_NoMem()); - ir_node *proj = new_rd_Proj(env->dbg, env->irg, env->block, load, env->mode, pn_Load_res); - set_ppc32_frame_entity(load, be_get_frame_entity(env->irn)); - return proj; -} - /********************************************************* * _ _ _ @@ -1293,7 +1302,7 @@ void ppc32_register_transformers(void) { FIRM_OP(Shl); FIRM_OP(Shr); FIRM_OP(Shrs); - FIRM_OP(Rot); + FIRM_OP(Rotl); FIRM_OP(Quot); FIRM_OP(Div); FIRM_OP(DivMod); @@ -1345,7 +1354,6 @@ void ppc32_register_transformers(void) { BAD(EndExcept); FIRM_OP(be_FrameAddr); - FIRM_OP(be_StackParam); op_Mulh = get_op_Mulh(); if (op_Mulh) FIRM_OP(Mulh); @@ -1370,6 +1378,7 @@ void ppc32_transform_node(ir_node *node, void *env) { ppc32_code_gen_t *cg = (ppc32_code_gen_t *)env; ir_op *op = get_irn_op(node); ir_node *asm_node = NULL; + (void) cg; if (op == op_Block) return; @@ -1412,6 +1421,7 @@ struct tv_ent { static int cmp_tv_ent(const void *a, const void *b, size_t len) { const struct tv_ent *e1 = a; const struct tv_ent *e2 = b; + (void) len; return !(e1->tv == e2->tv); } @@ -1606,7 +1616,7 @@ static ir_node *gen_ppc32_fConst(ppc32_transform_env_t *env) { * or false, if the address must be loaded first */ int is_direct_entity(ir_entity *ent) { - return get_entity_visibility(ent)!=visibility_external_allocated; + return get_entity_visibility(ent) != visibility_external_allocated; /* visibility vis = get_entity_visibility(ent); if(is_Method_type(get_entity_type(ent))) { @@ -1648,7 +1658,6 @@ static ir_node *gen_ppc32_SymConst(ppc32_transform_env_t *env) { set_ppc32_symconst_ident(node, id_symconst); set_ppc32_offset_mode(node, ppc32_ao_Lo16); node = new_rd_Proj(env->dbg, env->irg, env->block, node, env->mode, pn_Load_res); -// pset_insert_ptr(symbol_pset, ent); } break; } @@ -1672,6 +1681,7 @@ void ppc32_transform_const(ir_node *node, void *env) { ppc32_code_gen_t *cgenv = (ppc32_code_gen_t *)env; ir_node *asm_node = NULL; ppc32_transform_env_t tenv; + (void) cgenv; if (is_Block(node)) return;