More shifting. Remove SDCCralloc.h, made all in mcs51 static,
authormichaelh <michaelh@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 23 Jan 2000 18:26:04 +0000 (18:26 +0000)
committermichaelh <michaelh@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 23 Jan 2000 18:26:04 +0000 (18:26 +0000)
prepended mcs51_ for shared functions, made 'regs' an incomplete type.

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@23 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCglue.c
src/SDCCicode.c
src/SDCCralloc.h [deleted file]
src/common.h
src/mcs51/gen.c
src/mcs51/main.c
src/mcs51/ralloc.c
src/mcs51/ralloc.h
src/port.h

index eb574a35426c6a83b68d47887097cb1766109b0c..3dfe3748f384f51a5256f53b15bc0be45adb72b0 100644 (file)
@@ -63,6 +63,39 @@ void copyFile (FILE * dest, FILE * src)
            fputc (ch, dest);
 }
 
+/*-----------------------------------------------------------------*/
+/* aopLiteral - string from a literal value                        */
+/*-----------------------------------------------------------------*/
+char *aopLiteral (value *val, int offset)
+{
+    char *rs;
+    union {
+        float f;
+        unsigned char c[4];
+    } fl;
+
+    /* if it is a float then it gets tricky */
+    /* otherwise it is fairly simple */
+    if (!IS_FLOAT(val->type)) {
+        unsigned long v = floatFromVal(val);
+
+        v >>= (offset * 8);
+        sprintf(buffer,"#0x%02x",((char) v) & 0xff);
+        ALLOC_ATOMIC(rs,strlen(buffer)+1);
+        return strcpy (rs,buffer);
+    }
+
+    /* it is type float */
+    fl.f = (float) floatFromVal(val);
+#ifdef _BIG_ENDIAN    
+    sprintf(buffer,"#0x%02x",fl.c[3-offset]);
+#else
+    sprintf(buffer,"#0x%02x",fl.c[offset]);
+#endif
+    ALLOC_ATOMIC(rs,strlen(buffer)+1);
+    return strcpy (rs,buffer);
+}
+
 /*-----------------------------------------------------------------*/
 /* emitRegularMap - emit code for maps with no special cases       */
 /*-----------------------------------------------------------------*/
index 733aaa53c7775bda53dd5c4822637c32e560ef82..adfc7307b4a4df18354c5bcbee413fde285dea78 100644 (file)
@@ -184,9 +184,7 @@ int printOperand (operand *op, FILE *file)
                int i;
                fprintf(file,"[");
                for(i=0;i<OP_SYMBOL(op)->nRegs;i++)
-                   fprintf(file,"%s ",(OP_SYMBOL(op)->regs[i] ? 
-                                       OP_SYMBOL(op)->regs[i]->name :
-                                       "err"));
+                   fprintf(file,"%s ", port->getRegName(OP_SYMBOL(op)));
                fprintf(file,"]");
            }
        } 
diff --git a/src/SDCCralloc.h b/src/SDCCralloc.h
deleted file mode 100644 (file)
index 4db755f..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*-------------------------------------------------------------------------
-
-  SDCCralloc.h - header file register allocation
-
-                Written By -  Sandeep Dutta . sandeep.dutta@usa.net (1998)
-
-   This program is free software; you can redistribute it and/or modify it
-   under the terms of the GNU General Public License as published by the
-   Free Software Foundation; either version 2, or (at your option) any
-   later version.
-   
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-   
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-   
-   In other words, you are welcome to use, share and improve this program.
-   You are forbidden to forbid anyone else to use, share and improve
-   what you give them.   Help stamp out software-hoarding!  
--------------------------------------------------------------------------*/
-#include "SDCCicode.h"
-#include "SDCCBBlock.h"
-#ifndef SDCCRALLOC_H
-#define SDCCRALLOC_H 1
-
-enum { R2_IDX = 0, R3_IDX , R4_IDX  ,
-       R5_IDX   ,R6_IDX   , R7_IDX  ,
-       R0_IDX   ,R1_IDX   , X8_IDX  ,
-       X9_IDX   ,X10_IDX  , X11_IDX ,
-       X12_IDX  ,CND_IDX };
-
-
-#define REG_PTR 0x01
-#define REG_GPR 0x02
-#define REG_CND 0x04
-/* definition for the registers */
-typedef struct regs
-{
-    short type;          /* can have value 
-                           REG_GPR, REG_PTR or REG_CND */
-    short rIdx ;         /* index into register table */
-    short otype;        
-    char *name ;         /* name */
-    char *dname;         /* name when direct access needed */
-    char *base ;         /* base address */
-    short offset;        /* offset from the base */
-    unsigned isFree :1;  /* is currently unassigned  */    
-} regs;
-extern regs regs8051[];
-
-void   assignRegisters (eBBlock **, int );
-regs  *regWithIdx (int);
-
-#endif
index 2e6f031942a46a08294961bc71cac90dbb99bb34..30872eae1dcbd1922ca795c874faea1e9635908b 100644 (file)
 #include "SDCCcflow.h"
 #include "SDCCdflow.h"
 #include "SDCClrange.h"
