From f651c71ff562f2ab9e3db7f178b64d4c52867a54 Mon Sep 17 00:00:00 2001 From: johanknol Date: Tue, 8 Apr 2003 12:51:35 +0000 Subject: [PATCH] This shows the registers in use in --i-code-in-asm and saves some spill locs git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2495 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCCicode.h | 1 + src/mcs51/gen.c | 10 +++++++++- src/mcs51/ralloc.c | 13 +++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/SDCCicode.h b/src/SDCCicode.h index c11628ff..8c9ac33d 100644 --- a/src/SDCCicode.h +++ b/src/SDCCicode.h @@ -189,6 +189,7 @@ typedef struct iCode on stack */ int argreg; /* argument regno for SEND/RECEIVE */ int eBBlockNum; /* belongs to which eBBlock */ + char riu; /* after ralloc, the registers in use */ } iCode; diff --git a/src/mcs51/gen.c b/src/mcs51/gen.c index 6dcefa60..9b28f9b4 100644 --- a/src/mcs51/gen.c +++ b/src/mcs51/gen.c @@ -8919,7 +8919,15 @@ gen51Code (iCode * lic) cln = ic->lineno; } if (options.iCodeInAsm) { - emitcode("", ";ic:%d: %s", ic->key, printILine(ic)); + char regsInUse[80]; + int i; + + for (i=0; i<8; i++) { + sprintf (®sInUse[i], + "%c", ic->riu & (1<seq, printILine(ic)); } /* if the result is marked as spilt and rematerializable or code for diff --git a/src/mcs51/ralloc.c b/src/mcs51/ralloc.c index bf3d162f..a87aae9a 100644 --- a/src/mcs51/ralloc.c +++ b/src/mcs51/ralloc.c @@ -1107,6 +1107,16 @@ serialRegAssign (eBBlock ** ebbs, int count) /* of all instructions do */ for (ic = ebbs[i]->sch; ic; ic = ic->next) { + int i; + + // update the registers in use at the start of this icode + for (i=0; i<8; i++) { + if (regs8051[i].isFree) { + ic->riu &= ~(1<riu |= (1<