From e93604ed29d98401c2d00c4babc2ad0b481b5a9b Mon Sep 17 00:00:00 2001 From: tecodev Date: Mon, 4 Jul 2005 15:31:05 +0000 Subject: [PATCH] * src/pic/gen.c (genPointerGet): handle pointers to CONST values like CODE pointers, fixes #1115683 * src/pic/pcode.c (DoBankSelect): forget LastRegIdx during function call, fixes bugs #1232211, #1228110, fixed wrong casts to pCodeFlow from pCodeInstructions git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3794 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 8 ++++++++ src/pic/gen.c | 2 +- src/pic/pcode.c | 9 +++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5687854c..e6d57df4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-07-04 Raphael Neider + + * src/pic/gen.c (genPointerGet): handle pointers to CONST values + like CODE pointers, fixes #1115683 + * src/pic/pcode.c (DoBankSelect): forget LastRegIdx during function + call, fixes bugs #1232211, #1228110, + fixed wrong casts to pCodeFlow from pCodeInstructions + 2005-07-04 Raphael Neider * src/pic/gen.c (popGet): changed assert to allow for diff --git a/src/pic/gen.c b/src/pic/gen.c index 5d1e22ba..90392721 100644 --- a/src/pic/gen.c +++ b/src/pic/gen.c @@ -8827,7 +8827,7 @@ static void genPointerGet (iCode *ic) break; case GPOINTER: - if (IS_CODEPTR(type) || IS_PTR_CONST(type)) + if (IS_CODEPTR(type) || IS_PTR_CONST(type) || SPEC_CONST(etype)) genConstPointerGet (left,result,ic); else genGenPointerGet (left,result,ic); diff --git a/src/pic/pcode.c b/src/pic/pcode.c index 4e226db9..e956863c 100644 --- a/src/pic/pcode.c +++ b/src/pic/pcode.c @@ -4515,9 +4515,11 @@ static int BankSelect(pCodeInstruction *pci, int cur_bank, regs *reg) } } +#if 1 if (LastRegIdx == reg->rIdx) // If this is the same register as last time then it is in same bank return cur_bank; LastRegIdx = reg->rIdx; +#endif if (reg->isFixed) { bank = REG_BANK(reg); @@ -4628,6 +4630,7 @@ static int DoBankSelect(pCode *pc, int cur_bank) { if (isCALL(pc)) { pCode *pcf = findFunction(get_op_from_instruction(PCI(pc))); + LastRegIdx = -1; /* do not know which register is touched in the called function... */ if (pcf && isPCF(pcf)) { pCode *pcfr; int rbank = 'U'; // Undetermined @@ -4637,9 +4640,9 @@ static int DoBankSelect(pCode *pc, int cur_bank) { if (isPCI(pcfr)) { if ((PCI(pcfr)->op==POC_RETURN) || (PCI(pcfr)->op==POC_RETLW)) { if (rbank == 'U') - rbank = PCFL(pcfr)->lastBank; + rbank = PCI(pcfr)->pcflow->lastBank; else - if (rbank != PCFL(pcfr)->lastBank) + if (rbank != PCI(pcfr)->pcflow->lastBank) return -1; // Unknown bank - multiple returns with different banks } } @@ -4651,6 +4654,8 @@ static int DoBankSelect(pCode *pc, int cur_bank) { /* Extern functions may use registers in different bank - must call banksel */ return -1; /* Unknown bank */ } + /* play safe... */ + return -1; } if ((isPCI(pc)) && (PCI(pc)->op == POC_BANKSEL)) { -- 2.47.2