-#include "SDCCralloc.h"
 #include "SDCCptropt.h"
 #include "SDCCopt.h"
 
 #include "port.h"
 #include "config.h"
+
+/*
+#include "SDCCralloc.h"
+*/
index b4dccfd0506a22a3bbeb19212bf6ca4fd01e8910..6fb9f88d16ba9455a323af7f2852ae7aa1479d5f 100644 (file)
@@ -5,24 +5,27 @@
          and -  Jean-Louis VERN.jlvern@writeme.com (1999)
   Bug Fixes  -  Wojciech Stryjewski  wstryj1@tiger.lsu.edu (1999 v2.1.9a)
   
-        This program is free software; you can redistribute it and/or modify it
-        under the terms of the GNU General Public License as published by the
-        Free Software Foundation; either version 2, or (at your option) any
-        later version.
-        
-        This program is distributed in the hope that it will be useful,
-        but WITHOUT ANY WARRANTY; without even the implied warranty of
-        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-        GNU General Public License for more details.
-        
-        You should have received a copy of the GNU General Public License
-        along with this program; if not, write to the Free Software
-        Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-        
-        In other words, you are welcome to use, share and improve this program.
-        You are forbidden to forbid anyone else to use, share and improve
-        what you give them.   Help stamp out software-hoarding!
-
+  This program is free software; you can redistribute it and/or modify it
+  under the terms of the GNU General Public License as published by the
+  Free Software Foundation; either version 2, or (at your option) any
+  later version.
+  
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+  
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software
+  Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+  
+  In other words, you are welcome to use, share and improve this program.
+  You are forbidden to forbid anyone else to use, share and improve
+  what you give them.   Help stamp out software-hoarding!
+  
+  Notes:
+  000123 mlh   Moved aopLiteral to SDCCglue.c to help the split
+               Made everything static
 -------------------------------------------------------------------------*/
 
 #include <stdio.h>
 
 #include "common.h"
 #include "SDCCpeeph.h"
+#include "ralloc.h"
 #include "gen.h"
 
+char *aopLiteral (value *val, int offset);
+
 /* this is the down and dirty file with all kinds of 
    kludgy & hacky stuff. This is what it is all about
    CODE GENERATION for a specific MCU . some of the
@@ -96,7 +102,7 @@ unsigned char   SRMask[] = {0xFF, 0x7F, 0x3F, 0x1F, 0x0F,
 /*-----------------------------------------------------------------*/
 /* emitcode - writes the code into a file : for now it is simple    */
 /*-----------------------------------------------------------------*/
