#281 A new "class" of functions

open
nobody
z80 port (29)
5
2009-10-25
2009-10-25
fullmetalcoder
No

I find myself in a case which I suspect is not that rare : I need to wrap system calls for a particular platform (z80 in my case but I'm sure the ssue is similar in all ports) in a lib to make them available to C code. My two problems are :

* writing all the wrappers by hand is cumbersome
* the resulting is *dramatically underoptimized*

my proposal is to define a new class of function that go beyond what _naked offers and specify which registers should be used for parameter passing (for both input and output). This would open huge opportunities for optimizations, do away with wasteful use of index registers and stack and vastly reduce the overhead of wrapper functions at all levels (writing, size and speed).

I have no idea how hard this would be to implement and unsure as to what would be the best way to add these attributes to function declaration but what I'm dead sure about is that it would be a huge improvement that would increase the competitivity of C over handwritten assembly and that's something I'm interested in.

Discussion

  • fullmetalcoder
    fullmetalcoder
    2009-10-25

    • labels: --> z80 port