#41 e_XINIT (or: saving 10 byte)

closed
nobody
None
1
2003-11-01
2003-11-01
No

Hi,

currently the end of the initialized xdata
variables is calculated as s_XINIT+l_XINIT
at runtime in the mcs51 startup routine.
If the linker would generate a symbol for
the end of XINIT area (e_XINIT) this would
save 10 byte on each program:

--- src/mcs51/main.c.orig 2003-08-08
05:52:39.000000000 +0200
+++ src/mcs51/main.c 2003-11-01 17:54:01.000000000
+0100
@@ -157,16 +157,10 @@
static void _mcs51_genXINIT (FILE * of) {
fprintf (of, "; _mcs51_genXINIT() start\n");
fprintf (of, " mov a,#l_XINIT\n");
fprintf (of, " orl a,#l_XINIT>>8\n");
fprintf (of, " jz 00003$\n");
- fprintf (of, " mov a,#s_XINIT\n");
- fprintf (of, " add a,#l_XINIT\n");
- fprintf (of, " mov r1,a\n");
- fprintf (of, " mov a,#s_XINIT>>8\n");
- fprintf (of, " addc a,#l_XINIT>>8\n");
- fprintf (of, " mov r2,a\n");
fprintf (of, " mov dptr,#s_XINIT\n");
fprintf (of, " mov r0,#s_XISEG\n");
fprintf (of, " mov p2,#(s_XISEG >> 8)
\n");
fprintf (of, "00001$: clr a\n");
fprintf (of, " movc a,@a+dptr\n");
@@ -174,13 +168,13 @@
fprintf (of, " inc dptr\n");
fprintf (of, " inc r0\n");
fprintf (of, " cjne r0,#0,00002$\n");
fprintf (of, " inc p2\n");
fprintf (of, "00002$: mov a,dpl\n");
- fprintf (of, " cjne a,ar1,00001$\n");
+ fprintf (of, " cjne a,#e_XINIT,00001$
\n");
fprintf (of, " mov a,dph\n");
- fprintf (of, " cjne a,ar2,00001$\n");
+ fprintf (of, " cjne a,#e_XINIT>>8,00001$
\n");
fprintf (of, " mov p2,#0xFF\n");
fprintf (of, "00003$:\n");
fprintf (of, "; _mcs51_genXINIT() end\n");
}

Discussion

  • Frieder Ferlemann

    • status: open --> closed
     
  • Frieder Ferlemann

    Logged In: YES
    user_id=589052

    obsoleted with sdcc/src/mcs51/main.c, 1.71

    sorry for the noise.

     

Log in to post a comment.