From 385caf8f59214afbd6dd0e8dc827d8a0dc52e786 Mon Sep 17 00:00:00 2001 From: Reini Urban Date: Thu, 27 Feb 2014 00:54:07 -0600 Subject: [PATCH] [imcc] fixup: optimizer comments do not be overly excited about optimizer features. --- compilers/imcc/optimizer.c | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/compilers/imcc/optimizer.c b/compilers/imcc/optimizer.c index 00bcf79ea8..7cb0a2b4a1 100644 --- a/compilers/imcc/optimizer.c +++ b/compilers/imcc/optimizer.c @@ -992,9 +992,7 @@ IMCC_subst_constants(ARGMOD(imc_info_t *imcc), ARGMOD(IMC_Unit *unit), r[2]->type & (VTCONST|VT_CONSTP) && STREQ(name, ops[i])) { found = 4; - /* - * create instruction e.g. add_i_ic_ic => add_i_i_i - */ + /* create instruction e.g. add_i_ic_ic => add_i_i_i */ snprintf(op, sizeof (op), "%s_%c_%c_%c", name, tolower((unsigned char)r[0]->set), tolower((unsigned char)r[1]->set), tolower((unsigned char)r[2]->set)); debug_fmt = "opt %s_x_xc_xc => "; @@ -1002,9 +1000,7 @@ IMCC_subst_constants(ARGMOD(imc_info_t *imcc), ARGMOD(IMC_Unit *unit), } } for (i = 0; !found && i < N_ELEMENTS(ops2); i++) { - /* - * abs_i_ic ... - */ + /* abs_i_ic ... */ if (n == 3) { PARROT_ASSERT(r[1]); if (r[1]->type & (VTCONST|VT_CONSTP) && @@ -1018,9 +1014,7 @@ IMCC_subst_constants(ARGMOD(imc_info_t *imcc), ARGMOD(IMC_Unit *unit), } } for (i = 0; !found && i < N_ELEMENTS(ops3); i++) { - /* - * eq_xc_xc_labelc ... - */ + /* eq_xc_xc_labelc ... */ if (n == 4 && r[0]->type & (VTCONST|VT_CONSTP) && r[1]->type & (VTCONST|VT_CONSTP) && @@ -1033,9 +1027,7 @@ IMCC_subst_constants(ARGMOD(imc_info_t *imcc), ARGMOD(IMC_Unit *unit), } } for (i = 0; !found && i < N_ELEMENTS(ops4); i++) { - /* - * if_xc_labelc, unless - */ + /* if_xc_labelc, unless */ if (n == 3 && r[0]->type & (VTCONST|VT_CONSTP) && STREQ(name, ops4[i])) { @@ -1070,9 +1062,7 @@ IMCC_subst_constants(ARGMOD(imc_info_t *imcc), ARGMOD(IMC_Unit *unit), * the return value */ if (found <= 2) { - /* - * create a branch or delete instruction - */ + /* create a branch or delete instruction */ if (branched) { r[0] = r[found]; tmp = INS(imcc, unit, "branch", "", r, 1, 0, 0); @@ -1082,9 +1072,7 @@ IMCC_subst_constants(ARGMOD(imc_info_t *imcc), ARGMOD(IMC_Unit *unit), } } else { - /* - * create set x, constant - */ + /* create set x, constant */ char b[128]; switch (r[0]->set) { case 'I': @@ -1154,9 +1142,9 @@ branch_branch(ARGMOD(imc_info_t *imcc), ARGMOD(IMC_Unit *unit)) if (r && (r->type & VTADDRESS) && r->first_ins) { Instruction * const next = r->first_ins->next; - /* if (!next || - STREQ(next->symregs[0]->name, get_branch_reg(ins)->name)) - break;*/ + /* if (!next || + STREQ(next->symregs[0]->name, get_branch_reg(ins)->name)) + break; */ if (next && (next->type & IF_goto) && STREQ(next->opname, "branch") && @@ -1608,7 +1596,8 @@ dead_code_remove(ARGMOD(imc_info_t *imcc), ARGMOD(IMC_Unit *unit)) =item C -used_once ... deletes assignments, when LHS is unused +used_once ... deletes assignments, when LHS is unused. +Only for pure functional ops. Keep ops with sideeffects even if the LHS is never used. =cut