From 065051cf1f5cea93db11c18357fd17d2c6ffa075 Mon Sep 17 00:00:00 2001 From: sandeep Date: Sun, 21 May 2000 04:40:01 +0000 Subject: [PATCH] some optimizations (eg. selective strength reduction) git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@255 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCCloop.c | 6 ++++++ src/mcs51/peeph.def | 7 +++++++ src/mcs51/ralloc.c | 6 ++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/SDCCloop.c b/src/SDCCloop.c index 8eb38af3..e98192ad 100644 --- a/src/SDCCloop.c +++ b/src/SDCCloop.c @@ -872,6 +872,12 @@ set *basicInduction (region *loopReg , eBBlock **ebbs, int count) if (! applyToSetFTrue (basicInd,findInduction,aSym,&ip)) continue ; + /* ask port for size not worth if native instruction + exist for multiply & divide */ + if (getSize(operandType(IC_LEFT(ic))) <= port->muldiv.native_below || + getSize(operandType(IC_RIGHT(ic))) <= port->muldiv.native_below) + continue; + /* if this is a division then the remainder should be zero for it to be inducted */ if (ic->op == '/' && (ip->cval % litVal)) diff --git a/src/mcs51/peeph.def b/src/mcs51/peeph.def index ef2963b9..630a6e6c 100644 --- a/src/mcs51/peeph.def +++ b/src/mcs51/peeph.def @@ -1786,4 +1786,11 @@ replace { mov (%1 + %2 + %3),((%2 + %1) + %3) } by { ; Peephole 221b remove redundant move +} + +replace { + dec r%1 + inc r%1 +} by { + ; removed dec/inc pair } \ No newline at end of file diff --git a/src/mcs51/ralloc.c b/src/mcs51/ralloc.c index 4440eb05..80d81667 100644 --- a/src/mcs51/ralloc.c +++ b/src/mcs51/ralloc.c @@ -1729,7 +1729,9 @@ static iCode *packRegsForOneuse (iCode *ic, operand *op , eBBlock *ebp) the usage of b, & acc */ if (getSize(operandType(op)) > (fReturnSize - 2) && ic->op != RETURN && - ic->op != SEND) + ic->op != SEND && + !POINTER_SET(ic) && + !POINTER_GET(ic)) return NULL; /* this routine will mark the a symbol as used in one @@ -1820,7 +1822,7 @@ static iCode *packRegsForOneuse (iCode *ic, operand *op , eBBlock *ebp) return NULL; /* if left or right or result is in far space */ - if (isOperandInFarSpace(IC_LEFT(dic)) || + if (isOperandInFarSpace(IC_LEFT(dic)) || isOperandInFarSpace(IC_RIGHT(dic)) || isOperandInFarSpace(IC_RESULT(dic)) || IS_OP_RUONLY(IC_LEFT(dic)) || -- 2.47.2