tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] simple dead code detection


From: Rob Landley
Subject: Re: [Tinycc-devel] simple dead code detection
Date: Tue, 19 Jun 2007 16:28:34 -0400
User-agent: KMail/1.9.6

On Tuesday 19 June 2007 14:45:29 Zdenek Pavlas wrote:
> Hi,
>
> This is an attempt to remove (some) unnecessary jumps.  Hit rates on the
> test source (i have used tcc itself) are quite high, but the overall
> savings are well below 2%, since most of the code are not jumps.  The
> overhead to keep track of jumps and labels is relatively high, so I've
> better made it conditional.  I have tested the i386 target and it looks
> ok.  undo_gjmp() for arm and c67 is implemented too and should be ok,
> but I can't test it.

Ooh, cool.  So where does dead_code get set?  Ah, I see.  Macros.  Hmmm...  
Bit ugly but minimal impact on the existing code.

Could you tell me a little more about what this is doing?  It looks like it's 
not addressing the "if(0) { blah blah blah; }" style dead code elimination, 
but just removing the spurious jumps that TCC sometimes inserts for empty 
case statements and such.  (I.E. just chopping out the "generate spurious 
jump to next address".)

I was pondering either having a variable to suppress code generation, or 
generating to a separate buffer and then either flushing the buffer to the 
output as a block or discarding it.  Making symbol resolution happy with this 
was non-obvious enough to stay on my todo list...

As Charles noticed, Ideally this would be great as a runtime rather than a 
compile time option, but I can clean that up later...

Rob
-- 
"One of my most productive days was throwing away 1000 lines of code."
  - Ken Thompson.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]