|
From: | Zdenek Pavlas |
Subject: | Re: [Tinycc-devel] tcc on x86_64 |
Date: | Mon, 20 Jul 2009 10:38:06 +0200 |
User-agent: | Thunderbird 1.5.0.12 (X11/20070530) |
shinichiro.h wrote:
I had done something like this (for i386), but then decided it wasn't worth the effort. It elliminated unneeded jumps, removed the "sub 0, esp" instruction, and used short jumps when possible, even for the conditional ones. Code size was reduced by some 16% (I used original tcc source for the test). I didn't test the compilation speed but it felt the same. The code worked, just the debug info was broken. I still keep the i386-gen.c somewhere, but it's ugly and outdated. Ideas used:* -fomit-frame-pointer would be cool to have (it should be easy to implement) * 'sub $0x0,%rsp' could be eliminated as a trivial common case * 'jmpq 15' could be eliminated as a trivial common caseAs Hanzac mentioned, eliminating them may need another pass. Sometimes I wonder it would be nice if we support "tiny optimizer" which does peephole optimizations introducing another pass.
- whenever a code of not-yet-known size is emitted (eg a forward jump), output a 12-byte node to the code segment instead, and put it on a list.
- at gfunc_epilog(), assign sizes to each node, put right code in them, and move all "fixed size" chunks that interleave them.
- whenever a code chunk is moved, update r_offset in all relocations pointing there. Fortunately this could be done efficiently.
The nice thing is most of the code generator was unchanged. If anyone wants to take a look, this link should be valid for 12 days.
http://leteckaposta.cz/497676104 -- Zdenek Pavlas GTS Novera a.s.
[Prev in Thread] | Current Thread | [Next in Thread] |