-void emitcode (char *inst,char *fmt, ...)
+static void emitcode (char *inst,char *fmt, ...)
 {
     va_list ap;
     char lb[MAX_INLINEASM];  
@@ -149,14 +155,14 @@ static regs *getFreePtr (iCode *ic, asmop **aopp, bool result)
     if (!r0iu && !r0ou) {
         ic->rUsed = bitVectSetBit(ic->rUsed,R0_IDX);
         (*aopp)->type = AOP_R0;
-        return (*aopp)->aopu.aop_ptr = regWithIdx(R0_IDX);
+        return (*aopp)->aopu.aop_ptr = mcs51_regWithIdx(R0_IDX);
     }
 
     /* if no usage of r1 then return it */
     if (!r1iu && !r1ou) {
         ic->rUsed = bitVectSetBit(ic->rUsed,R1_IDX);
         (*aopp)->type = AOP_R1;
-        return (*aopp)->aopu.aop_ptr = regWithIdx(R1_IDX);
+        return (*aopp)->aopu.aop_ptr = mcs51_regWithIdx(R1_IDX);
     }    
 
     /* now we know they both have usage */
@@ -165,14 +171,14 @@ static regs *getFreePtr (iCode *ic, asmop **aopp, bool result)
         /* push it if not already pushed */
         if (!_G.r0Pushed) {
             emitcode ("push","%s",
-                      regWithIdx(R0_IDX)->dname);
+                      mcs51_regWithIdx(R0_IDX)->dname);
             _G.r0Pushed++ ;
         }
 
         ic->rUsed = bitVectSetBit(ic->rUsed,R0_IDX);
         (*aopp)->type = AOP_R0;
 
-        return (*aopp)->aopu.aop_ptr = regWithIdx(R0_IDX);
+        return (*aopp)->aopu.aop_ptr = mcs51_regWithIdx(R0_IDX);
     }
 
     /* if r1 not used then */
@@ -181,13 +187,13 @@ static regs *getFreePtr (iCode *ic, asmop **aopp, bool result)
         /* push it if not already pushed */
         if (!_G.r1Pushed) {
             emitcode ("push","%s",
-                      regWithIdx(R1_IDX)->dname);
+                      mcs51_regWithIdx(R1_IDX)->dname);
             _G.r1Pushed++ ;
         }
 
         ic->rUsed = bitVectSetBit(ic->rUsed,R1_IDX);
         (*aopp)->type = AOP_R1;
-        return regWithIdx(R1_IDX);
+        return mcs51_regWithIdx(R1_IDX);
     }
 
 
@@ -361,7 +367,7 @@ static asmop *aopForRemat (symbol *sym)
 /*-----------------------------------------------------------------*/
 /* regsInCommon - two operands have some registers in common       */
 /*-----------------------------------------------------------------*/
-bool regsInCommon (operand *op1, operand *op2)
+static bool regsInCommon (operand *op1, operand *op2)
 {
     symbol *sym1, *sym2;
     int i;
@@ -396,7 +402,7 @@ bool regsInCommon (operand *op1, operand *op2)
 /*-----------------------------------------------------------------*/
 /* operandsEqu - equivalent                                        */
 /*-----------------------------------------------------------------*/
-bool operandsEqu ( operand *op1, operand *op2)
+static bool operandsEqu ( operand *op1, operand *op2)
 {
     symbol *sym1, *sym2;
 
@@ -441,7 +447,7 @@ bool operandsEqu ( operand *op1, operand *op2)
 /*-----------------------------------------------------------------*/
 /* sameRegs - two asmops have the same registers                   */
 /*-----------------------------------------------------------------*/
-bool sameRegs (asmop *aop1, asmop *aop2 )
+static bool sameRegs (asmop *aop1, asmop *aop2 )
 {
     int i;
 
@@ -653,39 +659,6 @@ dealloc:
     }
 }
 
-/*-----------------------------------------------------------------*/
-/* aopLiteral - string from a literal value                        */
-/*-----------------------------------------------------------------*/
-char *aopLiteral (value *val, int offset)
-{
-    char *rs;
-    union {
-        float f;
-        unsigned char c[4];
-    } fl;
-
-    /* if it is a float then it gets tricky */
-    /* otherwise it is fairly simple */
-    if (!IS_FLOAT(val->type)) {
-        unsigned long v = floatFromVal(val);
-
-        v >>= (offset * 8);
-        sprintf(buffer,"#0x%02x",((char) v) & 0xff);
-        ALLOC_ATOMIC(rs,strlen(buffer)+1);
-        return strcpy (rs,buffer);
-    }
-
-    /* it is type float */
-    fl.f = (float) floatFromVal(val);
-#ifdef _BIG_ENDIAN    
-    sprintf(buffer,"#0x%02x",fl.c[3-offset]);
-#else
-    sprintf(buffer,"#0x%02x",fl.c[offset]);
-#endif
-    ALLOC_ATOMIC(rs,strlen(buffer)+1);
-    return strcpy (rs,buffer);
-}
-
 /*-----------------------------------------------------------------*/
 /* aopGet - for fetching value of the aop                          */
 /*-----------------------------------------------------------------*/
@@ -1041,8 +1014,8 @@ static void reAdjustPreg (asmop *aop)
                         AOP_TYPE(x) == AOP_DPTR || AOP(x)->paged)) 
 
 #define AOP_INPREG(x) (x && (x->type == AOP_REG &&                        \
