Related articles |
---|
C code refactoring or optimizing ? Dennis.Yurichev@gmail.com (Dennis Yurichev) (2007-03-29) |
Re: C code refactoring or optimizing ? idbaxter@semdesigns.com (Ira Baxter) (2007-03-29) |
Re: C code refactoring or optimizing ? mm.beck@gmx.net (Michael Beck) (2007-03-30) |
Re: C code refactoring or optimizing ? jeffrey.kenton@comcast.net (Jeff Kenton) (2007-04-01) |
From: | Jeff Kenton <jeffrey.kenton@comcast.net> |
Newsgroups: | comp.compilers |
Date: | 1 Apr 2007 08:56:22 -0400 |
Organization: | Compilers Central |
References: | 07-03-102 |
Keywords: | C, optimize |
Posted-Date: | 01 Apr 2007 08:56:22 EDT |
Dennis Yurichev wrote:
> Hi.
> How can I find some ready tool or how can I find a proper way to
> develop a tool which will convert such code:
>
> if (a>b+2+2)
> {
> f1();
> f2(a*3*2);
> } else
> {
> f1();
> f3(a);
> }
>
> To something like that:
>
> f1();
> if (a>b+4)
> f2(a*6)
> else
> f3(a);
>
> In another words, this is what is done by modern compiler at
> optimization phase, right? (that's why I post here) But I need to have
> C-source at the input and C-source at the output. Could please anyone
> point me to any ideas or ready works.
Why? Assuming you want C code at the end and you're going to feed it to
a compiler, what does this accomplish besides cleaning up the code a
little? And how often do you really see code like this? If it's
frequent, you might consider training your programmers to write better
code, rather than wasting time on a tool to clean it up afterwards.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.