added "banked" for z80 port
authorsandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 25 Jun 2000 02:26:46 +0000 (02:26 +0000)
committersandeep <sandeep@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 25 Jun 2000 02:26:46 +0000 (02:26 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@286 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCC.lex
src/SDCC.y
src/SDCCsymt.c
src/SDCCsymt.h
src/z80/gen.c
src/z80/main.c

index cd19d787befd8efc7dc4bc4b1fefeb466818bdce..babc6261bff4a5a90a429fcc2dfded9ec1e03a0f 100644 (file)
@@ -117,6 +117,7 @@ struct options  save_options  ;
 "if"           { count(); return(IF); }
 "int"          { count(); return(INT); }
 "interrupt"    { count(); return(INTERRUPT);}
+"banked"       { count(); TKEYWORD(BANKED);}
 "long"        { count(); return(LONG); }
 "near"        { count(); TKEYWORD(DATA);}
 "pdata"        { count(); TKEYWORD(PDATA); }
index 6d10f0fe4ac07ad130f2587fa1dfe7a9f917182d..1d547ce8ceeeb0f603d43c9e839d028cfa42d446 100644 (file)
@@ -77,7 +77,7 @@ value *cenum = NULL  ;  /* current enumeration  type chain*/
 %token <yyint> SUB_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN
 %token <yyint> XOR_ASSIGN OR_ASSIGN
 %token TYPEDEF EXTERN STATIC AUTO REGISTER CODE EEPROM INTERRUPT SFR AT SBIT
-%token REENTRANT USING  XDATA DATA IDATA PDATA VAR_ARGS CRITICAL
+%token REENTRANT USING  XDATA DATA IDATA PDATA VAR_ARGS CRITICAL BANKED
 %token CHAR SHORT INT LONG SIGNED UNSIGNED FLOAT DOUBLE CONST VOLATILE VOID BIT
 %token STRUCT UNION ENUM ELIPSIS RANGE FAR _XDATA _CODE _GENERIC _NEAR _PDATA _IDATA _EEPROM
 %token CASE DEFAULT IF ELSE SWITCH WHILE DO FOR GOTO CONTINUE BREAK RETURN 
@@ -165,6 +165,10 @@ using_reentrant_interrupt
                         $$->class = SPECIFIER   ;
                         SPEC_CRTCL($$) = 1;
                      }
+   |  BANKED         {$$ = newLink ();
+                        $$->class = SPECIFIER   ;
+                        SPEC_BANKED($$) = 1;
+                     }
    |  Interrupt_storage
                      {
                         $$ = newLink () ;
index 437624a0e4f19fa3159e4fce3609c832710047f4..0c666cbaa219480cffcd73eda8ec10a78b0d9a5b 100644 (file)
@@ -420,6 +420,7 @@ link  *mergeSpec ( link *dest, link *src )
     SPEC_BLEN(dest) |= SPEC_BLEN(src);
     SPEC_BSTR(dest) |= SPEC_BSTR(src);
     SPEC_TYPEDEF(dest) |= SPEC_TYPEDEF(src);
+    SPEC_BANKED(dest) |= SPEC_BANKED(src);
 
     if ( IS_STRUCT(dest) && SPEC_STRUCT(dest) == NULL )
        SPEC_STRUCT(dest) = SPEC_STRUCT(src);   
index 517c49e7735788c4e0e01533cf0f22ebc9e2ed0c..504609c652cdcfdf4cb24684d2eefc8a4d0f6a34 100644 (file)
@@ -101,6 +101,7 @@ typedef struct specifier {
     unsigned   _typedef :1  ;  /* is typedefed               */
     unsigned   _isregparm:1 ;  /* is the first parameter     */
     unsigned   _isenum   :1 ;  /* is an enumerated type      */
+    unsigned    banked   :1      ;  /* function has banked attribute */
     unsigned   _IntNo       ;  /* 1=Interrupt svc routine    */
     short      _regbank     ;  /* register bank 2b used      */
     unsigned   _addr        ;  /* address of symbol          */
@@ -278,6 +279,7 @@ typedef struct symbol {
 #define SPEC_STRUCT(x) x->select.s.v_struct
 #define SPEC_TYPEDEF(x) x->select.s._typedef
 #define SPEC_REGPARM(x) x->select.s._isregparm
+#define SPEC_BANKED(x) x->select.s.banked
 
 /* type check macros */
 #define IS_DECL(x)   ( x && x->class == DECLARATOR     )
@@ -324,6 +326,7 @@ typedef struct symbol {
 #define IS_LITERAL(x)   (IS_SPEC(x)  && x->select.s.sclass == S_LITERAL)
 #define IS_ISR(x)              (IS_SPEC(x)  && SPEC_INTRTN(x))
 #define IS_REGPARM(x)   (IS_SPEC(x) && SPEC_REGPARM(x))
+#define IS_BANKED(x)   (IS_SPEC(x) && SPEC_BANKED(x))
 
 /* forward declaration for the global vars */
 extern bucket *SymbolTab[] ;
index e283cfe464ab9287adef5faef64ee2f2e61a1feb..c0701734d11cc298faab3bde348cd23546538751 100644 (file)
@@ -1756,6 +1756,8 @@ static void emitCall(iCode *ic, bool ispcall)
 /*-----------------------------------------------------------------*/
 static void genCall (iCode *ic)
 {
+    link *detype = getSpec(operandType(IC_LEFT(ic)));
+    if (IS_BANKED(detype)) emit2("; call to a banked function");
     emitCall(ic, FALSE);
 }
 
@@ -1798,12 +1800,13 @@ static void genFunction (iCode *ic)
     /* PENDING: portability. */
     emit2("__%s_start:", sym->rname);
     emit2("!functionlabeldef", sym->rname);
-
+   
     fetype = getSpec(operandType(IC_LEFT(ic)));
-
+    
     /* if critical function then turn interrupts off */
     if (SPEC_CRTCL(fetype))
        emit2("!di");
+    if (SPEC_BANKED(fetype)) emit2("; Iam banked");
 
     /* if this is an interrupt service routine then
     save acc, b, dpl, dph  */
index ee4fe7fc5fe9a55c627d2f6c00bc5d0d2fe1cd2d..24f8b2b93e84afc993d75360e6f4cb91c972b675 100644 (file)
@@ -20,6 +20,7 @@ static struct {
 
 static char *_keywords[] = {
     "sfr",
+    "banked",
     NULL 
 };