SHARE=../share
CPP=$(EMLIB)/cpp
-LDFLAGS=-i
+LDFLAGS=
CPPFLAGS=-DVERBOSE -DNOTCOMPACT
CFLAGS=$(CPPFLAGS) -O
LINTFLAGS=-hbu
%%SR
overflow harmful?: yes
array bound harmful?: yes
+reduce sli if shift count larger than: 0
%%CS
#include "../../../h/em_mnem.h"
first time then space:
%%SR
overflow harmful?: yes
array bound harmful?: yes
+reduce sli if shift count larger than: 0
%%CS
#include "../../../h/em_mnem.h"
first time then space:
%%SR
overflow harmful?: yes
array bound harmful?: yes
+reduce sli if shift count larger than: 0
%%CS
#include "../../../h/em_mnem.h"
first time then space:
%%SR
overflow harmful?: no
array bound harmful?: no
+reduce sli if shift count larger than: 0
%%CS
#include "../../../h/em_mnem.h"
first time then space:
%%SR
overflow harmful?: no
array bound harmful?: no
+reduce sli if shift count larger than: 3
%%CS
#include "../../../h/em_mnem.h"
first time then space:
%%SR
overflow harmful?: no
array bound harmful?: no
+reduce sli if shift count larger than: 0
%%CS
#include "../../../h/em_mnem.h"
first time then space:
%%SR
overflow harmful?: no
array bound harmful?: no
+reduce sli if shift count larger than: 0
%%CS
#include "../../../h/em_mnem.h"
first time then space:
%%SR
overflow harmful?: no
array bound harmful?: no
+reduce sli if shift count larger than: 0
%%CS
#include "../../../h/em_mnem.h"
first time then space:
%%SR
overflow harmful?: no
array bound harmful?: yes
+reduce sli if shift count larger than: 0
%%CS
#include "../../../h/em_mnem.h"
first time then space:
%%SR
overflow harmful?: no
array bound harmful?: no
-
+reduce sli if shift count larger than: 3
%%CS
#include "../../../h/em_mnem.h"
first time then space:
EMLIB=$(EMHOME)/lib
SHR=../share
-LDFLAGS=-i
+LDFLAGS=
CPPFLAGS=-DVERBOSE -DNOTCOMPACT
CFLAGS=$(CPPFLAGS) -O
LINTFLAGS=-hbu
/* Strength reduction tries to change expensive operators occurring
* in a loop into cheaper operators. The expensive operators considered
- * are multiplication and array referencing.
+ * are multiplication, left-shift and array referencing.
* The transformations can be expressed in C as:
*
* [1]: for (i = e1; i <= e2; i++)
int ovfl_harmful;
int arrbound_harmful;
+int sli_threshold;
int Ssr; /* #optimizations found */
}
fscanf(f,"%d",&ovfl_harmful);
fscanf(f,"%d",&arrbound_harmful);
+ fscanf(f,"%d",&sli_threshold);
}
STATIC del_ivs(ivs)
*
*/
-/*#define SLI_REDUCE /* if defined, shift-lefts are also reduced */
- /* not defined for the moment; should use
- * machine specific information (as should
- * reduction of array instructions */
-
typedef struct iv *iv_p;
typedef struct code_info *code_p;
extern int arrbound_harmful; /* Is it harmful to take the address of
* a non-existing array element ?
*/
+extern int sli_threshold; /* Try to optimize SLI if shift-count larger than
+ * this
+ */
extern int Ssr; /* #optimizations found */
/* core allocation macros */
switch(code->co_instr) {
case op_mli:
case op_mlu:
-#ifdef SLI_REDUCE
case op_sli:
case op_slu:
-#endif
return reg_any;
default:
return reg_pointer;
switch(code->co_instr) {
case op_mli:
case op_mlu:
-#ifdef SLI_REDUCE
case op_sli:
case op_slu:
-#endif
/* new code is just a LOL tmp */
l = int_line(tmp);
l->l_instr = op_lol;
l->l_next = int_line(tmp);
l->l_next->l_instr = op_stl;
break;
-#ifdef SLI_REDUCE
case op_sli:
case op_slu:
/* reduced code is: iv_expr << lc
l->l_next = int_line(tmp);
l->l_next->l_instr = op_stl;
break;
-#endif
case op_lar:
case op_sar:
/* reduced code is: ...= A[iv_expr] resp.
store_tmp = int_line(tmp);
store_tmp->l_instr = op_stl;
break;
-#ifdef SLI_REDUCE
case op_sli:
case op_slu:
loc = int_line(
store_tmp = int_line(tmp);
store_tmp->l_instr = op_stl;
break;
-#endif
case op_lar:
case op_sar:
case op_aar:
switch(c1->co_instr) {
case op_mli:
case op_mlu:
-#ifdef SLI_REDUCE
case op_sli:
case op_slu:
-#endif
return c1->co_instr == c2->co_instr &&
off_set(c1->c_o.co_loadlc) ==
off_set(c2->c_o.co_loadlc) &&
-#ifdef SLI_REDUCE
STATIC try_leftshift(lp,ivs,vars,b,shft)
loop_p lp;
lset ivs,vars;
*/
l2 = PREV(shft); /* Instruction before the shift */
- if (is_const(l2) &&
+ if (is_const(l2) && off_set(l2) > sli_threshold &&
(is_ivexpr(PREV(l2),ivs,vars,&lbegin,&iv,&sign))) {
/* recognized "iv << const " */
c = newcinfo();
}
-#endif
STATIC try_array(lp,ivs,vars,b,arr)
loop_p lp;
lset ivs,vars;
next = l->l_next;
if (TYPE(l) == OPSHORT && SHORT(l) == ws) {
switch(INSTR(l)) {
-#ifdef SLI_REDUCE
case op_sli:
case op_slu:
try_leftshift(lp,ivs,vars,b,l);
break;
-#endif
case op_mlu:
case op_mli:
try_multiply(lp,ivs,vars,b,l);