|C code refactoring or optimizing ? Dennis.Yurichev@gmail.com (Dennis Yurichev) (2007-03-29)|
|Re: C code refactoring or optimizing ? firstname.lastname@example.org (Ira Baxter) (2007-03-29)|
|Re: C code refactoring or optimizing ? email@example.com (Michael Beck) (2007-03-30)|
|Re: C code refactoring or optimizing ? firstname.lastname@example.org (Jeff Kenton) (2007-04-01)|
|From:||"Ira Baxter" <email@example.com>|
|Date:||29 Mar 2007 23:09:08 -0400|
|Organization:||NewsGuy - Unlimited Usenet $19.95|
|Posted-Date:||29 Mar 2007 23:09:08 EDT|
"Dennis Yurichev" <Dennis.Yurichev@gmail.com> wrote
> 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)
> } else
> To something like that:
> if (a>b+4)
> 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.
The DMS Software Reengineering Tookit has the machinery to support
this, including a robust C front with preprocessor, parser to ASTs,
symbol table construction, control and dataflow analysis. You can
specify tree to tree transformations either procedurally or with
source-to-source transformations, conditioned by the circumstances
(e.g, analyses) that make the transform legal. After transformation,
you can regenerate legal C source code, including the comments.
You should understand that setting this up isn't an afternoon's task.
DMS is a big tool, necessitated by the complexity of real languages
such as GCC and MS Visual Studio dialects of C. But if you have scale
or need to do this a lot, DMS is a big win.
DMS has been used to carry out these kinds of tasks
on very large C source code bases.
Ira Baxter, CTO
Return to the
Search the comp.compilers archives again.