Hi, I can't say anything about arm but from the generic part I think this looks very good.
Related to adding it on the 'real' mob branch: * use rebase or cherry-pick (don't use merge) * note that tests2.114 already exists * add the .expect files too * you could still combine the commits into one or two if you want * 117_cleanup_nofloat.c : INCR_GI7 is really slow and probably wouldn't find bugs that INCR_GI3 for example would not. * 118_float_branches.c : print_double() would print for example 0.299 instead of 0.300 in cases. This version works for me: int s = d < 0 ? -1000 : 1000; int f = d * s + 0.1; int i = f / s; f = f % 1000; * lib/Makefile : XFLAGS += -DTCC_TARGET_ARM_THUMB is never used, anyway the library files shouldn't check TCC_TARGET_* but rather the run-time processor symbols (such as __arm__ etc.) You might want to add some notes somewhere though, about how people can build this and how and where they can use it at all. ;) --- grischka Erlend Sveen wrote:
Hi, It's been a while now since I've been working on and off various projects for the last few months, but I finally think my TCC additions are ready for a second pair of eyes (and more). I hope you have some time to look at it before I try getting it into the "real" repo. Initially I wrote that I would not implement any floating point stuff, but after looking over the instruction set I found that it was way easier than I expected. I also got TCC to run on the microcontroller itself, which also took a fair bit of time. I think this is quite cool, lots of stories about people running Linux on their micros but not as many about compilers as far as I can tell! In fact I've found no articles at all after some minutes of searching. People have done interpreters but I could not find anything for C. Since I don't want to break the main repo I've put up a temporary one before I try committing anything to the mob branch. I hoped to make it in one commit but ended up with multiple, so here is an explanation of them and links: https://git.erlendjs.no/erlendjs/tinycc/commit/9e5ef0bbab28379b1ecbd7c167892e3af5f14a8d - This adds the most of the code, please see the commit message for an explanation. The most important bits are of course changes to existing files. https://git.erlendjs.no/erlendjs/tinycc/commit/8698aa391929c5c5f1ae529bda4f98f1d382545f - Once I started compiling "real" code I found some bugs, this fixes some. https://git.erlendjs.no/erlendjs/tinycc/commit/3f8c5163b4d1fe2582d916a231c5e16bbbebf154 - Adds float support back in and a new test, please see the commit message. It also cleans up a bunch of stuff, fixes some bugs and adds another test to trigger more branches. At this point there are some things left that I have not figured out yet. I hope maybe someone can help a bit with these, either by code or feedback on how to do things: * Interwork between ARM state and Thumb state. Probably required to get it working on a Raspberry Pi. But not required for MCU use. * The linker in TCC does not seem to work, so I've used the GNU one. * Adding a flag similar to "-mcpu", "-march", "-vfp?" etc. to keep control of which FPU ISA it uses. I expect that the current code will cause some troble linking with elf files that specify e.g. no FPU despite not actually having generated any FPU instructions. * Using floats requires a Cortex-M7 with double precision, since there are no fallbacks to the library routines. Could be fixed if the previous point is implemented. * There is a branch in the store function that I could not figure out how to test, so it remains unimplemented. It is for vmov i think. * log10 gets the sign wrong and I have no idea why. So far I've only tested using a Cortex-M7. M3 and M4 should work for integer code but I have not gotten around to testing that yet. There are also plenty of files that I figured does not belong in the TCC repository. It mostly contains build scripts, test harness code, various notes and so on. For an overview of how testing is going, check "tcc-hacking.ods" here: https://git.erlendjs.no/erlends-os/usr/compiler/tree/master/tinycc Anyways, I think my code is ready now. It successfully compiles all my projects that I have tried compiling, and they run properly although much slower. Regards, Erlend Sveen
_______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel