From f6039c21a3923994b9ef98d7d580ecc4b5127308 Mon Sep 17 00:00:00 2001 From: sandeep Date: Tue, 1 Feb 2000 17:47:18 +0000 Subject: [PATCH] fixed two problems a) variables declared as "bit" should not be assigned to registers b) should not reorder instructions if there is a volatile assignment git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@58 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCCicode.c | 6 ++++-- src/mcs51/ralloc.c | 8 +++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/SDCCicode.c b/src/SDCCicode.c index fa19b13f..f359c917 100644 --- a/src/SDCCicode.c +++ b/src/SDCCicode.c @@ -1027,8 +1027,10 @@ operand *operandFromSymbol (symbol *sym) !sym->reqv && /* does not already have a register euivalence */ !IS_VOLATILE(sym->etype) && /* not declared as volatile */ !IS_STATIC(sym->etype) && /* and not declared static */ - !sym->islbl && - !IN_FARSPACE(SPEC_OCLS(sym->etype))) { /* not a label */ + !sym->islbl && /* not a label */ + !IN_FARSPACE(SPEC_OCLS(sym->etype)) && /* not in far space */ + !IS_BITVAR(sym->etype) /* not a bit variable */ + ) { /* we will use it after all optimizations and before liveRange calculation */ diff --git a/src/mcs51/ralloc.c b/src/mcs51/ralloc.c index 54e64a4d..aa4e64b4 100644 --- a/src/mcs51/ralloc.c +++ b/src/mcs51/ralloc.c @@ -1485,7 +1485,13 @@ static int packRegsForAssign (iCode *ic,eBBlock *ebp) if (SKIP_IC2(dic)) continue; - + + if (IS_TRUE_SYMOP(IC_RESULT(dic)) && + IS_OP_VOLATILE(IC_RESULT(dic))) { + dic = NULL; + break; + } + if (IS_SYMOP(IC_RESULT(dic)) && IC_RESULT(dic)->key == IC_RIGHT(ic)->key) { if (POINTER_SET(dic)) -- 2.47.2