-                      (x->aopu.aop_reg[0] == regWithIdx(R0_IDX) || \
-                      x->aopu.aop_reg[0] == regWithIdx(R1_IDX) )))
+                      (x->aopu.aop_reg[0] == mcs51_regWithIdx(R0_IDX) || \
+                      x->aopu.aop_reg[0] == mcs51_regWithIdx(R1_IDX) )))
 
 /*-----------------------------------------------------------------*/
 /* genNotFloat - generates not for float operations              */
@@ -1085,7 +1058,7 @@ static void genNotFloat (operand *op, operand *res)
 /*-----------------------------------------------------------------*/
 /* getDataSize - get the operand data size                         */
 /*-----------------------------------------------------------------*/
-int getDataSize(operand *op)
+static int getDataSize(operand *op)
 {
     int size;
     size = AOP_SIZE(op);
@@ -1098,7 +1071,7 @@ int getDataSize(operand *op)
 /*-----------------------------------------------------------------*/
 /* outAcc - output Acc                                             */
 /*-----------------------------------------------------------------*/
-void outAcc(operand *result)
+static void outAcc(operand *result)
 {
     int size, offset;
     size = getDataSize(result);
@@ -1116,7 +1089,7 @@ void outAcc(operand *result)
 /*-----------------------------------------------------------------*/
 /* outBitC - output a bit C                                        */
 /*-----------------------------------------------------------------*/
-void outBitC(operand *result)
+static void outBitC(operand *result)
 {
     /* if the result is bit */
     if (AOP_TYPE(result) == AOP_CRY) 
@@ -1131,7 +1104,7 @@ void outBitC(operand *result)
 /*-----------------------------------------------------------------*/
 /* toBoolean - emit code for orl a,operator(sizeop)                */
 /*-----------------------------------------------------------------*/
-void toBoolean(operand *oper)
+static void toBoolean(operand *oper)
 {
     int size = AOP_SIZE(oper) - 1;
     int offset = 1;
@@ -1349,7 +1322,7 @@ static void saveRegisters(iCode *lic)
                if (i == R0_IDX)
                    emitcode("mov","a,b");
                else
-                   emitcode("mov","a,%s",regWithIdx(i)->name);
+                   emitcode("mov","a,%s",mcs51_regWithIdx(i)->name);
                emitcode("movx","@r0,a");
                emitcode("inc","r0");
            }
@@ -1360,7 +1333,7 @@ static void saveRegisters(iCode *lic)
     } else
        for (i = 0 ; i < mcs51_nRegs ; i++) {
            if (bitVectBitValue(rsave,i))
-               emitcode("push","%s",regWithIdx(i)->dname);
+               emitcode("push","%s",mcs51_regWithIdx(i)->dname);
        }
 
     detype = getSpec(operandType(IC_LEFT(ic)));
@@ -1393,7 +1366,7 @@ static void unsaveRegisters (iCode *ic)
                if (i == R0_IDX)
                    emitcode("mov","b,a");
                else
-                   emitcode("mov","%s,a",regWithIdx(i)->name);
+                   emitcode("mov","%s,a",mcs51_regWithIdx(i)->name);
            }       
 
        }
@@ -1403,7 +1376,7 @@ static void unsaveRegisters (iCode *ic)
     } else
        for (i =  mcs51_nRegs ; i >= 0 ; i--) {
            if (bitVectBitValue(rsave,i))
-               emitcode("pop","%s",regWithIdx(i)->dname);
+               emitcode("pop","%s",mcs51_regWithIdx(i)->dname);
        }
 
 }  
