From: Michael Beck Date: Tue, 1 Mar 2011 01:47:33 +0000 (+0100) Subject: C99 features removed. X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=d9ec75963ce563880933460c5cdba520ae22f3e1;p=libfirm C99 features removed. --- diff --git a/ir/be/bepeephole.c b/ir/be/bepeephole.c index c156d293e..1f1697cd7 100644 --- a/ir/be/bepeephole.c +++ b/ir/be/bepeephole.c @@ -25,6 +25,7 @@ */ #include "config.h" +#include "array_t.h" #include "bepeephole.h" #include "iredges_t.h" @@ -323,8 +324,9 @@ static void skip_barrier(ir_node *block, ir_graph *irg) int new_arity = succ_arity - 1; int pos; int new_pos = 0; - ir_node *ins[succ_arity]; + ir_node **ins; + NEW_ARR_A(ir_node *, ins, succ_arity); for (pos = 0; pos < succ_arity; ++pos) { if (pos != edge_pos) ins[new_pos++] = get_irn_n(proj_succ, pos); diff --git a/ir/lower/lower_dw.c b/ir/lower/lower_dw.c index 5adc34021..7f04f7d0c 100644 --- a/ir/lower/lower_dw.c +++ b/ir/lower/lower_dw.c @@ -1328,14 +1328,13 @@ static void lower_Cmp(ir_node *cmp, ir_mode *m, lower_env_t *env) relation); res = new_rd_Or(db, blk, low, high, mode_b); } else { + /* a rel b <==> a_h REL b_h || (a_h == b_h && a_l rel b_l) */ + ir_node *high1 = new_rd_Cmp(db, blk, lentry->high_word, + rentry->high_word, relation & ~ir_relation_equal); low = new_rd_Cmp(db, blk, lentry->low_word, rentry->low_word, relation); high = new_rd_Cmp(db, blk, lentry->high_word, rentry->high_word, ir_relation_equal); - - /* a rel b <==> a_h REL b_h || (a_h == b_h && a_l rel b_l) */ - ir_node *high1 = new_rd_Cmp(db, blk, lentry->high_word, - rentry->high_word, relation & ~ir_relation_equal); t = new_rd_And(db, blk, low, high, mode_b); res = new_rd_Or(db, blk, high1, t, mode_b); } diff --git a/ir/opt/boolopt.c b/ir/opt/boolopt.c index fa2d2b7dc..0e5cb3ea0 100644 --- a/ir/opt/boolopt.c +++ b/ir/opt/boolopt.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -64,62 +64,61 @@ DEBUG_ONLY(static firm_dbg_module_t *dbg); */ static bool find_cond_pair(ir_node *const l, ir_node *const r, cond_pair *const res) { - if (!is_Cmp(l) || !is_Cmp(r)) - return false; - - ir_node *const lol = get_Cmp_left(l); - ir_node *const lor = get_Cmp_right(l); - ir_node *const rol = get_Cmp_left(r); - ir_node *const ror = get_Cmp_right(r); - ir_relation const pnc_l = get_Cmp_relation(l); - ir_relation const pnc_r = get_Cmp_relation(r); - - if (is_Const(lor) && is_Const_null(lor) && - is_Const(ror) && is_Const_null(ror) && - pnc_l == pnc_r && - (pnc_l == ir_relation_less_greater || pnc_l == ir_relation_equal)) { - /* l == (lol !=|== NULL) && r == (rol !=|== NULL) */ - res->cmp_lo = l; - res->cmp_hi = r; - res->rel_lo = pnc_l; - res->rel_hi = pnc_l; - res->tv_lo = get_Const_tarval(lor); - res->tv_hi = get_Const_tarval(ror); - res->lo_mode = get_irn_mode(lor); - - return true; - } - - if (lol == rol && lor != ror && is_Const(lor) && is_Const(ror)) { - /* l == (x CMP c_l), r == (x cmp c_r) */ - ir_tarval *const tv_l = get_Const_tarval(lor); - ir_tarval *const tv_r = get_Const_tarval(ror); - ir_relation const rel = tarval_cmp(tv_l, tv_r); - - res->lo_mode = get_irn_mode(lol); - - if (rel == ir_relation_less) { - /* c_l < c_r */ + if (is_Cmp(l) && is_Cmp(r)) { + ir_node *const lol = get_Cmp_left(l); + ir_node *const lor = get_Cmp_right(l); + ir_node *const rol = get_Cmp_left(r); + ir_node *const ror = get_Cmp_right(r); + ir_relation const pnc_l = get_Cmp_relation(l); + ir_relation const pnc_r = get_Cmp_relation(r); + + if (is_Const(lor) && is_Const_null(lor) && + is_Const(ror) && is_Const_null(ror) && + pnc_l == pnc_r && + (pnc_l == ir_relation_less_greater || pnc_l == ir_relation_equal)) { + /* l == (lol !=|== NULL) && r == (rol !=|== NULL) */ res->cmp_lo = l; res->cmp_hi = r; res->rel_lo = pnc_l; - res->rel_hi = pnc_r; - res->tv_lo = tv_l; - res->tv_hi = tv_r; - } else if (rel == ir_relation_greater) { - /* c_l > c_r */ - res->cmp_lo = r; - res->cmp_hi = l; - res->rel_lo = pnc_r; res->rel_hi = pnc_l; - res->tv_lo = tv_r; - res->tv_hi = tv_l; - } else { - /* The constants shall be unequal but comparable. - * Local optimizations handle the equal case. */ - return false; + res->tv_lo = get_Const_tarval(lor); + res->tv_hi = get_Const_tarval(ror); + res->lo_mode = get_irn_mode(lor); + + return true; + } + + if (lol == rol && lor != ror && is_Const(lor) && is_Const(ror)) { + /* l == (x CMP c_l), r == (x cmp c_r) */ + ir_tarval *const tv_l = get_Const_tarval(lor); + ir_tarval *const tv_r = get_Const_tarval(ror); + ir_relation const rel = tarval_cmp(tv_l, tv_r); + + res->lo_mode = get_irn_mode(lol); + + if (rel == ir_relation_less) { + /* c_l < c_r */ + res->cmp_lo = l; + res->cmp_hi = r; + res->rel_lo = pnc_l; + res->rel_hi = pnc_r; + res->tv_lo = tv_l; + res->tv_hi = tv_r; + } else if (rel == ir_relation_greater) { + /* c_l > c_r */ + res->cmp_lo = r; + res->cmp_hi = l; + res->rel_lo = pnc_r; + res->rel_hi = pnc_l; + res->tv_lo = tv_r; + res->tv_hi = tv_l; + } else { + /* The constants shall be unequal but comparable. + * Local optimizations handle the equal case. */ + return false; + } + return true; } - return true; } return false; }