>> llvm-cbe began wrapping some types into >> structures as pairs. > >Did this happen for anything other than arrays? LLVM arrays semantics >are different from C (where arrays sometimes decay to pointers, while >structs don't). Keep in mind that the cbe also needs to be able to >compile LLVM code to C that came from other sources than the cfe.
The fault was entirely in opt. In the clisp.c example, opt combined some data into pairs called vectors and since clisp is using a lot of 32-bit types that resulted in structures with two 32-bit pairs in them. I took out the opt step to avoid this and retried the compiles. The vectors went away and the results were better without the opt step. I put together a small zip so you can see some of the results: https://drive.google.com/file/d/0B6XhJJ33xpOWYWF5ZksycDVJSWM/view?usp=sharing ====== source code: eliza.c sdcc compile to asm: eliza.c.asm (max optimization) link to binary: eliza_CODE.bin clang compile to .ll: eliza.c.ll (-fnosigned-char --target=sdcc-z80 -S -emit-llvm -w, include search paths added) llvm-cbe compile to .cbe.c: eliza.cbe.c (-O2 -disable-partial-libcall-inlining, tools I am using define required macros, hand edited to change "static inline" to "inline" & restore headers for sdcc compile step) sdcc compile to asm: eliza.cbe.c.asm (max optimization) link to binary: eliza-cbe_CODE.bin The C compiler generated portion of the binary was 927 bytes for the regular sdcc compile and 1210 bytes for the clang compile. That's a lot closer than when opt was used. If you look at the generated asm, the size difference mainly comes from the use of a lot more temporaries on the stack. ====== source code: clisp.c sdcc compile to asm: clisp.c.asm link to binary: clisp_CODE.bin clang compile to .ll: clisp.c.ll llvm-cbe compile to .cbe.c: clisp.cbe.c (same manual edits as above) sdcc compile to asm: clisp.cbe.c.asm (max optimization) link to binary: clisp-cbe_CODE.bin The C compiler generated portion of the binary was 11466 bytes for the regular sdcc compile and 12853 bytes for the clang compile, which is quite close. ====== So far the cfe/cbe seems capable of compiling without much manual intervention. I'm a little afraid to try examples with floats in them but if you'd like me to try more non-trivial test programs let me know. When I spend more time on this the first thing I will be looking at is trying to automate the manual steps I am taking to complete compiles. ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user