From: Philipp K. K. <pk...@sp...> - 2012-03-28 11:41:31
|
Dear sdcc developers, IMO the feature most missed in sdcc is full support for struct (and union, not mentioned separately below, but included whenever I mention struct). sdcc can currently not assign them, pass them as parameters or return them. THis prevents sdcc from provifing parts of the standard library and from compiling many standard-compliant programs. I've had a look at this once in a while, but since I am not really familiar with the frontend, I never managed to sort it out of all the struct decaying to pointer stuff, etc which is there. I've recently implemented some parts of long long support in some backends, and think that structs can be handled in a similar way. So if some of you would take care of the frontend stuff, I'd be eager to implement the required support in the z80-backends (the other ports can follow later). Philipp P.S.: I think struct passsing and returning could be handled by the backend entirely (I'd do it similar to long long for the z890-related). Struct assignment on the other hand seems a bit different: The way structs are currently placed on the stack, we could just replace struct assignment by memcpy() or the build-in variant like we currently do for some arithmetic operations. On the other hand, more efficient stack usage might require the use of memmove() instead. However, the on-stack locations, which might overlap are known at code-generation time, so the backends could do it more efficiently. I suggest the following: Have a field in the port structure that signifies if the port is okay with memcpy, or wants to do struct assignment itself (similar to how we currently handle multiplication). |