From e0ea74245f08e1b4b358059b8f314cf36705ba3b Mon Sep 17 00:00:00 2001 From: vrokas Date: Mon, 16 Feb 2004 02:22:49 +0000 Subject: [PATCH] * src/pic16/gen.c (genInline): fixed bug #896482 with inline assembly git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3199 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- ChangeLog | 4 ++++ src/pic16/gen.c | 62 +++++++++++++++++++++++++------------------------ 2 files changed, 36 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7831e6a4..2189e496 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-02-16 Vangelis Rokas + + * src/pic16/gen.c (genInline): fixed bug #896482 with inline assembly + 2004-02-15 Erik Petrich * src/mcs51/ralloc.c (packRegsForAssign, reassignAliasedSym): fixed diff --git a/src/pic16/gen.c b/src/pic16/gen.c index a92822ec..e0cde477 100644 --- a/src/pic16/gen.c +++ b/src/pic16/gen.c @@ -6335,45 +6335,47 @@ static void genXor (iCode *ic, iCode *ifx) /*-----------------------------------------------------------------*/ static void genInline (iCode *ic) { - char *buffer, *bp, *bp1; + char *buffer, *bp, *bp1; - DEBUGpic16_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__); - - _G.inLine += (!options.asmpeep); + DEBUGpic16_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__); + _G.inLine += (!options.asmpeep); - buffer = bp = bp1 = Safe_calloc(1, strlen(IC_INLINE(ic))+1); - strcpy(buffer,IC_INLINE(ic)); + buffer = bp = bp1 = Safe_calloc(1, strlen(IC_INLINE(ic))+1); + strcpy(buffer,IC_INLINE(ic)); - /* emit each line as a code */ - while (*bp) { - if (*bp == '\n') { - *bp++ = '\0'; + /* emit each line as a code */ + while (*bp) { + if (*bp == '\n') { + *bp++ = '\0'; + + if(*bp1) +#if 0 + pic16_addpCode2pBlock(pb, pic16_newpCodeAsmDir(bp1, NULL)); +#else + pic16_addpCode2pBlock(pb, pic16_AssembleLine(bp1, 1)); +#endif + bp1 = bp; + } else { + if (*bp == ':') { + bp++; + *bp = '\0'; + bp++; + pic16_emitcode(bp1,""); + bp1 = bp; + } else + bp++; + } + } - if(*bp1) + if ((bp1 != bp) && *bp1) #if 0 pic16_addpCode2pBlock(pb, pic16_newpCodeAsmDir(bp1, NULL)); #else - pic16_addpCode2pBlock(pb, pic16_AssembleLine(bp1, 0)); + pic16_addpCode2pBlock(pb, pic16_AssembleLine(bp1, 1)); #endif - // inline directly, no process - bp1 = bp; - } else { - if (*bp == ':') { - bp++; - *bp = '\0'; - bp++; - pic16_emitcode(bp1,""); - bp1 = bp; - } else - bp++; - } - } - if ((bp1 != bp) && *bp1) - pic16_addpCode2pBlock(pb, pic16_newpCodeAsmDir(bp1, NULL)); //pic16_AssembleLine(bp1, 0)); - - Safe_free(buffer); - _G.inLine -= (!options.asmpeep); + Safe_free(buffer); + _G.inLine -= (!options.asmpeep); } /*-----------------------------------------------------------------*/ -- 2.30.2