* src/z80/peep.c: fixed msvc warning C4047:
[fw/sdcc] / src / mcs51 / main.c
index ef5407e8cfe1126d4eaa4ac7c85fb626ebb34f95..1904e14985be2f24c48be2c669994a6a45c06739 100644 (file)
@@ -8,6 +8,7 @@
 #include "main.h"
 #include "ralloc.h"
 #include "gen.h"
+#include "peep.h"
 #include "dbuf_string.h"
 #include "../SDCCutil.h"
 
@@ -24,6 +25,7 @@ static OPTION _mcs51_options[] =
     { 0, "--parms-in-bank1", &options.parms_in_bank1, "use Bank1 for parameter passing"},
     { 0, "--pack-iram",      NULL, "Tells the linker to pack variables in internal ram (default)"},
     { 0, "--no-pack-iram",   &options.no_pack_iram, "Tells the linker not to pack variables in internal ram"},
+    { 0, "--acall-ajmp",     &options.acall_ajmp, "Use acall/ajmp instead of lcall/ljmp" },
     { 0, NULL }
   };
 
@@ -191,16 +193,17 @@ _mcs51_genIVT (struct dbuf_s * oBuf, symbol ** interrupts, int maxInterrupts)
 {
   int i;
 
-  dbuf_printf (oBuf, "\tljmp\t__sdcc_gsinit_startup\n");
+  dbuf_printf (oBuf, "\t%cjmp\t__sdcc_gsinit_startup\n", options.acall_ajmp?'a':'l');
+  if((options.acall_ajmp)&&(maxInterrupts)) dbuf_printf (oBuf, "\t.ds\t1\n");
 
   /* now for the other interrupts */
   for (i = 0; i < maxInterrupts; i++)
     {
       if (interrupts[i])
         {
-          dbuf_printf (oBuf, "\tljmp\t%s\n", interrupts[i]->rname);
+          dbuf_printf (oBuf, "\t%cjmp\t%s\n", options.acall_ajmp?'a':'l', interrupts[i]->rname);
           if ( i != maxInterrupts - 1 )
-            dbuf_printf (oBuf, "\t.ds\t5\n");
+            dbuf_printf (oBuf, "\t.ds\t%d\n", options.acall_ajmp?6:5);
         }
       else
         {
@@ -721,7 +724,7 @@ PORT mcs51_port =
     MODEL_SMALL | MODEL_MEDIUM | MODEL_LARGE,
     MODEL_SMALL
   },
-  {
+  {                             /* Assembler */
     _asmCmd,
     NULL,
     "-plosgffc",                /* Options with debug */
@@ -730,19 +733,20 @@ PORT mcs51_port =
     ".asm",
     NULL                        /* no do_assemble function */
   },
-  {
+  {                             /* Linker */
     _linkCmd,
     NULL,
     NULL,
     ".rel",
     1
   },
-  {
+  {                             /* Peephole optimizer */
     _defaultRules,
     getInstructionSize,
     getRegsRead,
     getRegsWritten,
-    mcs51DeadMove
+    mcs51DeadMove,
+    0
   },
   {
     /* Sizes: char, short, int, long, ptr, fptr, gptr, bit, float, max */