X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Flower%2Flower_dw.c;h=6f63196ff9c1d7debe19e76b60e8d4df565e9128;hb=45ecc187cee7107c83c1f9618a1e1e586df73644;hp=6db15f16b5fdb5a64f3cecd0f73e1a3356f87924;hpb=ca2041e214bbd5e551b339d0741ee317baa86907;p=libfirm diff --git a/ir/lower/lower_dw.c b/ir/lower/lower_dw.c index 6db15f16b..6f63196ff 100644 --- a/ir/lower/lower_dw.c +++ b/ir/lower/lower_dw.c @@ -37,6 +37,7 @@ #include +#include "error.h" #include "lowering.h" #include "irnode_t.h" #include "irgraph_t.h" @@ -58,7 +59,6 @@ #include "pdeq.h" #include "irdump.h" #include "array_t.h" -#include "xmalloc.h" /** A map from mode to a primitive type. */ static pmap *prim_types; @@ -999,24 +999,25 @@ static void lower_Shrs(ir_node *node, ir_mode *mode, lower_env_t *env) { if (tarval_is_long(tv) && get_tarval_long(tv) >= (long)get_mode_size_bits(mode)) { - ir_node *block = get_nodes_block(node); - ir_node *left = get_Shrs_left(node); - long shf_cnt = get_tarval_long(tv) - get_mode_size_bits(mode); + ir_node *block = get_nodes_block(node); + ir_node *left = get_Shrs_left(node); + long shf_cnt = get_tarval_long(tv) - get_mode_size_bits(mode); + int idx = get_irn_idx(left); + ir_node *low; ir_node *c; - int idx = get_irn_idx(left); left = env->entries[idx]->high_word; idx = get_irn_idx(node); if (shf_cnt > 0) { - ir_node *tmp; - c = new_r_Const_long(irg, block, mode_Iu, shf_cnt); - tmp = new_r_Shrs(irg, block, left, c, mode); - /* low word is expected to have mode_Iu */ - env->entries[idx]->low_word = new_r_Conv(irg, block, tmp, mode_Iu); + c = new_r_Const_long(irg, block, mode_Iu, shf_cnt); + low = new_r_Shrs(irg, block, left, c, mode); } else { - env->entries[idx]->low_word = left; + low = left; } /* if */ + /* low word is expected to have mode_Iu */ + env->entries[idx]->low_word = new_r_Conv(irg, block, low, mode_Iu); + c = new_r_Const_long(irg, block, mode_Iu, get_mode_size_bits(mode) - 1); env->entries[idx]->high_word = new_r_Shrs(irg, block, left, c, mode); @@ -2209,11 +2210,42 @@ static void lower_Mux(ir_node *mux, ir_mode *mode, lower_env_t *env) { env->entries[idx]->high_word = new_rd_Mux(dbg, irg, block, sel, false_h, true_h, mode); } /* lower_Mux */ +static void lower_ASM(ir_node *asmn, ir_mode *mode, lower_env_t *env) +{ + ir_mode *his = env->params->high_signed; + ir_mode *hiu = env->params->high_unsigned; + int i; + ir_node *n; + + (void)mode; + + for (i = get_irn_arity(asmn) - 1; i >= 0; --i) { + ir_mode *op_mode = get_irn_mode(get_irn_n(asmn, i)); + if (op_mode == his || op_mode == hiu) { + panic("lowering ASM unimplemented"); + } + } + + for (n = asmn;;) { + ir_mode *proj_mode; + + n = get_irn_link(n); + if (n == NULL) + break; + + proj_mode = get_irn_mode(n); + if (proj_mode == his || proj_mode == hiu) { + panic("lowering ASM unimplemented"); + } + } +} + /** * check for opcodes that must always be lowered. */ static int always_lower(ir_opcode code) { switch (code) { + case iro_ASM: case iro_Proj: case iro_Start: case iro_Call: @@ -2483,6 +2515,7 @@ void lower_dw_ops(const lwrdw_param_t *param) #define LOWER_UN(op) LOWER2(op, lower_Unop) /* the table of all operations that must be lowered follows */ + LOWER(ASM); LOWER(Load); LOWER(Store); LOWER(Const);