Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Why compilers are retarded

Name: Cudder !MhMRSATORI 2014-09-09 4:38

Suppose I have a set of functions, written in Asm, which take as input parameters in registers, and also output multiple values in registers. In C, this would look like

struct { int n; char *e; char *f; }
phoo(int ni, void *p, char *ei, char *fi);


which is nothing special, but the problem is that no compiler I know of will allow specifying where the parameters and returns are!! They all only support a very limited set of "calling conventions", and nothing else. There's no way to write something like

struct { int n@eax; char *e@esi; char *f@edi; }
phoo(int ni@ecx, void *p@edx, char *ei@esi, char *fi@edi);


and have existing compilers generate the appropriate code when calling and using the return values. Is it really so hard to, when compiling a function call,

1. Look up where the function wants its parameters
2. Evaluate the parameters and put them in the right places
3. Call the function
4. Direct any expressions using its the return value(s) to read from the right places

instead of following a stupid cookie-cutter template every time? Am I going to have to write a compiler too?

As they say, "If you want it done right, do it yourself..."

Name: Anonymous 2014-09-09 14:13

>>3
Write a DSL for this.

But I am not a Lisp programmer, and therefore do not know how to do that ;(

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List