Shop OBEX P1 Docs P2 Docs Learn Events
SSP Small SmallC Compiler for the prop reaches about factor 5 to spin: Experime — Parallax Forums

SSP Small SmallC Compiler for the prop reaches about factor 5 to spin: Experime

Christof Eb.Christof Eb. Posts: 1,161
edited 2007-04-02 08:58 in Propeller 1
Hello,

perhaps this is now of some use (or fun?) to somebody. It is still far from beeing without bugs. And it is not complete, but perhaps someone wants to play with it too.

"Small SmallC for the Prop" reaches about speed factor 5 compared to spin. (Factor 5.5 in the given example)
I think I will not try to make a long memory modell after this result, because then the speed will be no greater than spin. A compiler for a long memory modell will have to be better.... That was discussed in http://forums.parallax.com/forums/default.aspx?f=25&m=177100

It uses a small memory modell running in cog ram and is therefore rather limited in code length.
It uses only long vars, declared as int.
Global vars are fast and in cog ram like registers.
Local variables are placed in main ram on a stack.
Division gives only 16bit result at the moment. (I tend to want to work on this...)
Between #asm and #endasm you can add pure assembler code or pass other things to the spin system.
Long or negative constants have to be treated like global variables, see example.

Functions, function calls,
if-then-else, while, for(;[noparse];)[/noparse],
local (stack) variables, global (cog-ram) variables, local arrays, register access, pointers,
Addition, Subtraction, Multiply, Division, >>, << , > , <,
&, ! ,
seem to work.

The file StartPro.c has to be included and will provide the interface to the spin environment.

The batch file ccs.bat
ccs filename
will make a filename.spin from filename.c.

The batch file ccssp will compile the compiler after you have modified ssp4.c. In this file the assembler code, that is produced, is defined.

I am posting this now, because I am going to abandon this project now at least for a while.
Nevertheless I would be interested in feedback or if someone will try this.

Christof

Comments

  • IWriteCodeIWriteCode Posts: 16
    edited 2007-04-02 08:58
    Nice job on the small C compiler... I'm currently not able to test the compiler you made... but it's exciting you got it to work! Also very nice you're sharing your experiences with the community... (and I find the lack of response to this thread a bit saddening...)

    Best regards and keep up the good work!!
Sign In or Register to comment.