@@ -1412,7 +1385,7 @@ static void unsaveRegisters (iCode *ic)
 /*-----------------------------------------------------------------*/
 /* pushSide -                                                     */
 /*-----------------------------------------------------------------*/
-void pushSide(operand * oper, int size)
+static void pushSide(operand * oper, int size)
 {
        int offset = 0;
        while (size--) {
@@ -1430,7 +1403,7 @@ void pushSide(operand * oper, int size)
 /*-----------------------------------------------------------------*/
 /* assignResultValue -                                            */
 /*-----------------------------------------------------------------*/
-void assignResultValue(operand * oper)
+static void assignResultValue(operand * oper)
 {
        int offset = 0;
        int size = AOP_SIZE(oper);
@@ -1949,7 +1922,7 @@ static void genFunction (iCode *ic)
                    for ( i = 0 ; i < sym->regsUsed->size ; i++) {
                        if (bitVectBitValue(sym->regsUsed,i) ||
                           (mcs51_ptrRegReq && (i == R0_IDX || i == R1_IDX)) )
-                           emitcode("push","%s",regWithIdx(i)->dname);                     
+                           emitcode("push","%s",mcs51_regWithIdx(i)->dname);                       
                    }
                }
                
@@ -1972,7 +1945,7 @@ static void genFunction (iCode *ic)
                for ( i = 0 ; i < sym->regsUsed->size ; i++) {
                    if (bitVectBitValue(sym->regsUsed,i) ||
                       (mcs51_ptrRegReq && (i == R0_IDX || i == R1_IDX)) ) {
-                       emitcode("push","%s",regWithIdx(i)->dname);
+                       emitcode("push","%s",mcs51_regWithIdx(i)->dname);
                        _G.nRegsSaved++;
                    }
                }
@@ -2083,7 +2056,7 @@ static void genEndFunction (iCode *ic)
                    for ( i = sym->regsUsed->size ; i >= 0 ; i--) {
                        if (bitVectBitValue(sym->regsUsed,i) ||
                           (mcs51_ptrRegReq && (i == R0_IDX || i == R1_IDX)) )
-                           emitcode("pop","%s",regWithIdx(i)->dname);
+                           emitcode("pop","%s",mcs51_regWithIdx(i)->dname);
                    }
                }
                
@@ -2136,7 +2109,7 @@ static void genEndFunction (iCode *ic)
                for ( i = sym->regsUsed->size ; i >= 0 ; i--) {
                    if (bitVectBitValue(sym->regsUsed,i) ||
                       (mcs51_ptrRegReq && (i == R0_IDX || i == R1_IDX)) )
-                       emitcode("pop","%s",regWithIdx(i)->dname);
+                       emitcode("pop","%s",mcs51_regWithIdx(i)->dname);
                }
            }
            
@@ -2329,7 +2302,7 @@ static bool genPlusIncr (iCode *ic)
 /*-----------------------------------------------------------------*/
 /* outBitAcc - output a bit in acc                                 */
 /*-----------------------------------------------------------------*/
