Skip to content

Commit

Permalink
[imcc] fixup: optimizer comments
Browse files Browse the repository at this point in the history
do not be overly excited about optimizer features.
  • Loading branch information
Reini Urban committed Feb 27, 2014
1 parent ad94004 commit 385caf8
Showing 1 changed file with 11 additions and 22 deletions.
33 changes: 11 additions & 22 deletions compilers/imcc/optimizer.c
Expand Up @@ -992,19 +992,15 @@ 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 => ";
break;
}
}
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) &&
Expand All @@ -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) &&
Expand All @@ -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])) {
Expand Down Expand Up @@ -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);
Expand All @@ -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':
Expand Down Expand Up @@ -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") &&
Expand Down Expand Up @@ -1608,7 +1596,8 @@ dead_code_remove(ARGMOD(imc_info_t *imcc), ARGMOD(IMC_Unit *unit))
=item C<static int used_once(imc_info_t *imcc, IMC_Unit *unit)>
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
Expand Down

0 comments on commit 385caf8

Please sign in to comment.