The stm8 port at

svn.code.sf.net/p/sdcc/code/branches/stm8/sdcc

is improving quickly, and I hope will be at least somewhat usable soon;
I guess it will be ready for merging into trunk immediately after the
3.3.0 release.

However, currently I am busy working on code generation, Valentin is
busy working on the simulator and various smaller tasks all around.

There is one other item: The peephole optimizer. This one can be worked
on independently from the other tasks, so I think it would be a good
start for someone wanting to help with the stm8 port.

A peephole optimizer is an optimization stage after code generation.
Basically it looks at small excerpts of asm code and replaces them by
more efficient code, according to rules from a a file. It is basically
the last thing the compiler does before handing the asm code to the
assembler.

The application of these rules can be conditional, using some helper
functions. E.g. replacing a long jump by a short jump depends on a
helper function telling us how far away the jump target is. This example
seems to be particularly important, since the stm8 only has short
conditional jumps. To be safe, code generation generates code like

        tnz     (0x04, sp)
        jrne    00121$
        jp      00106$
00121$:

Since code generation does not know how far away 00106$ is. The peephole
optimizer could then optimize this into

        tnz     (0x04, sp)
        jreq    00106$

If 00106$ is nearby. To someone willing to help, I would suggest having
a look at peep.h and peep.c in the z80 port, and then write stm8
equivalents of these functions:

int z80instructionSize(lineNode *node);
bool z80notUsed(const char *what, lineNode *endPl, lineNode *head);
bool z80notUsedFrom(const char *what, const char *label, lineNode *head);

Philipp

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to