-void outBitAcc(operand *result)
+static void outBitAcc(operand *result)
 {
     symbol *tlbl = newiTempLabel(NULL);
     /* if the result is a bit */
@@ -3574,7 +3547,7 @@ static void genOrOp (iCode *ic)
 /*-----------------------------------------------------------------*/
 /* isLiteralBit - test if lit == 2^n                               */
 /*-----------------------------------------------------------------*/
-int isLiteralBit(unsigned long lit)
+static int isLiteralBit(unsigned long lit)
 {
     unsigned long pw[32] = {1L,2L,4L,8L,16L,32L,64L,128L,
     0x100L,0x200L,0x400L,0x800L,
index 6dd76d9242338d651e29f0f2ba0f3924a0779b79..0d34e392dcf2c23c0fc55f9721e8477919768f11 100644 (file)
@@ -1,5 +1,6 @@
 #include "common.h"
 #include "main.h"
+#include "ralloc.h"
 
 void mcs51_assignRegisters (eBBlock **ebbs, int count);
 
@@ -16,6 +17,13 @@ static void _mcs51_setDefaultOptions(void)
 {    
 }
 
+static const char *_mcs51_getRegName(struct regs *reg)
+{
+    if (reg)
+       return reg->name;
+    return "err";
+}
+
 /* Globals */
 PORT mcs51_port = {
     "mcs51",
@@ -43,6 +51,7 @@ PORT mcs51_port = {
     _mcs51_parseOptions,
     _mcs51_finaliseOptions,
     _mcs51_setDefaultOptions,
-    mcs51_assignRegisters
+    mcs51_assignRegisters,
+    _mcs51_getRegName
 };
 
index 1154d534c4f372b30083f85bdb92feaf99bd5ef2..9e0ccc9db7768b57dc644ad319d4f724922cc7ff 100644 (file)
@@ -92,7 +92,7 @@ void spillThis (symbol *);
 /*-----------------------------------------------------------------*/
 /* allocReg - allocates register of given type                     */
 /*-----------------------------------------------------------------*/
-regs *allocReg (short type)
+static regs *allocReg (short type)
 {
     int i;
 
@@ -123,9 +123,9 @@ regs *allocReg (short type)
 }
 
 /*-----------------------------------------------------------------*/
-/* regWithIdx - returns pointer to register wit index number       */
+/* mcs51_regWithIdx - returns pointer to register wit index number       */
 /*-----------------------------------------------------------------*/
-regs *regWithIdx (int idx)
+regs *mcs51_regWithIdx (int idx)
 {
     int i ;
     
@@ -141,7 +141,7 @@ regs *regWithIdx (int idx)
 /*-----------------------------------------------------------------*/
 /* freeReg - frees a register                                      */
 /*-----------------------------------------------------------------*/
-void freeReg (regs *reg)
+static void freeReg (regs *reg)
 {
     reg->isFree = 1;
 }
@@ -150,7 +150,7 @@ void freeReg (regs *reg)
 /*-----------------------------------------------------------------*/
 /* nFreeRegs - returns number of free registers                    */
 /*-----------------------------------------------------------------*/
-int nFreeRegs (int type)
+static int nFreeRegs (int type)
 {
     int i;
     int nfr=0;
@@ -164,7 +164,7 @@ int nFreeRegs (int type)
 /*-----------------------------------------------------------------*/
 /* nfreeRegsType - free registers with type                         */
 /*-----------------------------------------------------------------*/
-int nfreeRegsType (int type)
+static int nfreeRegsType (int type)
 {
     int nfr ;
     if (type == REG_PTR) {
@@ -179,7 +179,7 @@ int nfreeRegsType (int type)
 /*-----------------------------------------------------------------*/
 /* allDefsOutOfRange - all definitions are out of a range          */
 /*-----------------------------------------------------------------*/
-bool allDefsOutOfRange (bitVect *defs,int fseq, int toseq) 
+static bool allDefsOutOfRange (bitVect *defs,int fseq, int toseq) 
 {
     int i ;
 
@@ -203,7 +203,7 @@ bool allDefsOutOfRange (bitVect *defs,int fseq, int toseq)
 /*-----------------------------------------------------------------*/
 /* computeSpillable - given a point find the spillable live ranges */
 /*-----------------------------------------------------------------*/
-bitVect *computeSpillable (iCode *ic)
+static bitVect *computeSpillable (iCode *ic)
 {
     bitVect *spillable ;
 
@@ -228,7 +228,7 @@ bitVect *computeSpillable (iCode *ic)
 /*-----------------------------------------------------------------*/
 /* noSpilLoc - return true if a variable has no spil location      */
 /*-----------------------------------------------------------------*/
-int noSpilLoc (symbol *sym, eBBlock *ebp,iCode *ic)
+static int noSpilLoc (symbol *sym, eBBlock *ebp,iCode *ic)
 {
     return (sym->usl.spillLoc ? 0 : 1);
 }
@@ -236,7 +236,7 @@ int noSpilLoc (symbol *sym, eBBlock *ebp,iCode *ic)
 /*-----------------------------------------------------------------*/
 /* hasSpilLoc - will return 1 if the symbol has spil location      */
 /*-----------------------------------------------------------------*/
-int hasSpilLoc (symbol *sym, eBBlock *ebp, iCode *ic)
+static int hasSpilLoc (symbol *sym, eBBlock *ebp, iCode *ic)
 {
     return (sym->usl.spillLoc ? 1 : 0);
 }
@@ -244,7 +244,7 @@ int hasSpilLoc (symbol *sym, eBBlock *ebp, iCode *ic)
 /*-----------------------------------------------------------------*/
 /* directSpilLoc - will return 1 if the splilocation is in direct  */
 /*-----------------------------------------------------------------*/
-int directSpilLoc (symbol *sym, eBBlock *ebp, iCode *ic)
+static int directSpilLoc (symbol *sym, eBBlock *ebp, iCode *ic)
 {
     if ( sym->usl.spillLoc &&
         (IN_DIRSPACE(SPEC_OCLS(sym->usl.spillLoc->etype))))
@@ -257,7 +257,7 @@ int directSpilLoc (symbol *sym, eBBlock *ebp, iCode *ic)
 /* hasSpilLocnoUptr - will return 1 if the symbol has spil location*/
 /*                    but is not used as a pointer                 */
 /*-----------------------------------------------------------------*/
-int hasSpilLocnoUptr (symbol *sym, eBBlock *ebp, iCode *ic)
+static int hasSpilLocnoUptr (symbol *sym, eBBlock *ebp, iCode *ic)
 {
     return ((sym->usl.spillLoc && !sym->uptr) ? 1 : 0);
 }
@@ -265,7 +265,7 @@ int hasSpilLocnoUptr (symbol *sym, eBBlock *ebp, iCode *ic)
 /*-----------------------------------------------------------------*/
 /* rematable - will return 1 if the remat flag is set              */
 /*-----------------------------------------------------------------*/
-int rematable (symbol *sym, eBBlock *ebp, iCode *ic)
+static int rematable (symbol *sym, eBBlock *ebp, iCode *ic)
 {
     return sym->remat;
 }
@@ -273,7 +273,7 @@ int rematable (symbol *sym, eBBlock *ebp, iCode *ic)
 /*-----------------------------------------------------------------*/
 /* notUsedInBlock - not used in this block                         */
 /*-----------------------------------------------------------------*/
-int notUsedInBlock (symbol *sym, eBBlock *ebp, iCode *ic)
+static int notUsedInBlock (symbol *sym, eBBlock *ebp, iCode *ic)
 {   
     return (!bitVectBitsInCommon(sym->defs,ebp->usesDefs) &&
            allDefsOutOfRange (sym->defs,ebp->fSeq,ebp->lSeq));
@@ -419,8 +419,8 @@ void spillLRWithPtrReg (symbol *forSym)
        bitVectIsZero(_G.regAssigned))
        return;
 
-    r0 = regWithIdx(R0_IDX);
-    r1 = regWithIdx(R1_IDX);
+    r0 = mcs51_regWithIdx(R0_IDX);
+    r1 = mcs51_regWithIdx(R1_IDX);
 
     /* for all live ranges */
     for (lrsym = hTabFirstItem(liveRanges,&k) ; lrsym ; 
index 4db755fb0f68b996336508e5a78ab9badb9ada5a..0e1ecbe049113e67ea8b0bee55ca361f4bb576b9 100644 (file)
@@ -52,7 +52,6 @@ typedef struct regs
 } regs;
 extern regs regs8051[];
 
-void   assignRegisters (eBBlock **, int );
-regs  *regWithIdx (int);
+regs  *mcs51_regWithIdx (int);
 
 #endif
index 2d390891ba8e8b31bc20f5eed3f5dfcc9021bbe3..756efb38ac7e3ac3dccb8f344626c3d6b77081c7 100644 (file)
@@ -64,6 +64,9 @@ typedef struct {
     void (*setDefaultOptions)(void);
     /** Does the dirty work. */
     void (*assignRegisters)(eBBlock **, int);
+    /** Returns the register name of a symbol.
+       Used so that 'regs' can be an incomplete type. */
+    const char *(*getRegName)(struct regs *reg);
 } PORT;
 
 extern PORT *port;