sdp.s_area = NULL;
sdp.s_areax = NULL;
sdp.s_addr = 0;
- // jwk lastExtendedAddress = -1;
break;
case 'M':
if (extendedAddress != lastExtendedAddress)
{
-#if 1 // jwk
- if (lastExtendedAddress!=-1) {
- printf("output extended linear address record 0x%x 0x%x\n",
- extendedAddress, lastExtendedAddress);
- }
-#endif
+ if (lastExtendedAddress!=-1) {
+ printf("output extended linear address record 0x%x 0x%x\n",
+ extendedAddress, lastExtendedAddress);
+ }
if (rflag)
{
CC = sdcc
-#CC = /home/johan/sdcc/bin/sdcc
MFLAGS = -mds390
LFLAGS = --xram-loc 0x180080 --code-loc 0x10000 -Wl-r
void main(void) {
puts ("Hello world.\n\r");
- _asm ;johan _endasm;
if (d2==2) {
puts ("d2=2");
} else {
** uunet!motown!pipeline!phw
*/
-/* (c)2000/2001: hacked a little by johan.knol@iduna.nl for sdcc */
-
#include <float.h>
union float_long
return (0);
/* normalize */
- /* jwk: TODO: changing the next two whiles in nested ifs
- seriously breaks it. Why?????????????????? */
while (mant1<HIDDEN) {
mant1 <<= 1;
exp1--;
}
+ /* round off */
while (mant1 & 0xff000000) {
- // round off
if (mant1&1)
mant1 += 2;
mant1 >>= 1 ;
t.i.hi = bcast(a)->b.b0 * bcast(b)->b.b2; // A
t.i.lo = bcast(a)->b.b0 * bcast(b)->b.b0; // A
- _asm ;johan _endasm;
t.b.b3 += bcast(a)->b.b3 *
bcast(b)->b.b0; // G
t.b.b3 += bcast(a)->b.b2 *
static unsigned char radix;
-// jwk: TODO: this makes the whole dammed thing nonreentrent
+// this makes the whole dammed thing nonreentrent
static int charsOutputted;
/****************************************************************************/
length=0;
lsd = 1;
- //jwk20000814: do this at least once, e.g.: printf ("%d", (int)0);
do {
value.byte[4] = 0;
calculate_digit();
return constExprTree(cexpr->right);
}
if (cexpr->opval.op==CAST) {
- // jwk: cast ignored, maybe we should throw a warning here
+ // cast ignored, maybe we should throw a warning here?
return constExprTree(cexpr->right);
}
if (cexpr->opval.op=='&') {
-//#define LIVERANGEHUNT
-#ifdef LIVERANGEHUNT
- #define LRH(x) x
-#else
- #define LRH(x)
-#endif
/*-------------------------------------------------------------------------
SDCCcflow.c - source file for control flow analysis
if (ebbs[j]->ech && ebbs[j]->ech->op==IFX &&
(isSymbolEqual(IC_TRUE(ebbs[j]->ech), ebbs[i]->entryLabel) ||
isSymbolEqual(IC_FALSE(ebbs[j]->ech), ebbs[i]->entryLabel))) {
- LRH(printf ("%s has a conditional exit from %s\n", ebbs[i]->entryLabel->name, ebbs[j]->entryLabel->name));
ebbs[i]->hasConditionalExit=1;
}
}
-//#define LIVERANGEHUNT
-#ifdef LIVERANGEHUNT
- #define LRH(x) x
-#else
- #define LRH(x)
-#endif
/*-------------------------------------------------------------------------
SDCCcse.c - source file for Common Subexpressions and other utility
{
iCode *lic;
- LRH(printf ("replaceAllSymBySym: from %s to %s\n",
- OP_SYMBOL(from)->name,
- IS_SYMOP(to) ? OP_SYMBOL(to)->name) : "!SYM");
for (lic = ic; lic; lic = lic->next)
{
int siaddr;
}
- LRH(printf ("findCheaperOp: %s < %s\n",\
- IS_SYMOP((*opp)) ? OP_SYMBOL((*opp))->name : "!SYM",\
- OP_SYMBOL(cop)->name));
return 1;
}
if (isiCodeEqual (ic, cdp->diCode) &&
isOperandEqual (cdp->sym, IC_RESULT (cdp->diCode)))
{
- LRH(printf ("findPrevIc same: %d %d\n", ic->key, cdp->diCode->key));
- *icp = cdp->diCode;
return 1;
}
isOperandEqual (IC_LEFT (ic), IC_RIGHT (cdp->diCode)) &&
isOperandEqual (IC_RIGHT (ic), IC_LEFT (cdp->diCode)))
{
- LRH(printf ("findPrevIc inter: %d %d\n", ic->key, cdp->diCode->key));
- *icp = cdp->diCode;
return 1;
}
op->isGptr = IS_GENPTR (optype);
-#ifdef JWK
- /* if the pointer was declared as a constant */
- /* then we cannot allow assignment to the derefed */
- if (IS_PTR_CONST (optype))
- SPEC_CONST (retype) = 1;
-#endif
-
op->isaddr = (IS_PTR (rtype) ||
IS_STRUCT (rtype) ||
IS_INT (rtype) ||
-//#define LIVERANGEHUNT
-#ifdef LIVERANGEHUNT
- #define LRH(x) x
-#else
- #define LRH(x)
-#endif
/*-------------------------------------------------------------------------
SDCCloop.c - source file for loop detection & optimizations
{
if (!isinSet (*regionSet, block))
{
- LRH(printf ("loopInsert: %s\n", block->entryLabel->name));
addSetHead (regionSet, block);
STACK_PUSH (regionStack, block);
}
V_ARG (set **, exits);
V_ARG (int, depth);
V_ARG (region *, lr);
- LRH(printf ("addToExitsMarkDepth: %s %d\n", ebp->entryLabel->name, depth));
+
/* mark the loop depth of this block */
//if (!ebp->depth)
if (ebp->depth<depth)
eBBlock *block;
int dfMin = count ,dfMax =0, i;
- LRH(printf("CreateLoop\n"));
/* make sure regionStack is empty */
while (!STACK_EMPTY (regionStack))
STACK_POP (regionStack);
/* add the entryBlock */
addSet (&aloop->regBlocks, ep->to);
-#ifdef LIVERANGEHUNT
- // print regBlocks jwk
- {
- eBBlock *ebp;
- region *lp=aloop;
- for (ebp=setFirstItem(lp->regBlocks); ebp; ebp=setNextItem(lp->regBlocks)) {
- printf ("cl1 %s ", ebp->entryLabel->name);
- }
- printf (" %d\n", count);
- }
-#endif
loopInsert (&aloop->regBlocks, ep->from);
-#ifdef LIVERANGEHUNT
- // print regBlocks jwk
- {
- eBBlock *ebp;
- region *lp=aloop;
- for (ebp=setFirstItem(lp->regBlocks); ebp; ebp=setNextItem(lp->regBlocks)) {
- printf ("cl2 %s ", ebp->entryLabel->name);
- }
- printf (" %d\n", count);
- }
-#endif
while (!STACK_EMPTY (regionStack))
{
applyToSet (block->predList, insertIntoLoop, &aloop->regBlocks);
}
-#ifdef LIVERANGEHUNT
- // print regBlocks jwk
- {
- eBBlock *ebp;
- region *lp=aloop;
- for (ebp=setFirstItem(lp->regBlocks); ebp; ebp=setNextItem(lp->regBlocks)) {
- printf ("cl3 %s ", ebp->entryLabel->name);
- }
- printf (" %d\n", count);
- }
-#endif
-
aloop->entry = ep->to;
-#ifdef LIVERANGEHUNT
- // now also include those blocks that conditionally escape from this loop
- for (i=1; i<count; i++) {
- if (ebbs[i]->hasConditionalExit) {
- for (block=setFirstItem(aloop->regBlocks);
- block;
- block=setNextItem(aloop->regBlocks)) {
- if (isinSet(block->predList, ebbs[i])) {
- printf ("%s has a forced exit from %s\n",
- ebbs[i]->entryLabel->name,
- block->entryLabel->name);
- }
- }
- }
- }
-#else
/* set max & min dfNum for loopRegion */
for ( block = setFirstItem(aloop->regBlocks); block;
block = setNextItem(aloop->regBlocks)) {
}
}
}
-#endif
-
-#ifdef LIVERANGEHUNT
- printf ("================\n");
- printf (" loop with entry -- > ");
- printEntryLabel (aloop->entry, ap);
- printf ("\n");
- printf (" loop body --> ");
- applyToSet (aloop->regBlocks, printEntryLabel);
- printf ("\n");
- printf (" loop exits --> ");
- applyToSet (aloop->exits, printEntryLabel);
- printf ("\n");
-#endif
/* and if this is a conditional block, the other side of the IFX
(if any, that could have a greater dfnum) is too */
!IS_OP_VOLATILE (op) &&
assignmentsToSym (theLoop->regBlocks, op) == 0)
opin = 1;
- LRH(if (opin && IS_SYMOP(op)) {
- printf("isOperandInvariant: %s\n", OP_SYMBOL(op)->name);
- });
}
else
opin++;
int lin, rin;
cseDef *ivar;
- /* jwk: TODO this is only needed if the call is between
+ /* TODO this is only needed if the call is between
here and the definition, but I am too lazy to do that now */
/* if there are function calls in this block */
int maxDepth = 0;
region *lp;
- LRH(printf ("createLoopRegions: %p\n", ebbs));
/* get all the back edges in the graph */
if (!applyToSet (graphEdges, backEdges, &bEdges))
return 0; /* found no loops */
/* for each of these back edges get the blocks that */
/* constitute the loops */
applyToSet (bEdges, createLoop, &allRegion, ebbs,count);
-#ifdef LIVERANGEHUNT
- // print regBlocks
- {
- eBBlock *ebp;
- lp=setFirstItem(allRegion);
- printf ("createLoopRegions: ");
- for (ebp=setFirstItem(lp->regBlocks); ebp; ebp=setNextItem(lp->regBlocks)) {
- printf ("%s ", ebp->entryLabel->name);
- }
- printf (" %d\n", count);
- }
-#endif
/* now we will create regions from these loops */
/* loops with the same entry points are considered to be the */
-//#define LIVERANGEHUNT
-#ifdef LIVERANGEHUNT
- #define LRH(x) x
-#else
- #define LRH(x)
-#endif
/*-----------------------------------------------------------------*/
/* SDCCmem.c - 8051 memory management routines */
/*-----------------------------------------------------------------*/
/* then args processing */
if (funcInChain (csym->type))
{
-#if 1 // jwk: TODO should have been done already in addDecl() (oclass????)
processFuncArgs (csym);
-#endif
+
/* if register bank specified then update maxRegBank */
if (maxRegBank < FUNC_REGBANK (csym->type))
maxRegBank = FUNC_REGBANK (csym->type);
if (!sym->allocreq && sym->reqv)
{
int i;
- if (!OP_SYMBOL(sym->reqv)->nRegs) {
- LRH(printf ("*** warning: %s -> %s\n", sym->name, \
- OP_SYMBOL(sym->reqv)->name));
- }
+
sym = OP_SYMBOL (sym->reqv);
fprintf (of, "registers ");
for (i = 0; i < 4 && sym->regs[i]; i++)
#define FUNC_ISOVERLAY(x) (x->funcAttrs.overlay)
#define IFFUNC_ISOVERLAY(x) (IS_FUNC(x) && FUNC_ISOVERLAY(x))
-
-// jwk: I am not sure about this
#define IFFUNC_ISBANKEDCALL(x) (!IFFUNC_NONBANKED(x) && \
(options.model == MODEL_LARGE || \
options.model == MODEL_MEDIUM || \
}
}
}
- // jwk: this needs a closer look
+ // TODO: this needs a closer look
SPEC_ISR_SAVED_BANKS(currFunc->etype) = banksToSave;
}
}
* Restore any register banks saved by genFunction
* in reverse order.
*/
- // jwk: this needs a closer look
unsigned savedBanks = SPEC_ISR_SAVED_BANKS(currFunc->etype);
int ix;
}
}
}
- // jwk: this needs a closer look
+ // TODO: this needs a closer look
SPEC_ISR_SAVED_BANKS(currFunc->etype) = banksToSave;
}
}
* Restore any register banks saved by genFunction
* in reverse order.
*/
- // jwk: this needs a closer look
unsigned savedBanks = SPEC_ISR_SAVED_BANKS(currFunc->etype);
int ix;
-//#define LIVERANGEHUNT
-#ifdef LIVERANGEHUNT
- #define LRH(x) x
-#else
- #define LRH(x)
-#endif
/*------------------------------------------------------------------------
SDCCralloc.c - source file for register allocation. (8051) specific
if (!(sym->remat || sym->usl.spillLoc))
createStackSpil (sym);
- LRH(printf("spillThis: %s\n", sym->name));
/* mark it has spilt & put it in the spilt set */
sym->isspilt = sym->spillA = 1;
_G.spiltSet = bitVectSetBit (_G.spiltSet, sym->key);
/* get something we can spil */
ssym = selectSpil (ic, ebp, forSym);
- LRH(printf("spilSomething: spilled %s for %s\n", ssym->name, forSym->name));
/* mark it as spilt */
ssym->isspilt = ssym->spillA = 1;
{
OP_SYMBOL (IC_RESULT (dic))->liveFrom = dic->seq;
}
- // jwk: and the otherway around?
+ // TODO: and the otherway around?
/* delete from liverange table also
delete from all the points inbetween and the new
if (!dic)
return NULL; /* didn't find any assignment to op */
- LRH(printf ("findAssignToSym: %s\n", OP_SYMBOL(IC_RESULT(dic))->name));
/* we are interested only if defined in far space */
/* or in stack space in case of + & - */
bitVectFirstBit (OP_DEFS (op)))))
return NULL;
- LRH(printf ("packRegsForOneUse: %s\n", OP_SYMBOL(op)->name));
/* if that only usage is a cast */
if (dic->op == CAST) {
/* to a bigger type */